Solaris mdb调试器未显示正确的堆栈信息

时间:2018-08-17 07:53:52

标签: c++ debugging assembly solaris coredump

我正在分析SPARC Solaris下进程的核心转储。 mdb 无法正确显示堆栈中的功能。 为什么会这样? 不使用优化编译器标志来构建过程


更新

SPARC将返回地址保存在%i7和%o7寄存器中。除非将寄存器保存到内存中,否则不能直接操作这些寄存器的代码不会破坏%i7和%o7。内存交换发生在线程上下文切换和save, restore指令期间(在某些与寄存器窗口处理有关的条件下)。

以上说法正确吗?


通过查看代码和参数值,正确的调用堆栈应如下所示:

libc_psr.so.1`memcpy+SOME_OFFSET
lib_ap.so`makeBody+0xa8
lib_ap.so`parseBody+0x1cc
lib_ap.so`parse+0x1130
lib_ap.so`queue+0xd4
0xfebbaef8(0, 0, 0, 0, 0, 0)

但是,mdb用memcpy + 0x7f0替换了“ makeBody,memcpy + SOME_OFFSET”对:

> $G
C++ symbol demangling enabled
> ::stack
libc_psr.so.1`memcpy+0x7f0(22c3b3d0, 0, 140, f8e86dc6, 6170706c, 6d756c74)
lib_ap.so`parseBody+0x1cc(f8bfbf54, 22c3b3d0, 0, 140, f8e86dc6, f8e18090)
lib_ap.so`parse+0x1130(f8bfbdb4, f8e869fe, f8e849e8, f8e849fe, fec375bc, 50cf2488)
lib_ap.so`queue+0xd4(8b9cc8, f8bfc000, 0, 0, f8d07214, 0)
0xfebbaef8(0, 0, 0, 0, 0, 0)

%o7和%i7寄存器似乎正确显示了功能,但%pc和%npc却没有:

> ::regs
%g0 = 0x00000000                 %l0 = 0xff000000
%g1 = 0x00000000                 %l1 = 0x00ff0000
%g2 = 0x00000000                 %l2 = 0x0000ff00
%g3 = 0x22c3b3d0                 %l3 = 0xe06f6f6b
%g4 = 0xf8bfbf54                 %l4 = 0x00000061
%g5 = 0x00000004                 %l5 = 0x0000006d
%g6 = 0x00000000                 %l6 = 0x7efefeff
%g7 = 0xfe91ba40                 %l7 = 0x81010100
%o0 = 0x00000000                 %i0 = 0x22c3b3d0
%o1 = 0xf8e86ec6                 %i1 = 0x00000000
%o2 = 0x00000040                 %i2 = 0x00000140
%o3 = 0x74680000                 %i3 = 0xf8e86dc6
%o4 = 0xf8e86dc0                 %i4 = 0x6170706c
%o5 = 0x000000c0                 %i5 = 0x6d756c74
%o6 = 0xf8bfb048                 %i6 = 0xf8bfb0b0
%o7 = 0xf8d50058 lib_ap.so`makeBody+0xa8 %i7 = 0xf8d5025c lib_ap.so`parseBody+0x1cc

 %psr = 0xfe001006 impl=0xf ver=0xe icc=nzvc
                   ec=0 ef=4096 pil=0 s=0 ps=0 et=0 cwp=0x6
   %y = 0x00000000
  %pc = 0xfed10ce4 libc_psr.so.1`memcpy+0x7f0
 %npc = 0xfed10ce8 libc_psr.so.1`memcpy+0x7f4
  %sp = 0xf8bfb048
  %fp = 0xf8bfb0b0

 %wim = 0x00000000
 %tbr = 0x00000000

0 个答案:

没有答案