Peeter Joot's (OLD) Blog.

Math, physics, perl, and programming obscurity.

Archive for the ‘Development environment’ Category

git checkout atomicity?

Posted by peeterjoot on September 6, 2013

It was mentioned to me that git checkouts could (like CVS) return inconsistent views of a particular checkin (ie. some of the files from one person’s checkin). I’m guessing this is misinformation, but have only limited git experience to back up this believe. My expectation is based on the fact that even the mechanism for checkout runs counter to this possibility, since we checkout a specific commit, not any specific file. For example,

Create a repo

$ mkdir dummy
$ cd dummy
$ git init
Initialized empty Git repository in /home/myuserid/dummy/.git/

Populate it with some files

$ for i in  a b c d ; do echo $i > $i  d; done
$ git add *
$ git commit -a
$ for i in a b c d ; do echo $i >> $i ; done
$ git commit -a

$ git log a
commit fc1eb954f337e1e7e4ce30b21205f3f1a9542a35
Author: myuserid@mydomain.com <myuserid@mydomain.com>
Date:   Fri Sep 6 13:59:10 2013 -0400

    modified:   a
    modified:   b
    modified:   c
    modified:   d

commit 735e11eae4299d8693c22706a5010283cf4f0506
Author: myuserid@mydomain.com <myuserid@mydomain.com>
Date:   Fri Sep 6 13:58:43 2013 -0400

    new file: a
    new file: b
    new file: c
    new file: d

Now checkout a commit (the older one). See how all the files, not just one (say) of them matches the first commit in this repository

$ git checkout 735e11eae4299d8693c22706a5010283cf4f0506
Note: moving to "735e11eae4299d8693c22706a5010283cf4f0506" which isn't a local branch
If you want to create a new branch from this checkout, you may do so
(now or later) by using -b with the checkout command again. Example:
  git checkout -b <new_branch_name>
HEAD is now at 735e11e... new file: a new file: b new file: c new file: d
$ for i in a b c d ; do cat $i ; done
a
b
c
d

Suppose we checkout the second commit. Now we get all the files from the second commit. It seems to me that “atomicity” is built into the whole concept of g
it checkout:

$ git checkout fc1eb954f337e1e7e4ce30b21205f3f1a9542a35
$ for i in a b c d ; do cat $i ; done
a
a
b
b
c
c
d
d

I’d like to know if it’s possible to label a commit with a more meaningful name than these commit strings that are much like ascii barf.

Advertisements

Posted in Development environment | Tagged: , , , | 2 Comments »

Public service announcement: how to disable irritating flashing modal Lotus sametime chat windows.

Posted by peeterjoot on May 16, 2013

Lotus Notes/sametime has a spectacularly annoying default for their chat application that makes chat sessions modal by default.  Not only that, but they are both modal and flashing until you click on the window.

Somebody told me how to disable this brain dead “feature” on facebook, and I’m sharing it here.   You need to use File -> preferences -> sametime -> notifications, but once you are there what shows up is “Location awareness” :

Capture

You have to individually click on all the other options (like One-on-one) to actually disable the model and flashing nastiness.  For example:

Capture

Once this is done, then sametime windows hide in the background where they should be, until you actually get around to looking at them, if you ever choose to.

Posted in Development environment | Tagged: , , , | 2 Comments »

A workaround for the viral effect of incorrect Lotus notes automatic add to contacts (bad distribution lists)

Posted by peeterjoot on February 14, 2012

In Lotus Notes version 8, once an email is sent with an incorrect email address, it can have an almost viral effect. For example, we have a couple internal distribution lists that have been used incorrectly a few times:

askOSS@torolab.ibm.com
askBPS@torolab.ibm.com

(The actual distribution lists have canonical lotus notes addresses askOSS/…/…@…)

I’m on one such distribution list, and this incorrect address has been repeatedly added to my local address book, so once I try to send an email to our askOSS list, it bounces.

The workaround is to search through the local address book, find the bad addresses, and delete them. This unfortunately has to be done on any replicas separately, and it’s temporary because somebody ends up not knowing to do this, and the bad address ends up back in everybodies local address books again.

I asked our IT support folks about this. They’ve opened a defect against Lotus notes for this issue, but have also provided the following workaround:

As a temporary fix

  1. You will have to delete the incorrect address from your address book under recent contacts which you have been doing
  2. create a contact in the address book with the incorrect address as the main contact name with the right mail address in the contents of it
  3. you can disable the recent contact feature to add the names to the recent contacts field (before doing this you will have clear all the bad address from Contacts|recent contacts field)

Steps to disable recent contacts:

  • Click File|preferences|contacts
  • Check “Do not automatically add contacts to the recent contacts view”
  • click ok

I’m hopeful that this will deal with the problem.  The side effect will be that I will have a smaller contact list, but I think I can live with that.

Posted in Development environment | Tagged: | Leave a Comment »

$TMPDIR environment variable.

Posted by peeterjoot on June 20, 2011

/tmp filling up on Unix is a pain in the butt. When it happens everybody is effected, and it can destabilize the machine. On many of our work machines home is configured much bigger, than /tmp, so it’s generally advisable to not use /tmp itself. I’ll always include something like the following in my .profile (or .bash_profile)

export TMPDIR=$HOME/tmp

(where I’ve run mkdir -p $HOME/tmp when creating my .profile initially). Many people don’t know that /tmp can be avoided, but most system commands (and many scripts that are written politely) will respect the $TMPDIR. It’s also easier to clean up your stuff since you don’t have to search /tmp/ for your stuff. When some of the $HOME’s are split onto different filesystems then systematic use of $TMPDIR can make it harder for one hog to bog down everybody.

I’d like to see the ramdisk /tmp/ used by default on Linux (we are using SLES11 for which this doesn’t appear to be a default), like it is on Solaris. Then every reboot things start off clean.

Posted in Development environment | Tagged: , , | Leave a Comment »

some cpu info collection methods for HPUX.

Posted by peeterjoot on June 7, 2011

This link shows lots of ways to collect cpu info on hpux, but some of them appear to require root. Here’s a couple that work for me as a non-root user

$ grep processor /var/adm/syslog/syslog.log
Apr 17 00:44:17 mesh vmunix: 120 processor
Apr 17 00:44:17 mesh vmunix: 121 processor
Apr 17 00:44:17 mesh vmunix: 122 processor
Apr 17 00:44:17 mesh vmunix: 123 processor
$  ioscan -fnkC processor
Class       I  H/W Path  Driver    S/W State H/W Type  Description
===================================================================
processor   0  120       processor CLAIMED   PROCESSOR Processor
processor   1  121       processor CLAIMED   PROCESSOR Processor
processor   2  122       processor CLAIMED   PROCESSOR Processor
processor   3  123       processor CLAIMED   PROCESSOR Processor

This one appears to be the best way, since we get the CPU type too (1005 is what I believe to be a really old cpu version)

$ echo "map selall info;wait infolog" | /usr/sbin/cstm | grep -i cpu
   28  120                  CPU (1005)
   29  121                  CPU (1005)
   30  122                  CPU (1005)
   31  123                  CPU (1005)

Posted in Development environment | Tagged: | 1 Comment »

More windows powershell play

Posted by peeterjoot on December 26, 2010

It’s been a while since I tried windows powershell. I have a new Windows 7 computer now, and it seemed like a good opportunity to try it again. This shell is very different than the old windows shell, and it takes getting used to. My first task today was to figure out how to modify, or even see an environment variable. It turns out that this has a unix like syntax, so for example, I’m able to do the following:

echo $env:PATH
echo $env:HOMEPATH

Okay, perhaps I can make a unix like ‘cd’ alias that takes me straight to my %HOMEPATH%. I try the following (long winded) alias like command:

new-item -path alias:homedir -value 'cd $env:homepath'

Does it work?

PS C:\Users\Peeter\bin> homedir
Cannot resolve alias 'homedir' because it refers to term 'cd $env:homepath', which is not recognized as a cmdlet, funct
ion, operable program, or script file. Verify the term and try again.
At line:1 char:8

Nope. Perhaps I need chdir instead of cd. A bit of blundering and I find that I can remove my alias and try again with:

Remove-Item -path alias:homedir
new-item -path alias:homedir -value 'chdir $env:homepath'

But this behaves no better. I seem to recall that ‘cd’ and ‘chdir’ were in fact aliases in powershell, so I probably need the real applet names that these resolve to.

I recall that I’d made a note about how to save and restore aliases, and how to see what all the aliases were, but I get sidetracked, and wonder if I can make an aliases script, but I’m in a bit of a chicken and egg bind since I can’t start up a decent (ie: vim) editor. How do I modify my path?

It appears that I can do this also unix style with, in this case:

$env:PATH = "$env:PATH;C:\Program Files (x86)\Vim\vim73"

I don’t want to type this again, so it’s time to see if I can make a setenv.ps1 powershell script to perform this task. I produce such a file and get a message that scripts are disabled, with info on how to digitally sign scripts to allow execution, or how to change execution privledges to only block remote shell scripts. The command to do that appears to be:

Set-ExecutionPolicy RemoteSigned

but you have to start your powershell script in admin mode to do so. Under the powershell menu in the Start Menu (once I pin the command there), I have an admin mode prompt and am able to do so.

Rather painful, but I’m now able to create a basic powershell script, to import some useful environment settings. I found that this can be done in a multi-line fashion using back-quote as a line continuation character:

PS C:\Users\Peeter\bin> type .\setenv.ps1
$env:PATH = "$env:PATH" `
+ ";C:\Program Files (x86)\Vim\vim73" `
+ ";C:\cygwin\bin" `
+ ";C:\Program Files\Microsoft SDKs\Windows\v7.0\Bin\x64"

Now that I can run a script, here’s my aliases script:

get-item -path alias:* | where-object {$_.Definition -eq "Get-Childitem"}

I see that I have an alias for Get-Childitem, and can in fact use that to see my aliases:

PS C:\Users\Peeter\bin> gci alias:* | grep chdir
Alias           chdir                                               Set-Location

It also appears that I can use alias for this. Now can I make an alias that changes my home directory?

If I put this in a .ps1 script, and try to execute it, it appears that the scope of the new-item is restricted to the execution of the .ps1 script, as the following illustrates:

PS C:\Users\Peeter\bin> type .\alias1.ps1
new-item -path alias:homedir -value 'Set-Location $env:homepath'
PS C:\Users\Peeter\bin> .\alias1.ps1

CommandType     Name                                                Definition
-----------     ----                                                ----------
Alias           homedir                                             Set-Location $env:homepath


PS C:\Users\Peeter\bin> homedir
The term 'homedir' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spe
lling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:8
+ homedir <<< get-item -path alias:homedir
Get-Item : Cannot find path 'Alias:\homedir' because it does not exist.
At line:1 char:9
+ get-item <<<<  -path alias:homedir
    + CategoryInfo          : ObjectNotFound: (Alias:\homedir:String) [Get-Item], ItemNotFoundException
    + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetItemCommand

But, if I do it on the command line directly, I still have no luck:

PS C:\Users\Peeter\bin> new-item -path alias:homedir -value 'Set-Location $env:homepath'

CommandType     Name                                                Definition
-----------     ----                                                ----------
Alias           homedir                                             Set-Location $env:homepath


PS C:\Users\Peeter\bin> homedir
Cannot resolve alias 'homedir' because it refers to term 'Set-Location $env:homepath', which is not recognized as a cmd
let, function, operable program, or script file. Verify the term and try again.
At line:1 char:8
+ homedir <<<<
    + CategoryInfo          : ObjectNotFound: (homedir:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : AliasNotResolvedException

Perhaps this is a quoting issue? Maybe no quotes, or double quotes? No quotes doesn’t work:

PS C:\Users\Peeter\bin> gci alias:homedir

CommandType     Name                                                Definition
-----------     ----                                                ----------
Alias           homedir                                             Set-Location $env:homepath


PS C:\Users\Peeter\bin> remove-item -path alias:homedir
PS C:\Users\Peeter\bin> new-item -path alias:homedir -value Set-Location $env:HOMEPATH
New-Item : A positional parameter cannot be found that accepts argument '\Users\Peeter'.
At line:1 char:9
+ new-item <<<<  -path alias:homedir -value Set-Location $env:HOMEPATH
    + CategoryInfo          : InvalidArgument: (:) [New-Item], ParameterBindingException
    + FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.PowerShell.Commands.NewItemCommand

How about double quotes?

PS C:\Users\Peeter\bin> new-item -path alias:homedir -value "Set-Location $env:homepath"

CommandType     Name                                                Definition
-----------     ----                                                ----------
Alias           homedir                                             Set-Location \Users\Peeter


PS C:\Users\Peeter\bin> homedir
Cannot resolve alias 'homedir' because it refers to term 'Set-Location \Users\Peeter', which is not recognized as a cmd
let, function, operable program, or script file. Verify the term and try again.
At line:1 char:8
+ homedir <<<<
    + CategoryInfo          : ObjectNotFound: (homedir:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : AliasNotResolvedException

Nope.

Perhaps I need multiple parameter aliases have to be specified differently?

The help alias powershell info shows a similar example, but they use a function to do it. Let’s try that:

PS C:\Users\Peeter\bin> function homedir {set-location -path $env:HOMEPATH}
PS C:\Users\Peeter\bin> homedir
PS C:\Users\Peeter> 

Okay. I can live with that. Use functions instead of aliases. I do that in bash too sometimes, and it’s not too much of an imposition to do that for simple “aliases” in powershell. Now I just want an easy way of repeating this, and see that this is possible with a powershell profile script.

The $profile variable had the path to the script:

PS C:\Users\Peeter\bin> echo $profile
C:\Users\Peeter\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1

I’d seen this earlier when I was figuring out how to change environment variables. The variable is set, although the path (including the directory leading up to it) didn’t actually exist. Once I created that directory, and the file, it also didn’t execute because of the permissions issue. Now that I’ve set permissions to only exclude Remote scripts, it does work, and I can put my “alias” there.

Wow, that sidetracked me a bit! I started out with the intention to try to get an opengl sample program compiling with the Windows SDK compiler, and it appears that I cannot even do that in a powershell environment. There’s no equivalent to SetEnv.Cmd for powershell in the Windows SDK!

Posted in Development environment | Tagged: , , , , , , , , , , , , | 4 Comments »

Disabling that irritating windows reboot now dialogue.

Posted by peeterjoot on May 14, 2010

I found the following blog post about the awful childish nagging reboot prompter a while back:

XP Automatic Update Nagging

For Windows XP, I found only this one worked:

d:\peeterj> net stop "automatic updates"
The Automatic Updates service is stopping.
The Automatic Updates service was stopped successfully.

You can do this after the installer update virus kicks in, and then work in peace until you feel like rebooting. I do a shutdown instead of hibernation at the end of the work day after crippling the nagging modal dialog box, then I don’t have to take the 20 minute reboot cost until it is convenient(er).

Posted in Development environment | Tagged: | Leave a Comment »

using nm to track down the origin of an undefined symbol.

Posted by peeterjoot on March 22, 2010

The shared library for our product for historical reasons is built with the (evil) -Bsymbolic flag.

This has a number of unfortunate side effects, one of which is deferring link errors due to unresolved symbols to executable link time, instead of when we build the shared library itself.

Having screwed up in my own build over the weekend, I see a link error in my build summary this morning:

/view/peeterj_m20/vbs/engn/lib/libdb2.so: undefined reference to `XXYY'

I happen to know exactly what caused this (this time), but just the other day I was asked by somebody to help them figure out something similar. So the topic seems worthy of a quick blog post.

Suppose one collects all the archive names that contribute to the shared library in question (for DB2 builders one can relink the library having done an ‘export VERY_VERBOSE=true’ on the command line).

A good way to get this is to redirect that build output to a file, grab just the link line and run something like:

# cat filewithRawLinkLine.txt | tr ' ' '\n' | grep -F -e .a -e .o > archivesAndObjectNames.txt

In my case, this looked like:

# head -5 archivesAndObjectNames.txt    
../../common/crypt/iccsdk/ci_Linux_AMD64/libicc.a     
/view/peeterj_m20/vbs/common/crypt/src/libSTcrypt.a     
/view/peeterj_m20/vbs/common/sdbin/src/libSTdb2sdbin.a     
/view/peeterj_m20/vbs/install/src/libSTjdk_path.a     
/view/peeterj_m20/vbs/engn/atm/alibatm.a     

This now leaves you in the position to search for the archive(s) that contributed the undefined symbol. This can be done with:

# for i in `cat archivesAndObjectNames.txt` ; do echo $i ; nm $i | grep XXYY ; done | tee nm.out | grep -B1 XXYY
 /view/peeterj_m20/vbs/engn/sqe/alibsqe.a        U XXYY

So, the archive supplying a reference to this symbol is ‘alibsqe.a’ This completes the task of doing a first localization of where the link error is coming from. One can continue to do this in a brute force way finding the object file within the archive, or solve it by source inspection once one knows where to look a bit better. In an extremely large source base, where nobody really knows any sizeable portion of it, narrowing down the problem is often an important first step.

Posted in Development environment | Tagged: , , , | 1 Comment »

Abusing the Git version control system as a distributed filesystem.

Posted by peeterjoot on December 16, 2009

Motivation

I’ve switched from RCS to GIT as the VCS for my personal math and physics play latex source. I am currently using github to host all this stuff, and while this means that everybody has access to my sources (even drafts), I don’t really mind too much. Since there are not many that read even the final versions of this play math, this draft state is likely of even less interest.

Having done this and learned some GIT basics, I have also made the somewhat curious choice of using this VCS to host my personal internal scripts at work. I have many of these scripts checked into our clearcase repository which gives me access on all our development machines, so why would I use GIT?

The why is because it is easy. It is a bit of a pain to make quick and hacky changes to things that I have checked into clearcase. I have to open and accept a defect, merge and checkin my branch, and wait for the cronjob for our tools snapshot view to kick in and reload any changes I’ve made.

This inconvience is enough that I’ve gradually ended up with a hodge podge mix of some things in clearcase, some things on local file systems, some on our “deprecated” lab AFS (distributed filesystem), and some on NFS. I got a bit tired of this, and am now migrating all my private scripts and junk to git uniformly. This gives me the benefit of version control, while retaining the ease of modification that I have with purely local files. Because all GIT repository copies are all just as good as the other, I also have no dependency on flaky NFS servers.

Unlike my personal stuff I am obviously not using a public github hosted repository for work related stuff, but all I need is ssh keys available on my development machines to host things internally on any number of potential locations. I can push and pull local changes on any specific machine that I happen to be working with at the time with a –bare repository on an arbitrarily elected “repo server”. If that machine goes down any of the other recently used versions of my repository on some other machine can function as the master (either temporarily or permanently).

Setup a local repository

Getting started is pretty easy. Something like this will do the trick to get yourself an initial repository

$ cd
$ mkdir myjunk
$ cd myjunk
$ git init

You’ve now got a git repo with nothing in it. Supposing you’ve already got a crapload of stuff that you want under version control in directory ~/stuff, do the following

$ cp -a ~/stuff .
$ find stuff | xargs git add
$ git commit -a

The add tells the git repository about the file, directory or symlinks that you’ve copied into your repository. This is just a placeholder for the object and the ‘git commit’ actually creates it. If your intention was to sync this with a master (perhaps public like github) repository then nobody else will see it yet. If you were to, say, loose your harddrive at this point without backup, then even commited are toast because they haven’t been synced up (pushed) with anybody else.

One of the reasons I like using RCS is that it is really easy. You can get away with just a couple commands (‘co -l’, or ‘ci -l’ and rcsdiff). Git is actually easier. Once you’ve got a git repository directory created, checkout is implicit, so you just have to edit. ‘git commit filename’, or ‘git commit -a’ is the checkout and checkin equivalent, much like a ‘ci -l’ in RCS.

Setup a master repository

If your aim, like mine, is to share stuff across multiple machines, then you’ll want a separate master copy of the repository in addition to the working version you started with. This version will be different, in that it houses only the VCS meta and raw data, and has no visible directory structure. Such a master repository can be created with ‘git init –bare’, but we can also create it as a copy directly with something like: Creation is the same, but you’ll want a different directory name, and also use the ‘–bare’ flag when you create it. This would be something like:

$ cd
$ git clone --bare myjunk .myjunk.git
Initialized empty Git repository in /home/peeterj/.myjunk.git/

A directory listing will show you something like:

$ ls .myjunk.git
branches  config  description  HEAD  hooks  info  objects  packed-refs  refs

The config file and other stuff that was in the .git directory in a non-bare repository is now in the top most directory. Having created this I can now go to my working repository and use set this as the master copy to synchronize with

$ cd ~/myjunk
$ git remote add origin peeterj@machine1:test/.myjunk.git
$ cat .git/config
[core]
        repositoryformatversion = 0
        filemode = true
        bare = false
        logallrefupdates = true
[remote "origin"]
        url = peeterj@machine1:.myjunk.git
        fetch = +refs/heads/*:refs/remotes/origin/*
$ git push origin master
Everything up-to-date
$ git pull origin master
From machine1:.myjunk
 * branch            master     -> FETCH_HEAD
Already up-to-date.

Now getting your code on another machine is just another clone call, like

$ git clone peeterj@machine1:.myjunk.git anotherjunk
Initialized empty Git repository in /home/peeterj/anotherjunk/.git/
remote: Counting objects: 4430, done.
remote: Compressing objects: 100% (4124/4124), done.
remote: Total 4430 (delta 1216), reused 0 (delta 0)
Receiving objects: 100% (4430/4430), 8.12 MiB | 3.60 MiB/s, done.
Resolving deltas: 100% (1216/1216), done.

Here you specify the repository created with –bare as the location to copy from. By default git uses ssh, so have that setup for passwordless login (or be prepared to supply your password on each push and pull).

Some basic commands

Now that a master repository is setup, and working copies are in place on two or more machines, we are set to use it. One of the real powers of any modern VCS is the ability to handle merges and concurrent updates, but if using this as a personal distributed file system you probably can avoid any knowledge of how to do this for quite a while. Before making updates on a machine that hasn’t been used for a while, a pull will get you anything you’ve pushed recently. This could look something like

$ git pull origin master
remote: Counting objects: 50, done.
remote: Compressing objects: 100% (43/43), done.
remote: Total 43 (delta 30), reused 0 (delta 0)
Unpacking objects: 100% (43/43), done.
From machine1:.myjunk
 * branch            master     -> FETCH_HEAD
Updating e3c0c9c..ff49140
Fast forward
 bin/README     |    4 +
 bin/cfKiller   |  220 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 bin/cfpool     |    4 +-
 bin/homeclean  |    2 +-
 bin/killca     |    1 +
 bin/updateLoop |    2 +-
 6 files changed, 230 insertions(+), 3 deletions(-)
 create mode 100755 bin/cfKiller

and when you are done working on this machine for the day, or when you want to sync something up for use on a different machine, commit anything outstanding (ie. checkin), and then push it to the master for a pull from somewhere else.

$ git commit -a
...
".git/COMMIT_EDITMSG" 13L, 333C written
[master 13ec34c] add -noauto
 1 files changed, 65 insertions(+), 1 deletions(-)
 rewrite bin/fm (100%)
$ git push origin master
Counting objects: 7, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (4/4), done.
Writing objects: 100% (4/4), 1.21 KiB, done.
Total 4 (delta 2), reused 0 (delta 0)
To peeterj@machine1:.myjunk.git
   ff49140..13ec34c  master -> master

That’s all there is to using git as an ad-hoc distributed file system. It can be used this way like a version controlled rsync.

merging and branching … or not.

For my own use only to synchronize things across multiple machines, I don’t have any reason to use the branching or merging facilities. Merging is actually fairly intuitive, and I tried introducing a couple of conflicts since I was curious how it was done. If a conflicting change has been pushed, a pull will notify you of a merge requirement, and the default merge method appears to leave diff3 -m output in the file to be merged. Edit that, run ‘git add ./path_to_conflicting_file’ to mark it merged, commit the file(s), and push and you are done.

Posted in Development environment | Tagged: , , , | 1 Comment »

building a private version of gdb on a machine that has an older version.

Posted by peeterjoot on November 23, 2009

We have SLES10 linux machines, and the gdb version available on them is a old (so old that it no longer works with the version of the intel compiler that we use to build our product). Here’s a quick cheatsheet on how to download and install a newer version of gdb for private use, without having to have root privileges or replace the default version on the machine:

mkdir -p ~/tmp/gdb
cd ~/tmp/gdb
wget http://ftp.gnu.org/gnu/gdb/gdb-7.2.tar.bz2
bzip2 -dc gdb-7.2.tar.bz2 | tar -xf -
mkdir g
cd g
../gdb-7.2/configure --prefix=$HOME/gdb
make
make install

Executing these leaves you with a private version of gdb in ~/gdb/bin/gdb that works with newer intel compiled code.

This version of gdb has some additional features (relative to 6.8 that we have on our machines) that also look interesting:

  •  disassemble start,+length looks very handy (grab just the disassembly that is of interest, or when the whole thing is desired, not more hacking around with the pager depth to get it all).
  • save and restore breakpoints.
  • current thread number variable $_thread
  • trace state variables (7.1), and fast tracepoints (will have to try that).
  • detached tracing
  • multiple program debugging (although I’m not sure I’d want that, especially when just one multi-threaded program can be pretty hairy to debug).  I recall many times when dbx would crash AIX with follow fork.  I wonder if other operating systems deal with this better?
  • reverse debugging, so that you can undo changes!  This is said to be target dependent.  I wonder if amd64 is supported?
  • catch syscalls.  I’ve seen some times when the glibc dynamic loader appeared to be able to exit the process, and breaking on exit, _exit, __exit did nothing.  I wonder if the exit syscall would catch such an issue.
  • find.  Search memory for a sequence of bytes.

Posted in Development environment | Tagged: , | Leave a Comment »