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 - 80bb000but when I hit the next one:
80bb000 - 80be000
80be000 - 8179000
a7a63000 - a7a81000I 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.