This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: a function's loaded address in memory
- From: Nick Clifton <nickc at redhat dot com>
- To: sean yang <seanatpurdue at hotmail dot com>
- Cc: binutils at sourceware dot org
- Date: Tue, 28 Feb 2006 12:03:59 +0000
- Subject: Re: a function's loaded address in memory
- References: <BAY105-F27F5D52D8BB5DC715BB4A8C0FD0@phx.gbl>
Hi Sean,
If I can know write() is (dynamically) loaded to 0x192780--0x19279c,
then I know that
0x19279a/sys_write() is from it because 0x19279a belongs to [0x192780,
0x19279c].
My question is: is there an easy mechanism that I can get the
information of which function is loaded where in a run?
You could have the program itself print out the addresses of important
functions when it is running. eg:
printf ("The address of write() is %p\n", write);
If you use the prelink command to prepare your shared libraries for
loading then you could use the -v switch to get the base address of the
libraries. From this and the output of running nm on the nearest
library you should be able to work out which function was at a
particular address.
Cheers
Nick