gdb snapshots since 2004-02-03 now contain support identical to this patch
Enable deferred breaks in gdb
Purpose Allow gdb to set breakpoints in libraries that are not loaded yet (i.e.
libraries that will be loaded with dlopen in the future)
OpenOffice and Mozilla especially use a large amount of components which
are loaded at runtime from .so files with dlopen. gdb normally only sets
breakpoints if they can be resolved as the time of user insertion. This
patch allows them to be set even when they cannot be resolved, and gdb
will attempt to resolve the deferred breakpoints whenever a .so is
Execution To enable this you need to apply the patch of course, and in gdb set the
variable hack-allow-future-breaks to 1. You can put this in your .gdbinit
or from the gdb command line as follows...
(gdb) set hack-allow-future-breaks 1
How to Apply
get gdb release 6
tar xvzf gdb-6.0.tar.gz
patch -p1 < ../file.patch (or whatever you called it)
Details This (as its name implies) is something of a hack, but it appears to work fine.
Its based on the work by apple on their version of gdb. There they call the
feature future-break, their patch was unsuccesfully submitted as http://sources.redhat.com/ml/gdb-patches/2001-12/msg00296.html
Caolan McNamara (2003) <email@example.com>
Patch Against gdb6.0