Posts Tagged libtool

Debug libtool program with gdb

libtool program is a shell script that can’t work with gdb.Here is an example:
$ ls -l check_ifnet
-rwxr-xr-x 1 gentoo gentoo 4269 Aug 18 20:46 check_ifnet
$file check_ifnet
check_ifnet: POSIX shell script text executable

For libtool programs, the shared libraries are put into .lib directory and that script sets up the running environment (See more information I find that many people manually copy the shared libraries for debugging purpose. That’s not quite convenient.

I have two ways to test these kind of programs with gdb:

  1. edit the program and change this line “exec “$progdir/$program” ${1+”$@”}” to “gdb “$progdir/$program” ${1+”$@”}”. Then run the program.
  2. libtool –mode=execute gdb your_program (This one is better)

, , ,