开发者

Could not understand the output of pmap properly

I wrote a simple C program for threads whose process map looks like this:

anirudh@anirudh-Aspire-5920:~/Documents/DUMP$ pmap 3232
3232:   ./a.out
00148000   1372K r-x--  /lib/libc-2.12.1.so
0029f000      8K r----  /lib/libc-2.12.1.so
002a1000      4K rw---  /lib/libc-2.12.1.so
002a2000     12K rw---    [ anon ]
003c8000      4K r-x--    [ anon ]
00640000    112K r-x--  /lib/ld-2.12.1.so
0065c000      4K r----  /lib/ld-2.12.1.so
0065d000      4K rw---  /lib/ld-2.12.1.so
0074c000     84K r-x--  /lib/libpthread-2.12.1.so
00761000      4K -----  /lib/libpthread-2.12.1.so
00762000      4K r----  /lib/libpthread-2.12.1.so
00763000      4K rw---  /lib/libpthread-2.12.1.so
00764000      8K rw---    [ anon ]
08048000      4K r-x--  /home/anirudh/Documents/DUMP/a.out
08049000      4K r----  /home/anirudh/Documents/DUMP/a.out
0804a000      4K rw---  /home/anirudh/Documents/DUMP/a.out
08155000    132K rw---    [ anon ]
b6856000      4K -----    [ anon ]
b6857000   8192K rw---    [ anon ]
b7057000      4K -----    [ anon ]
b7058000   8200K rw---    [ anon ]
b786b000     12K rw---    [ anon ]
bfc8e000    132K rw---    [ stack ]
 total    18312K
anirudh@anirudh-Aspire-5920:

now out of the above mapping I think this must be the code segment because code segment can-not be changed unless the architecture supports self modifying code

08048000 4K r-x-- /home/anirudh/Documents/DUMP/a.out

This is the data segment. I declared a glob开发者_运维技巧al variable and checked its address and lied in the address range of the following segment.

0804a000 4K rw--- /home/anirudh/Documents/DUMP/a.out

Now I do not understand what is the following segment for...is it code or data.

08049000 4K r---- /home/anirudh/Documents/DUMP/a.out

Thanks for reading my question. Please help me out.


It's read-only data, such as e.g. string literals.

r-x: Code, and potentially read-only data
rw-: Data, modifiable
r--: Data, read-only
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜