[Mono-dev] {kinda OT} Linux equivalent of Win32 "ReadProcessMemory"...

Mike Edenfield kutulu at kutulu.org
Mon Apr 13 11:23:25 EDT 2009

On 4/13/2009 10:45 AM, Miguel de Icaza wrote:

> You might want to first look in /proc/PID/maps which describes which
> memory addresses are actually valid for that process. Then you can start
> seeking and reading at will.
> You still need this information if you are planning on using ptrace(2)
> instead of /proc/pid/mem

Thanks, that file looks very useful.  If you don't mind, two quick 
questions about what's in that file:

1. Currently I'm using "Process.MainModule.BaseAddress" to get the 
address of the actual binary in memory (I need this to get the ELF 
header).  Is this going to match one of these lines in the maps file (my 
guess being the executable one)?

08048000-08806000 r-xp 00000000 08:03 5000504 /opt/df/dwarfort.exe
08806000-08807000 r--p 007bd000 08:03 5000504 /opt/df/dwarfort.exe
08807000-08808000 rw-p 007be000 08:03 5000504 /opt/df/dwarfort.exe

2. To find the base address for it's memory layout in Windows, the app 
is just taking BaseAddress - 0x00400000.  This obviously isn't going to 
work in Linux, but for what I'm trying to do (read arbitrary data 
structures from the process) I really just need this line?

0a1ee000-0a369000 rw-p 0a1ee000 00:00 0       [heap]

Thanks for your help,


More information about the Mono-devel-list mailing list