a function's loaded address in memory

Nick Clifton nickc@redhat.com
Tue Feb 28 14:01:00 GMT 2006


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



More information about the Binutils mailing list