How do I debug executables linked with shared libraries?
 |
| This tip is just an overview. The shared library information in
Chapter 9 of the "TotalView Reference Guide" contains the
full story. That part of that chapter is only 2 1/2 pages long.
|
When you start TotalView with a dynamically linked executable, TotalView:
- Runs a sample process and then discards it.
- Reads information from the process.
- Reads the symbol table for each library.
When you attach to a process that uses shared libraries, here's what
TotalView does:
- If you attached to the process after the dynamic loader ran, TotalView loads the shared library's dynamic symbols.
- If you attached to the process before TotalView runs the dynamic loader, TotalView allows the process to run the dynamic loader to completion. It then loads the dynamic symbols for the shared library.
If you are executing a dynamically linked program, information isn't loaded
until it is needed. This happens because the linker places code into your
program that will actually do the loading. 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
Chapter 9 of the Reference Guide contains information
for loading shared libraries on HP.
You can find tips that we've already sent out in our Tip Archive
Help us improve these tips!