Support

Home | Support | Tips

How do I debug executables linked with shared libraries?

 

Note   
This tip is just an overview. The shared library information in the "TotalView Reference Guide" contains the full story, which is only 2 1/2 pages long.

When you start TotalView with a dynamically linked executable, TotalView:

  1. Runs a sample process and then discards it.
  2. Reads information from the process.
  3. Reads the symbol table for each library.  

When you attach to a process using shared libraries:

  • TotalView loads the shared library's dynamic symbols if you attached to the process after the dynamic loader ran.
  • TotalView allows the process to run the dynamic loader to completion if you attached to the process before TotalView runs the dynamic loader. 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 do the loading. On most operating systems, you can get the symbols loaded earlier by setting the LD_BIND_NOW environment variable. For example:

	setenv LD_BIND_NOW 1