Solaris mdb debugger doesn't show correct stack info


I am analysing a core dump of a process under SPARC Solaris. mdb doesn't show functions in the stack correctly. Why could that be? No optimization compiler flags are used to build the process.

An update

SPARC keeps return addresses in %i7 and %o7 registers. Code that doesn't manipulate these registers directly can't corrupt %i7 and %o7 unless registers are saved to memory. Memory swaps happen during thread context switches and save, restore instructions (under certain conditions related to register windows handling).

Is the above a correct statement?

By looking at the code and parameter values the correct call stack should look like:`memcpy+SOME_OFFSET`makeBody+0xa8`parseBody+0x1cc`parse+0x1130`queue+0xd4
0xfebbaef8(0, 0, 0, 0, 0, 0)

However, mdb replaces "makeBody, memcpy+SOME_OFFSET" pair with memcpy+0x7f0:

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

%o7 and %i7 registers seems to show functions correctly but %pc and %npc do not:

> ::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`makeBody+0xa8 %i7 = 0xf8d5025c`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`memcpy+0x7f0
 %npc = 0xfed10ce8`memcpy+0x7f4
  %sp = 0xf8bfb048
  %fp = 0xf8bfb0b0

 %wim = 0x00000000
 %tbr = 0x00000000
asked on Stack Overflow Aug 17, 2018 by dmitri • edited Aug 21, 2018 by dmitri

0 Answers

Nobody has answered this question yet.

User contributions licensed under CC BY-SA 3.0