Debugging a Program With dbx

Debugging Support for Preloaded Shared Objects

To put breakpoints in preloaded shared objects, the address of the routines has to be known to dbx. For dbx to know the address of the routines, it must know the shared object base address. Doing something as simple as:


stop in
run

requires special consideration by dbx. Whenever you load a new program, dbx automatically executes the program up to the point where rtld has completed construction of the link map. dbx then reads the link map and stores the base addresses. After that, the process is killed and you see the prompt. These dbx tasks are conducted silently.

At this point, the symbol table for libc.so is available as well as its base load address. Therefore, the address of printf is known.

The activity of dbx waiting for rtld to construct the link map and accessing the head of the link map is known as the rtld handshake. The event syncrtld occurs when rtld is done with the link map and dbx has read all of the symbol tables.