[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Dynamic Link Libaries and nm/objdump

From: Dave Kent
Subject: Dynamic Link Libaries and nm/objdump
Date: Fri, 20 Oct 2000 20:28:23 -0700


I'm trying to write an encapsulated application class that correlates
pointer values to source file names and line numbers.  I use
__builtin_return_address(0) to generate a calling function's return address
inside an allocator, for example, and would like the program to be able to
alert the user about the line number where some leaking memory was
originally allocated.

I reversed engineered "objdump" and got everything working fine for binary
executable files.  However, trying to recurse through the "NEEDED" list and
deal with the dynamic link libraries is a problem.  The native "objdump",
and "nm", do not correlate lines of source code with function symbols
correctly for dynamic libraries.  I have tried loading the libraries with
dlopen() and finding the entry point addresses to be used as an offsets,
which works fine for those symbol values that have the correct line number
references but has no affect on the missing or incorrect correlations.

I am using:

GNU Linux 2.214-5.0
binutils 2.95

gdb's "list" command works flawlessly for dynamically loaded libraries (once
the main executable is running) so I'm sure this can be done (I guess I'll
try digging into gdb source next).  If there is a fix for "objdump", though,
that would make life easier.

Thanks for your help,

- David Kent
  Director of Server Technology

reply via email to

[Prev in Thread] Current Thread [Next in Thread]