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

Mike Edenfield kutulu at kutulu.org
Wed Apr 15 14:27:05 EDT 2009


On 4/15/2009 12:33 PM, Martin Baulig wrote:

> What do you want to read from the process ?  If you're just interested
> in the executable, you can also read /proc/PID/exe.
>
> If you just need a timestamp, you may check /proc/PID/exe, which is a
> symbolic link to the ELF file, and check its creation time.

Most of what I'm interested in is actual runtime data from the heap -- 
large arrays of objects tracking the state of all of the units in the 
game.  The timestamp is used just to distinguish versions of the binary 
from each other, in case the memory layout changes.  So far, for all of 
the native Linux versions I have access to, the ELF Header e_entry has 
been slightly different, so I'm going with that.

Currently I can read the ELF data from /proc/PID/mem (through a 
FileStream) with no problem, but when I try to .Seek() to live data I 
get an "Invalid handle" error, even though I'm using the same instance 
of FileStream I just successfully read from.  My suspicion is that the 
address being passed around are somehow invalid and I'll need to figure 
out how to fix them up.

But thanks to this list I'm making far more progress than I expected in 
just a few days :)

--Mike




More information about the Mono-devel-list mailing list