Differences between revisions 5 and 6
Revision 5 as of 2013-01-23 20:26:31
Size: 2037
Editor: BenReser
Comment: Show how to pass args to svn, show abbreviations in using libtool, and note how libtool works and why you need relative or absolute paths.
Revision 6 as of 2013-01-23 22:48:43
Size: 2037
Comment: Spelling error corrected
Deletions are marked like this. Additions are marked like this.
Line 37: Line 37:
M-x gbg -> libtool --mode=execute gdb -i=mi -epoch /your/target.file M-x gdb -> libtool --mode=execute gdb -i=mi -epoch /your/target.file

Resources:

remake -- a GNU Makefile debugger: http://bashdb.sourceforge.net/remake/remake.html/Summary.html#Summary

BashDB -- a bash script debugger: http://bashdb.sourceforge.net/bashdb.html#Top

Emacs-dbgr mode for the above: https://github.com/rocky/emacs-dbgr/wiki

Video for remake: http://showmedo.com/videotutorials/video?name=linuxBernsteinMakeDebug1&fromSeriesID=40

GDB tutorial: http://www.dirac.org/linux/gdb/

General debugging course: http://www.udacity.com/view#Course/cs259/CourseRev/1/Unit/135001/Nugget/137001

How to run gdb with libtool:

Shell:

Gdb can be run using subversion/svnrdump/.libs/lt-svnrdump. Note that this program doesn't exist until after the first post-compilation invocation of subversion/svnrdump/svnrdump itself.

Re-set $SHELL so shelling out from gdb will start your $SHELL, rather than sh.

  libtool --mode=execute env SHELL=$SHELL gdb -args ./subversion/svn/svn up -r 2

The execute mode can be abbreviated to make the command a little quicker to type:

  libtool e env SHELL=$SHELL gdb -args ./subversion/svn/svn up -r 2

Note that the above commands above must provide an absolute or relative path to a libtool wrapper script which wraps the executable you want to run. Even if the path to the script is on your PATH it will not work because libtool scans each argument to detect if it is a libtool wrapper script. When it finds an argument that is a libtool wrapper script it then sets the environment that the script would have and replaces the argument with the path to actual executable the script wraps. Since bare filenames on your path will not be resolved to absolute paths till the shell goes to execute them, it won't detect these scripts and won't set the environment up properly and gdb will complain that the script is not an executable.

Emacs:

Emacs 24.1.1 can run gdb with libtool inside gdb mode:

M-x gdb -> libtool --mode=execute gdb -i=mi -epoch /your/target.file

DebuggingTips (last edited 2013-01-23 22:48:43 by GabrielaGibson)