crash工具使用小技巧

  1. bt命令,不解释
  2. 查看android ion内存分配器信息
crash> p num_heaps
num_heaps = $1 = 7
crash> 
crash> 
crash> p heaps
heaps = $2 = (struct ion_heap **) 0xffffffe531e1c480
crash> rd -64 0xffffffe531e1c480 7
ffffffe531e1c480:  ffffffe531e05800 ffffffe5318fb000   .X.1.......1....
ffffffe531e1c490:  ffffffe5318fb100 ffffffe5318fb200   ...1.......1....
ffffffe531e1c4a0:  ffffffe5318fb300 ffffffe5318fb400   ...1.......1....
ffffffe531e1c4b0:  ffffffe531e21c08                    ...1....
crash> struct ion_heap.name,dev,total_allocated 0xffffffe531e05800
  name = 0xffffff98e65926b0 "system"
  dev = 0xffffffe5318f8400
  total_allocated = {
    counter = 1914679296
  }
crash> struct ion_device.clients 0xffffffe5318f8400
  clients = {
    rb_node = 0xffffffe50655da00
  }
tree -t rbtree -o ion_client.node -s ion_client.pid,name,display_name,handles 0xffffffe5318f84c0 > ion_clients_system_heap.txt
crash> struct -o ion_client.handles 0xffffffe40d0da900
struct ion_client {
  [ffffffe40d0da920] struct rb_root handles;
}
crash> tree -t rbtree -o ion_handle.node -s ion_handle.buffer 0xffffffe40d0da920
ffffffe4116fea80
  buffer = 0xffffffe40d0db800
crash> ion_buffer.size 0xffffffe40d0db800
  size = 28672

这样,就可以找到每个buffer的大小

发表评论

电子邮件地址不会被公开。 必填项已用*标注