Oracle® Solaris Studio 12.4: Debugging a Program With dbx

Exit Print View

Updated: January 2015
 
 

Setting a Breakpoint in an Explicitly Loaded Library

dbx automatically detects that a dlopen() or a dlclose() has occurred and loads the symbol table of the loaded object. Once a shared object has been loaded with dlopen() you can place breakpoints in it and debug it as you would any part of your program.

If a shared object is unloaded using dlclose(), dbx remembers the breakpoints placed in it and replaces them if the shared object is again loaded with dlopen(), even if the application is run again.

However, you do not need to wait for the loading of a shared object with dlopen() to place a breakpoint in it, or to navigate its functions and source code. If you know the name of the shared object that the program being debugged will be loading with dlopen(), you can request that dbx preload its symbol table by using the loadobject -load command:

loadobject -load /usr/java1.1/lib/libjava_g.so

You can now navigate the modules and functions in this load object and place breakpoints in it before it has been loaded with dlopen(). Once the load object is loaded by your program, dbx automatically places the breakpoints.

    Setting a breakpoint in a dynamically linked library is subject to the following limitations:

  • You cannot set a breakpoint in a filter library loaded with dlopen() until the first function in it is called.

  • When a library is loaded by dlopen(), an initialization routine named _init() is called. This routine might call other routines in the library. dbx cannot place breakpoints in the loaded library until after this initialization is completed. Therefore, you cannot have dbx stop at _init() in a library loaded by dlopen().