views:

225

answers:

1

I need to parse the output of "proc/pid/smaps" on a linux system. Running a perl/python script on this system is not an option. I was looking to see if there's a bash script to do the same.

Alternately, it would also be OK is there's a script (any script) which takes in output from /proc/pid/smaps in text format, and parses the information and dumps in human readable format :-)

A: 

A pretty high-level explanation of the content of /proc/pid/smaps is explained here: http://linux.die.net/man/5/proc. Search for 'smaps'.

The Linux kernel source can also be consulted, though that'll probably be more confusing unless you're familiar with the kernel.

In response to your comment, each 'section' is a Virtual Memory mapping, which could be to parts of a file, such as the executable .text section, data area of a shared library, stack, etc.

Executable part of the loader: b7f5d000-b7f77000 r-xp 00000000 08:05 2746096 /lib/ld-2.7.so

The processes' stack bf84a000-bf85f000 rw-p bffeb000 00:00 0 [stack]

Mike K