内核/ proc / pid / stack格式,地址是什么意思?

问题描述

给出了如下所示的堆栈:

  Certain features,such as `Flutter emulators` and `Flutter devices`,will not work without the currently missing
  SDK components.

cat /proc/17019/stack [<0>] futex_wait_queue_me+0xc4/0x120 [<0>] futex_wait+0x10a/0x250 [<0>] do_futex+0x325/0x500 [<0>] SyS_futex+0x13b/0x180 [<0>] do_syscall_64+0x73/0x130 [<0>] entry_SYSCALL_64_after_hwframe+0x3d/0xa2 [<0>] 0xffffffffffffffff 行为例,0xc4和0x120是什么意思?

另外,我如何找出与此地址对应的代码行?

解决方法

futex_wait_queue_me+0xc4/0x120-在此函数的调用堆栈中,当前操作的偏移量为0xc4,并且该函数的总大小为0x120,两者均为十六进制格式。对于内核子例程,可以使用vmlinux的objdump获得相应的行,前提是它具有可映射的调试符号。

如以下system_call_fastpath所示,在反汇编输出中,0x22的当前偏移量实际上是34d

[root@linux ~]# cat /proc/26581/stack
[<ffffffff9f28eace>] ep_poll+0x23e/0x360  
[<ffffffff9f28ff9d>] SyS_epoll_wait+0xed/0x120
[<ffffffff9f774ddb>] system_call_fastpath+0x22/0x27
[<ffffffffffffffff>] 0xffffffffffffffff

(gdb) disassemble system_call_fastpath
Dump of assembler code for function system_call_fastpath:
0xffffffff81774db9 <+0>:     cmp    $0x14c,%rax
0xffffffff81774dbf <+6>:     jae    0xffffffff81774f43 <badsys>
0xffffffff81774dc5 <+12>:    sbb    %rcx,%rcx
0xffffffff81774dc8 <+15>:    and    %rcx,%rax
0xffffffff81774dcb <+18>:    mov    %r10,%rcx
0xffffffff81774dce <+21>:    mov    -0x7e7fd6c0(,%rax,8),%rax
0xffffffff81774dd6 <+29>:    callq  0xffffffff81386770 <__x86_indirect_thunk_rax>
0xffffffff81774ddb <+34>:    mov    %rax,0x50(%rsp)
End of assembler dump.
(gdb)