2

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 global 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.

1 Answer 1

0

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
2
  • I printed the contents of that segment: ` !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_abcdefghijklmnopqrstuvwxyz{|}~������������������������������������������������������������������������������������������������������������������������������ ASCII Table is present there ... that too 6 times the table is printed. Now what is that ?
    – Durin
    Mar 8, 2011 at 14:55
  • I actually used printf("hello world");...so according to your answer that segment must have "hello world" somewhere in it. I printed that segment and I got nothing but ASCII table, that too 6 times.
    – Durin
    Mar 8, 2011 at 15:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.