首页 > 系统相关 >crash —— 查看进程的vma结构体

crash —— 查看进程的vma结构体

时间:2023-09-24 18:33:59浏览次数:34  
标签:crash rb 查看 0x0 vm vma 64 FILE x86

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

相关文章

  • crash —— 获取slub的详细信息
    在linux系统中可以通过/proc/slabinfo获取slab的统计数据,crash提供了kmem来实现这个功能。查看系统每个kmem_cache的概要信息crash>kmem-sCACHEOBJSIZEALLOCATEDTOTALSLABSSSIZENAMEffff888141e12000131072000128......
  • crash —— 将flags转换成可读的字符
    将page的flags转换为可读字符串crash>kmem-g01fffe00000a001cFLAGS:1fffe00000a001cPAGE-FLAGBITVALUEPG_referenced20000004PG_uptodate30000008PG_dirty40000010PG_reclaim170020000PG_unevictable19......
  • crash —— 查看当前系统每个page的信息
    linux中page数据结构可以通过mem_map数组访问,下面的方法可以输出每个page的相关成员。通用版本下面这个命令可以显示每个page的一些关键成员的值。crash>kmem-pPAGEPHYSICALMAPPINGINDEXCNTFLAGSffffea000000000000......
  • crash —— 获取系统NODE、ZONE、SECTION、MEMBLOCK等信息
    crash>kmem-nNODESIZEPGLIST_DATABOOTMEM_DATANODE_ZONES0100925439ffff88e03ffc1000----ffff88e03ffc1000ffff88e03ffc5000......
  • crash —— 获取vmalloc分配信息
    crash>kmem-vVMAP_AREAVM_STRUCTADDRESSRANGESIZEffff88debf51c900ffff88debf53bd00ffffc90000000000-ffffc900000020008192ffff88debf51cf60ffff88debf53bd40ffffc90000002000-ffffc90000004000......
  • crash —— 获取系统内存使用统计数据
    crash>kmem-iPAGESTOTALPERCENTAGETOTALMEM197646761754GB----FREE33983015129.6GB17%ofTOTALMEMUSED163663746624.3GB82%ofTOTALMEMSHARED139137......
  • Verdi波形查看transaction+门控时钟+时钟切换+vcs的ucli+斐波那契LFSR和伽罗瓦LFSR
    Verdi波形查看transaction除了以下两个选项以外,+UVM_TR_RECORD+UVM_LOG_RECORD还需要声明+UVM_VERDI_TRACE选项+UVM_VERDI_TRACE=UVM_AWARE+RAL+TLM+MSG+HIER+PRINT否则使用的是VC的环境抓取,而不是Verdi环境。(VerdiTransactiondebug)门控时钟时钟门控如果仅仅使用一个......
  • crash —— 获取物理内存布局信息
    crash>mach-mPHYSICALADDRESSRANGETYPE0000000000000000-0000000000001000E820_RESERVED0000000000001000-000000000006e000E820_RAM000000000006e000-0000000000070000E820_RESERVED0000000000070000-00000000000a0000E820_RAM0......
  • crash —— 获取cpuinfo信息
    crash>mach-cCPU0:structcpuinfo_x86{x86=6'\006',x86_vendor=0'\000',x86_model=85'U',x86_stepping=7'\a',x86_tlbsize=0,x86_virt_bits=48'0',x86_phys_bits=46......
  • crash —— 内核符号和地址直接相互转换
    通过sym可以将内核地址转换成内核符号,或者将内核符号转换成内核地址。根据地址转换为符号函数地址crash>symffffffff8166f300ffffffff8166f300(T)blk_update_request+16/home/pengdl/x86_64/linux-6.2/block/blk-mq.c:896全局变量crash>sym-qpanic_on_offfff......