Uprobes: howto calculate the probe offset

Prasanna S Panchamukhi prasanna@in.ibm.com
Mon Jan 23 14:26:00 GMT 2006


Ulrich,

> That's not how you in general can compute the offset.
> 
> You have to look at each loaded segment in the program header (PT_LOAD
> entries).  For each segment you can determine an offset which is the
> difference between the actual address used when loading the DSO and the
> p_vaddr in the file.
> 
> Then, whenever you look up a symbol, determine which segment the symbol
> is in (compare the address with [p_vaddr,p_vaddr+p_memsz) and add the
> offset for that segment to the address of the symbol as defined in the
> symbol table.
> 

Thanks for clarifying this.

Can we then use the bfd helpers (such as bfd_canonicalize_symtab()) to
get the symbol and section info and calculate the offset as you have
indicated above?

Thanks
Prasanna



More information about the Systemtap mailing list