我是 Linux 新手。我想知道不同段(如堆栈、堆、数据等)的起始地址和大小及其当前使用情况。
我想知道如何在运行进程和核心转储中找到。
提前致谢。
最佳答案
首先查看 proc(5)
文件系统。 man
是你的 friend 。
/proc/[number]/maps
包含当前映射的内存区域及其访问权限的文件
在gdb中,你可以使用
$ gdb -q
(gdb) help info proc
Show /proc process information about any running process.
Specify any process id, or use the program being debugged by default.
Specify any of the following keywords for detailed info:
mappings -- list of mapped memory regions.
stat -- list a bunch of random process info.
status -- list a different bunch of random process info.
all -- list all available /proc info.
查看 info proc mappings
,除非它在没有/proc 时不起作用(例如在事后调试期间)。
https://stackoverflow.com/questions/6622237/