wiki:DebuggingGuidelines

Debug the code

Since the switch to shared libraries we use libtool to do the compiling and linking.

Due to its inner workings, the true executable is not generated until

make install

is executed. If you check on e.g. ./src/molecuilder in your build directory after compilation you will notice that it is just a shell script pointing to some stuff residing in .libs in the same directory.

Hence, debugging this shell script will not work, but make gdb cry out that it does not recognize the executable's format:

$> gdb ./src/molecuilder
GNU gdb (GDB) 7.1-ubuntu
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
"/mnt.auto/bespin/heber/workspace_C/molecuilder/debug64/src/molecuilder": not in executable format: File format not recognized
(gdb) q

Instead, execute:

libtool --mode=execute gdb --args ./src/molecuilder -v [some more options ...]

You may also set your own alias in ~/.bashrc to ease the typing, just add the following line to the file

alias debug='libtool --mode=execute gdb --args'
Last modified 14 years ago Last modified on Oct 12, 2010, 8:39:21 AM
Note: See TracWiki for help on using the wiki.