4

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?

Thanks

4

2 回答 2

7

我认为/proc/pid/pagemap/proc/pid/maps包含此信息,但我不知道有任何工具以更有意义的格式转储它们。

您始终可以使用内核文档自己编写它:

http://www.kernel.org/doc/Documentation/vm/pagemap.txt

于 2012-11-09T05:14:11.963 回答
0

我最近用来执行此操作的脚本:

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
于 2018-08-23T23:43:39.633 回答