[英]Segments up to heap in /proc/self/maps output
My program, at a certain point in its execution, reads its own /proc/self/maps line by line until (and including) the heap. 我的程序在执行的某个时刻逐行读取自己的/ proc / self / maps,直到(包括)堆为止。 The program's path is "/home/t4". 该程序的路径是“ / home / t4”。 Here is the output: 这是输出:
00400000-00403000 r-xp 00000000 68:06 21629911 /home/t4
00602000-00603000 r--p 00002000 68:06 21629911 /home/t4
00603000-00604000 rw-p 00003000 68:06 21629911 /home/t4
00604000-00608000 rw-p 00000000 00:00 0
01905000-01926000 rw-p 00000000 00:00 0 [heap]
I was expecting only four segments: code, constants, static variables, heap; 我只期望四个部分:代码,常量,静态变量,堆; but here, there are five. 但是这里有五个 The first one clearly must be code, and the last is the heap. 显然第一个必须是代码,最后一个是堆。 Perhaps the second one is constants--but then what are the other two? 也许第二个是常数-但是另外两个是什么? Thanks! 谢谢!
初始化的静态变量后跟未初始化的静态变量(.BSS)-不需要存储在二进制文件中。
The first is the executable part itself (due to the x bit), the second is likely .rodata
(absence of w bit), the third is everything else ( .bss
and .data
). 第一个是可执行部分本身(由于x位),第二个可能是.rodata
(缺少w位),第三个是其他所有内容( .bss
和.data
)。 The fourth is the result of some mmap
call using MAP_ANONYMOUS
. 第四个是使用MAP_ANONYMOUS
mmap
调用的结果。 Note that malloc
(3) may very well be implemented using mmap
(2) rather than sbrk
(2). 注意,使用mmap
(2)而不是sbrk
(2)可以很好地实现malloc
(3)。 The [heap]
object there is the classic sbrk-heap (and only that), and does not cover private writable regions obtained using mmap. [heap]
对象是经典的sbrk-heap(仅此),并且不覆盖使用mmap获得的私有可写区域。 Traditional stack would be listed as [stack]
, but stacks of subthreads can use any memory region to store their stack, usually something malloc'd, so you will not see multiple [stack]
s either... 传统堆栈将被列为[stack]
,但是子线程堆栈可以使用任何内存区域来存储其堆栈,通常是通过malloc分配的,因此您也不会看到多个[stack]
。
Confusion complete? 混乱完成了吗? :-) :-)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.