I am trying to learn how to access the memory region of a process in order to print the start and end addresses of the code, its data regions, and the start and end of the heap. I believe that /proc/$pid/maps contains the process's start and end memory regions but I am wondering if there is another way. Perhaps ptrace() ?
Asked
Active
Viewed 758 times
1 Answers
0
/proc/$pid/maps
or /proc/$pid/smaps
is the best, but linux specific, way to get the information about process address space mapping.
You could use /proc/$pid/mem
to access the memory regions (be careful to lseek
to appropriate regions, or to use mmap
to access it).

Basile Starynkevitch
- 223,805
- 18
- 296
- 547
-
It probably only exists in kernel land. So, no. On linux the `/proc` filesystem is the preferred way to query process- (and some system-) related things. – Basile Starynkevitch Apr 10 '12 at 07:06