I'm having some problems with reading /proc/<pid>/mem
What I'm doing is the following:
1. attach to another process using ptrace (it's paused automatically doing this)
2. read that processes' memory map (/proc/<pid>/maps)
3. do a pread() on each "segment" in the map
I've verified that the ptrace attaching works, the process is paused as expected.
The problem is reading the data, and I have two problems:
- It seems I'm reading nothing but zeros.
- I can read the three first segments just fine:
8048000 - 80bb000
80bb000 - 80be000
80be000 - 8179000
but when I hit the next one:a7a63000 - a7a81000
I get an "Invalid argument" from pread. I'm guessing it's the offset that's invalid since all the other arguments are unchanged from previous calls.
Any suggestions?