[prev in list] [next in list] [prev in thread] [next in thread] 

List:       oprofile-list
Subject:    Re: recovering the load address for an image
From:       Nathan Tallent <eraxxon () cs ! rice ! edu>
Date:       2005-03-28 16:18:02
Message-ID: 42482E3A.8080608 () cs ! rice ! edu
[Download RAW message or body]



John Levon wrote:
> So, the offset we feed into userspace is indeed the absolute file offset
> against 'A' on your diagram:
> 
> 
>>  A  B    C                D
>>  |--|----|----------------|------------------------
>>         txt           sample(offset,count)
> 
> 
> If you were to open the binary image with a hex editor and go to the
> file offset, you'd find the instruction that was at the PC value in the
> process's memory image.

Great.  Thanks for the clarification here and in the documentation.

It looks like the easy and efficient way of calculating a 'persistent 
VMA' D is to take this offset (D - A) and combine it with the offset of 
the first text section (C - A) and the persistent VMA (C) of the first 
text section:
   D = C + ((D - A) - (C - A))

That will work for both kernel and user space images as well as linked 
executables and DSOs.

-Nathan.


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
oprofile-list mailing list
oprofile-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/oprofile-list
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic