core dump analysis gdb: print return address and arguments

0

I am trying to debug core dump using gdb as below

$ sudo gdb /usr/sbin/ietd /tmp/ietcore/CoreDump
This GDB was configured as "x86_64-linux-gnu".
Reading symbols from /usr/sbin/ietd...(no debugging symbols found)...done.
[New LWP 5978]
Core was generated by `/usr/sbin/ietd'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x00007fdb77c0da03 in _IO_vfprintf_internal (s=<optimized out>, format=<optimized out>, ap=ap@entry=0x7fffd3515fc8)
    at vfprintf.c:1661
1661    vfprintf.c: No such file or directory.
(gdb) info frame
Stack level 0, frame at 0x7fffd3515fc0:
 rip = 0x7fdb77c0da03 in _IO_vfprintf_internal (vfprintf.c:1661); saved rip = 0x7fdb77ccb388
 called by frame at 0x7fffd35160b0
 source language c.
 Arglist at 0x7fffd3515fb0, args: s=<optimized out>, format=<optimized out>, ap=ap@entry=0x7fffd3515fc8
 Locals at 0x7fffd3515fb0, Previous frame's sp is 0x7fffd3515fc0
 Saved registers:
  rbx at 0x7fffd3515f88, rbp at 0x7fffd3515fb0, r12 at 0x7fffd3515f90, r13 at 0x7fffd3515f98, r14 at 0x7fffd3515fa0,
  r15 at 0x7fffd3515fa8, rip at 0x7fffd3515fb8
(gdb) 
(gdb) bt
#0  0x00007fdb77c0da03 in _IO_vfprintf_internal (s=<optimized out>, format=<optimized out>, ap=ap@entry=0x7fffd3515fc8)
    at vfprintf.c:1661
#1  0x00007fdb77ccb388 in ___printf_chk (flag=1, format=<optimized out>) at printf_chk.c:35
#2  0x0000000000402a77 in event_loop ()
#3  0x00000000004022e8 in main ()
(gdb) 

now I want to print arguments and return address etc. But when I try to print using info symbol <address> as below. I get no symbol message.

(gdb) x $rbp
0x7fffd3515fb0: 112 'p'
(gdb) x/10xw $rbp+4
0x7fffd3515fb4: 0x00007fdb  0x77ccb388  0x00007fdb  0xd3516120
0x7fffd3515fc4: 0x00007fff  0x00000018  0x00000030  0xd35160b0
0x7fffd3515fd4: 0x00007fff  0xd3515fe0
(gdb) info symbol 0x00007fdb
No symbol matches 0x00007fdb.
(gdb) 

How can I print return address and args?.

UPDATE: Installed debug symbols but still receiving No Symbol Matches error

Reading symbols from /usr/sbin/ietd...Reading symbols from /usr/lib/debug//usr/sbin/ietd...done.
done.

Lines numbers for bt

(gdb) bt
#0  0x00007fdb77c0da03 in _IO_vfprintf_internal (s=<optimized out>, format=<optimized out>, ap=ap@entry=0x7fffd3515fc8)
    at vfprintf.c:1661
#1  0x00007fdb77ccb388 in ___printf_chk (flag=1, format=<optimized out>) at printf_chk.c:35
#2  0x0000000000402a77 in event_loop (timeout=-1) at ietd.c:237
#3  0x00000000004022e8 in main (argc=<optimized out>, argv=<optimized out>) at ietd.c:565
(gdb) 
c
linux
gdb
kernel
coredump
asked on Stack Overflow May 30, 2015 by (unknown user) • edited May 30, 2015 by (unknown user)

1 Answer

2

still receiving No Symbol Matches error

That's because the address you are looking for: 0x00007fdb does not correspond to any symbol.

As EOF said, x86_64 optimized code does not use frame pointers, so looking at contents of memory around %rbp is often not useful.

For your general problem: understanding the crash inside _IO_vfprintf_internal, it's usually easiest to step up to the caller of printf (frame 2 in your case), and look at the format specifier and arguments there.

answered on Stack Overflow May 30, 2015 by Employed Russian

User contributions licensed under CC BY-SA 3.0