How to read a memory map printout?

Hi all,

I'm looking at a memory map printed by gdb. While most of the output seems intuitive, there are some things which are not directly obvious. I read through the manual for gdb and didn't see this output addressed so maybe it's generating it by invoking something else.

Here are my guesses, let me know if I am even close to being correct:

1) Each line corresponds to an area of memory.

2) The first lines with small addresses are virtual memory and the later lines with longer addresses are physical addresses? This would put the heap in the correct location but not program text: http://web.sfc.keio.ac.jp/~rdv/keio/sfc/teaching/system-software/system-software-2008-prod/ncsu-linux_memory_map.png

3) The first two fields define the range of the area.

4) The next field has four bits, rwxp, standing for read, write, executable, and perhaps "paged".

5) The next field != f2-f1 so it isn't the size of the region. I don't know what it is.

6) The next field looks like it could be a time but I have no clue.

7) The next field is decimal and apparently also not the size of the region. I don't know what it is.

8) The next field is the corresponding object on disk.

9) Also, there are various unlabelled lines of a similar form:
7f1b13c1d000-7f1b13c2f000 rwxp 7f1b13c1d000 00:00 0

What are these?

10) A lot of the libraries seem to have four "copies" loaded, one which can't be accessed, one that is rx, one that is rw, and one that is r only. Why?

Best regards,
Craig


======= Memory map: ========
00400000-00693000 r-xp 00000000 00:24 138461511                          /h1/craig/Desktop/MolSurf/bin/MolSurf
00892000-00893000 r--p 00292000 00:24 138461511                          /h1/craig/Desktop/MolSurf/bin/MolSurf
00893000-00899000 rw-p 00293000 00:24 138461511                          /h1/craig/Desktop/MolSurf/bin/MolSurf
00899000-0089c000 rw-p 00899000 00:00 0 
01f49000-02250000 rw-p 01f49000 00:00 0                                  [heap]
41ab3000-41ab5000 rwxp 00000000 00:0f 1714                               /dev/zero
7f1ad4000000-7f1ad4021000 rw-p 7f1ad4000000 00:00 0 
7f1ad4021000-7f1ad8000000 ---p 7f1ad4021000 00:00 0 
7f1ada8c2000-7f1adb451000 rw-p 7f1ada8c2000 00:00 0 
7f1add68a000-7f1b04c0d000 rw-p 7f1add68a000 00:00 0 
7f1b0576b000-7f1b090de000 rw-p 7f1b0576b000 00:00 0 
7f1b0b2fa000-7f1b0c9fb000 rw-p 7f1b0b2fa000 00:00 0 
7f1b0ec34000-7f1b0f7c3000 rw-p 7f1b0ec34000 00:00 0 
7f1b1185c000-7f1b118bd000 rw-p 7f1b1185c000 00:00 0 
7f1b118ee000-7f1b119fc000 rw-p 7f1b118ee000 00:00 0 
7f1b119fc000-7f1b11a01000 r-xp 00000000 08:01 960330                     /usr/lib/libXdmcp.so.6.0.0
7f1b11a01000-7f1b11c00000 ---p 00005000 08:01 960330                     /usr/lib/libXdmcp.so.6.0.0
7f1b11c00000-7f1b11c01000 rw-p 00004000 08:01 960330                     /usr/lib/libXdmcp.so.6.0.0
7f1b11c01000-7f1b11c1c000 r-xp 00000000 08:01 318937                     /usr/lib/libxcb.so.1.1.0
7f1b11c1c000-7f1b11e1b000 ---p 0001b000 08:01 318937                     /usr/lib/libxcb.so.1.1.0
7f1b11e1b000-7f1b11e1c000 r--p 0001a000 08:01 318937                     /usr/lib/libxcb.so.1.1.0
7f1b11e1c000-7f1b11e1d000 rw-p 0001b000 08:01 318937                     /usr/lib/libxcb.so.1.1.0
7f1b11e1d000-7f1b11e1f000 r-xp 00000000 08:01 960328                     /usr/lib/libXau.so.6.0.0
7f1b11e1f000-7f1b1201e000 ---p 00002000 08:01 960328                     /usr/lib/libXau.so.6.0.0
7f1b1201e000-7f1b1201f000 r--p 00001000 08:01 960328                     /usr/lib/libXau.so.6.0.0
7f1b1201f000-7f1b12020000 rw-p 00002000 08:01 960328                     /usr/lib/libXau.so.6.0.0
7f1b12020000-7f1b12027000 r-xp 00000000 08:01 646907                     /lib/librt-2.9.so
7f1b12027000-7f1b12226000 ---p 00007000 08:01 646907                     /lib/librt-2.9.so
7f1b12226000-7f1b12227000 r--p 00006000 08:01 646907                     /lib/librt-2.9.so
7f1b12227000-7f1b12228000 rw-p 00007000 08:01 646907                     /lib/librt-2.9.so
7f1b12228000-7f1b1222a000 r-xp 00000000 08:01 646893                     /lib/libdl-2.9.so
7f1b1222a000-7f1b1242a000 ---p 00002000 08:01 646893                     /lib/libdl-2.9.so
7f1b1242a000-7f1b1242b000 r--p 00002000 08:01 646893                     /lib/libdl-2.9.so
7f1b1242b000-7f1b1242c000 rw-p 00003000 08:01 646893                     /lib/libdl-2.9.so
7f1b1242c000-7f1b1252e000 r-xp 00000000 08:01 960334                     /usr/lib/libX11.so.6.2.0
7f1b1252e000-7f1b1272e000 ---p 00102000 08:01 960334                     /usr/lib/libX11.so.6.2.0
7f1b1272e000-7f1b1272f000 r--p 00102000 08:01 960334                     /usr/lib/libX11.so.6.2.0
7f1b1272f000-7f1b12733000 rw-p 00103000 08:01 960334                     /usr/lib/libX11.so.6.2.0
7f1b12733000-7f1b12744000 r-xp 00000000 08:01 960336                     /usr/lib/libXext.so.6.4.0
7f1b12744000-7f1b12943000 ---p 00011000 08:01 960336                     /usr/lib/libXext.so.6.4.0
7f1b12943000-7f1b12944000 r--p 00010000 08:01 960336                     /usr/lib/libXext.so.6.4.0
7f1b12944000-7f1b12945000 rw-p 00011000 08:01 960336                     /usr/lib/libXext.so.6.4.0
7f1b12945000-7f1b136e7000 r-xp 00000000 08:01 335377                     /usr/lib/libGLcore.so.180.44
7f1b136e7000-7f1b137e6000 ---p 00da2000 08:01 335377                     /usr/lib/libGLcore.so.180.44
7f1b137e6000-7f1b13c1d000 rwxp 00da1000 08:01 335377                     /usr/lib/libGLcore.so.180.44
7f1b13c1d000-7f1b13c2f000 rwxp 7f1b13c1d000 00:00 0 
7f1b13c2f000-7f1b13d09000 r-xp 00000000 08:01 319921                     /usr/lib/libgfortran.so.3.0.0
7f1b13d09000-7f1b13f08000 ---p 000da000 08:01 319921                     /usr/lib/libgfortran.so.3.0.0
7f1b13f08000-7f1b13f09000 r--p 000d9000 08:01 319921                     /usr/lib/libgfortran.so.3.0.0
7f1b13f09000-7f1b13f0a000 rw-p 000da000 08:01 319921                     /usr/lib/libgfortran.so.3.0.0
7f1b13f0a000-7f1b13f0b000 rw-p 7f1b13f0a000 00:00 0 
7f1b13f0b000-7f1b13f1e000 r-xp 00000000 00:26 2361514                    /org/centers/cvc/software/share/usr.linux.x86_64/lib/boost-1.41.0/libboost_thread-mt.so.1.41.0
7f1b13f1e000-7f1b1411d000 ---p 00013000 00:26 2361514                    /org/centers/cvc/software/share/usr.linux.x86_64/lib/boost-1.41.0/libboost_thread-mt.so.1.41.0
7f1b1411d000-7f1b1411f000 r--p 00012000 00:26 2361514                    /org/centers/cvc/software/share/usr.linux.x86_64/lib/boost-1.41.0/libboost_thread-mt.so.1.41.0
7f1b1411f000-7f1b14120000 rw-p 00014000 00:26 2361514                    /org/centers/cvc/software/share/usr.linux.x86_64/lib/boost-1.41.0/libboost_thread-mt.so.1.41.0
...
7f1b1598f000-7f1b15a80000 r-xp 00000000 08:01 957966                     /usr/lib/libstdc++.so.6.0.10
7f1b15a80000-7f1b15c80000 ---p 000f1000 08:01 957966                     /usr/lib/libstdc++.so.6

Last edited on
You can find some information here:
http://www.ualberta.ca/CNS/RESEARCH/LinuxClusters/mem.html

Also, man proc and there is some information there under /proc/[number]/maps



Thank you!

Here are the answers I've found so far:

1) Each line corresponds to what the documentation calls a memory mapped region.

2) The program text is the correct location. My other documentation may be old. The program text avoids starting a 0 to preserve the meaning of a null pointer.

2') ... I'm still not sure about the addressing distinction. Some addresses are four bytes and some are six.

3) True. The first two fields are the address range.

4) True, but the p stands for private (copy on write). The alternative is s, which stands for shared. Threaded programs may share regions of memory.

5) The third field is the offset into the file or device listed in the final field of the memory region we are dealing with.

6) The next field is a device (major:minor).

7) The next field is the inode of the device.

8) True. This field is the pathname.

9) These lines reference somehow degenerate regions of memory but it's still not clear what's going on.

10) Three of the four regions belonging to the various libraries are the text (r-xp), the bss (rw-p) and the static data (r--p). I still am reading to learn what (---p) is doing.
Here is an easier to read hand-edited version of the above output.

off siz segment

Xdmcp
000 005 code
004 001 bss
005 1FF ---p

xcb
000 01B code
01A 001 static
01B 001 bss
01B 1FF ---p

Xau
000 002 code
001 001 static
002 001 bss
002 1FF ---p

rt
000 007 code
006 001 static
007 001 bss
007 1FF ---p

dl
000 002 code
002 001 static
003 001 bss
002 200 ---p

X11
000 102 code
102 001 static
103 004 bss
102 200 ---p

Xert
000 011 code
010 001 static
011 001 bss
011 1FF ---p

GLcore
000 25E code
DA1 437 rwxp
DA2 0FF ---p

gfortran
000 0DA code
0DA 001 bss
0DA 1FF ---p
0D9 001 static

boost_thread-mt
000 013 code
012 002 static
014 001 bss
013 11F ---p
Last edited on
Topic archived. No new replies allowed.