[英]Dumping page table entries of a process in Linux
I was wondering if there is any utility/code in Linux (x86-64) that could dump each page table entries for a given process's (user) address space? 我想知道Linux(x86-64)中是否有任何实用程序/代码可以转储给定进程(用户)地址空间的每个页表项?
Thanks 谢谢
I think /proc/pid/pagemap
and /proc/pid/maps
contain this info, but I am not aware of any tool dumping them in a more meaningful format. 我认为
/proc/pid/pagemap
和/proc/pid/maps
包含这个信息,但我不知道有任何工具以更有意义的格式转储它们。
You can always write it yourself using the kernel doc: 你总是可以使用内核doc自己编写它:
http://www.kernel.org/doc/Documentation/vm/pagemap.txt http://www.kernel.org/doc/Documentation/vm/pagemap.txt
A script I recently used to do this: 我最近用来做这个的脚本:
cat /proc/self/maps | while read line
do
echo ${line}
echo ${line} | awk '{print $1}' | (
IFS=- read start end
start=$(( 0x${start} ))
end=$(( 0x${end} ))
addr=${start}
while [ ${addr} -lt ${end} ]
do
printf "%08x: " ${addr}
dd if=/proc/self/pagemap bs=8 skip=$(( addr / 4096 )) count=1 2>/dev/null | od -v -t x8 -A none
addr=$(( addr + 4096 ))
done
)
done
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.