crash提供了vm命令来输出进程的vma相关的信息。
输出当前当进程的vma列表
crash> vm
PID: 3319 TASK: ffff889760358000 CPU: 6 COMMAND: "kvm"
MM PGD RSS TOTAL_VM
ffff893ada165000 ffff893a8c4e2000 45772k 9535832k
VMA START END FLAGS FILE
ffff893a7eab1960 55b4b8274000 55b4b90d6000 8000875 /sf/bin/qemu-system-x86_64
ffff893a7eab1ed0 55b4b92d5000 55b4b9476000 8100875 /sf/bin/qemu-system-x86_64
ffff893cb6d533f0 55b4b9476000 55b4b956d000 8100877 /sf/bin/qemu-system-x86_64
ffff893a7eab1c18 55b4b956d000 55b4b9597000 8100077
ffff888bb1fbc828 7efa95dcf000 7efa95dd0000 8100070
ffff88ddadc64658 7efa95dd0000 7efa965d0000 8100077
ffff88d5d679bed0 7efa965d0000 7efa965d1000 8100070
...
查看指定进程的vma列表
crash> vm -p 2085
PID: 2085 TASK: ffff88dcca1fa000 CPU: 61 COMMAND: "supervisor"
MM PGD RSS TOTAL_VM
ffff88dea7232000 ffff88ddab4aa000 1960k 16960k
VMA START END FLAGS FILE
ffff88dcc9122658 400000 40e000 8000875 /sf/bin/supervisor
VIRTUAL PHYSICAL
400000 5e6cdf6000
401000 5e57277000
...
40c000 5e6efca000
40d000 5e7ad44000
VMA START END FLAGS FILE
ffff88dcc9123308 60d000 60e000 8100871 /sf/bin/supervisor
VIRTUAL PHYSICAL
60d000 5be9452000
VMA START END FLAGS FILE
ffff88dcc9123960 60e000 60f000 8100873 /sf/bin/supervisor
VIRTUAL PHYSICAL
60e000 5c00fdd000
VMA START END FLAGS FILE
ffff88dcc91222b8 2381000 23a6000 8100073
VIRTUAL PHYSICAL
2381000 5c181b3000
2382000 5bdd057000
2383000 5c30e4f000
...
VMA START END FLAGS FILE
ffff88dcc9123d00 7fa1cecdd000 7fa1cece0000 8000075 /lib/x86_64-linux-gnu/libdl-2.23.so
VIRTUAL PHYSICAL
7fa1cecdd000 5e4ad82000
7fa1cecde000 5e6359c000
7fa1cecdf000 5e58939000
VMA START END FLAGS FILE
ffff88dcc91223a0 7fa1cece0000 7fa1ceedf000 8000070 /lib/x86_64-linux-gnu/libdl-2.23.so
VIRTUAL PHYSICAL
7fa1cece0000 FILE: /lib/x86_64-linux-gnu/libdl-2.23.so OFFSET: 3000
7fa1cece1000 FILE: /lib/x86_64-linux-gnu/libdl-2.23.so OFFSET: 4000
7fa1cece2000 FILE: /lib/x86_64-linux-gnu/libdl-2.23.so OFFSET: 5000
7fa1cece3000 FILE: /lib/x86_64-linux-gnu/libdl-2.23.so OFFSET: 6000
...
VMA START END FLAGS FILE
ffff88dcc91236a8 7fa1cf0a1000 7fa1cf2a1000 8000070 /lib/x86_64-linux-gnu/libc-2.23.so
VIRTUAL PHYSICAL
7fa1cf0a1000 FILE: /lib/x86_64-linux-gnu/libc-2.23.so OFFSET: 1c0000
7fa1cf0a2000 FILE: /lib/x86_64-linux-gnu/libc-2.23.so OFFSET: 1c1000
7fa1cf0a3000 FILE: /lib/x86_64-linux-gnu/libc-2.23.so OFFSET: 1c2000
...
7fa1cf29f000 FILE: /lib/x86_64-linux-gnu/libc-2.23.so OFFSET: 3be000
7fa1cf2a0000 FILE: /lib/x86_64-linux-gnu/libc-2.23.so OFFSET: 3bf000
VMA START END FLAGS FILE
ffff88dcc9123790 7fa1cf2a1000 7fa1cf2a5000 8100071 /lib/x86_64-linux-gnu/libc-2.23.so
VIRTUAL PHYSICAL
7fa1cf2a1000 5b9e194000
7fa1cf2a2000 5c77e48000
7fa1cf2a3000 5c14c49000
7fa1cf2a4000 5be52cf000
VMA START END FLAGS FILE
ffff88dcc9123a48 7fa1cf2a5000 7fa1cf2a7000 8100073 /lib/x86_64-linux-gnu/libc-2.23.so
VIRTUAL PHYSICAL
7fa1cf2a5000 5c65e5e000
7fa1cf2a6000 5c22353000
VMA START END FLAGS FILE
ffff88dcc9122570 7fa1cf2a7000 7fa1cf2ab000 8100073
VIRTUAL PHYSICAL
7fa1cf2a7000 5bbfd52000
7fa1cf2a8000 5c0957a000
7fa1cf2a9000 (not mapped)
7fa1cf2aa000 5c7a4ea000
...
查看指定进程的指定vma的的内容
下面查看进程2085的vma:ffff88dcc9122570
的信息:
crash> vm -P ffff88dcc9122570 2085
PID: 2085 TASK: ffff88dcca1fa000 CPU: 61 COMMAND: "supervisor"
VMA START END FLAGS FILE
ffff88dcc9122570 7fa1cf2a7000 7fa1cf2ab000 8100073
VIRTUAL PHYSICAL
7fa1cf2a7000 5bbfd52000
7fa1cf2a8000 5c0957a000
7fa1cf2a9000 (not mapped)
7fa1cf2aa000 5c7a4ea000
或者使用2085进程的task_struct结构体的地址ffff88dcca1fa000:
crash> vm -P ffff88dcc9122570 ffff88dcca1fa000
PID: 2085 TASK: ffff88dcca1fa000 CPU: 61 COMMAND: "supervisor"
VMA START END FLAGS FILE
ffff88dcc9122570 7fa1cf2a7000 7fa1cf2ab000 8100073
VIRTUAL PHYSICAL
7fa1cf2a7000 5bbfd52000
7fa1cf2a8000 5c0957a000
7fa1cf2a9000 (not mapped)
7fa1cf2aa000 5c7a4ea000
查看某个进程的vma结构体的内容
crash> vm -x -v 2085
PID: 2085 TASK: ffff88dcca1fa000 CPU: 61 COMMAND: "supervisor"
struct vm_area_struct {
vm_start = 0x400000,
vm_end = 0x40e000,
vm_next = 0xffff88dcc9123308,
vm_prev = 0x0,
vm_rb = {
__rb_parent_color = 0xffff88dcc9123329,
rb_right = 0x0,
rb_left = 0x0
},
rb_subtree_gap = 0x400000,
vm_mm = 0xffff88dea7232000,
vm_page_prot = {
pgprot = 0x25
},
vm_flags = 0x8000875,
shared = {
rb = {
__rb_parent_color = 0xffff893cb8ff5f28,
rb_right = 0x0,
rb_left = 0x0
},
rb_subtree_last = 0xd
},
anon_vma_chain = {
next = 0xffff88dcc91226d0,
prev = 0xffff88dcc91226d0
},
anon_vma = 0x0,
vm_ops = 0xffffffff81e36e00 <generic_file_vm_ops>,
vm_pgoff = 0x0,
vm_file = 0xffff88ddae938c00,
...
}
...
struct vm_area_struct {
vm_start = 0x7ffe1cb03000,
vm_end = 0x7ffe1cb05000,
vm_next = 0x0,
vm_prev = 0xffff88dcc831e9f8,
vm_rb = {
__rb_parent_color = 0xffff88dcc831ea18,
rb_right = 0x0,
rb_left = 0x0
},
rb_subtree_gap = 0x0,
vm_mm = 0xffff88dea7232000,
vm_page_prot = {
pgprot = 0x25
},
vm_flags = 0x8040075,
shared = {
rb = {
__rb_parent_color = 0x0,
rb_right = 0x0,
rb_left = 0x0
},
rb_subtree_last = 0x0
},
anon_vma_chain = {
next = 0xffff88dcc831fd78,
prev = 0xffff88dcc831fd78
},
anon_vma = 0x0,
vm_ops = 0xffffffff81e3a100 <special_mapping_vmops>,
vm_pgoff = 0x0,
vm_file = 0x0,
vm_private_data = 0xffffffff81e00f20 <vdso_mapping>,
...
}
标签:crash,rb,查看,0x0,vm,vma,64,FILE,x86
From: https://www.cnblogs.com/pengdonglin137/p/17726392.html