This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Accessing symbol table to find function given address


Paulo J. Matos wrote:
Hello all,

Is there a way to access the symbol table during runtime to know which
function belongs to a given address. The problem is to print the
function name if I am instrumenting functions. I get the address, can
I during runtime print the function name? (or the solution is get it
through addr2line after program as run)?
If you are using glibc, you could try the dladdr() function. Otherwise you can try addr2line as you suggested.

David Daney.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]