Sun Studio 12: Debugging a Program With dbx

Setting a Breakpoint in a Shared Library

dbx provides full debugging support for code that uses the programmatic interface to the run-time linker: code that calls dlopen(), dlclose() and their associated functions. The run-time linker binds and unbinds shared libraries during program execution. Debugging support for dlopen() and dlclose() lets you step into a function or set a breakpoint in functions in a dynamically shared library just as you can in a library linked when the program is started.

However, there are exceptions. dbx is unable to place breakpoints in loadobjects that have not been loaded (by, for example, using dlopen():

You can put the names of such loadobjects on the preload list with the loadobject command (see loadobject Command).

dbx does not forget about a loadobject that was loaded using dlopen(). For example, a breakpoint set in a freshly loaded loadobject remains until the next run command, or even if the loadobject is unloaded with dlclose() and then subsequently loaded with dlopen() again.