TotalView Reference Guide : Part III: Platforms and Operating Systems : Operating Systems : Shared Libraries : Changing Linkage Table Entries and LD_BIND_NOW
Changing Linkage Table Entries and LD_BIND_NOW
If you are executing a dynamically linked program, calls from the executable into a shared library are made using the Procedure Linkage Table (PLT). Each function in the dynamic library that is called by the main program has an entry in this table. Normally, the dynamic linker fills the PLT entries with code that calls the dynamic linker. This means that the first time that your code calls a function in a dynamic library, the runtime environment calls the dynamic linker. The linker will then modify the entry so that next time this function is called, it will not be involved.
This is not the behavior you want or expect when debugging a program because TotalView will do one of the following:
*Place you within the dynamic linker (which you don't want to see).
*Step over the function.
And, because the entry is altered, everything appears to work fine the next time you step into this function.
On most operating systems (except HP), you can correct this problem by setting the LD_BIND_NOW environment variable. For example:
setenv LD_BIND_NOW 1
This tells the dynamic linker that it should alter the PLT when the program starts executing rather than doing it when the program calls the function.
HP-UX does not have this (or an equivalent) variable. On HP systems, you can avoid this problem by using the -B immediate option the executable being debugged, or by invoking chatr with the -B immediate option. (See the chatr documentation for complete information on how to use this command.)
You will also have to enter pxdb -s on.