This is the mail archive of the
mailing list for the GDB project.
Anyone know some reasonably portable way to determine the return address of a function?
- To: "George T. Talbot" <george at moberg dot com>
- Subject: Anyone know some reasonably portable way to determine the return address of a function?
- From: David Taylor <taylor at cygnus dot com>
- Date: Fri, 09 Jun 2000 16:50:52 -0400
- cc: gdb at sourceware dot cygnus dot com
Date: Tue, 06 Jun 2000 18:52:45 -0400
From: "George T. Talbot" <firstname.lastname@example.org>
I'm working on some library code in Linux, and, for debugging purposes, I'd
like to be able to call dlinfo() on the return address of a function in my
library so that I can track usage of the function:
#define magic() ...woudln't I like to know...
If you're using gcc, look in the gcc documentation at
void* return_address = magic();
if (dlinfo(return_address, &info))
fprintf(some_log_file, "some_library_function() called from %s in executable
fprintf(some_log_file, "some_library_function() called from unknown
...do the actual work...
In other words, I want magic() above to return the address in some_code()
where some_library_function() was called.
Please cc: me if you post a reply to the list, in case I miss your reply.
George T. Talbot
<george at moberg dot com>