This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap 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: Uprobes: howto calculate the probe offset


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


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