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) 
5
  • Using %rbp to debug is likely to fail on optimized binaries. It's commonly used as just another callee-saved register, not as a frame-pointer. Also, download debug symbols. Commented May 30, 2015 at 10:04
  • I have installed debug info packages. Then why does it say no symbols Commented May 30, 2015 at 10:08
  • ok now I have installed symbols specific for package but still I am getting no symbol match Commented May 30, 2015 at 10:14
  • Appearantly there was no line number in previous bt trace. But in new trace there are line numbers and args for files. Not sure how it came. Trying to use those line numbers for debugging Commented May 30, 2015 at 11:30
  • symbols I was able to find using info symbol <function-btstacktrace address>. again not sure whether that is useful Commented May 30, 2015 at 11:33

1 Answer 1

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.

Sign up to request clarification or add additional context in comments.

2 Comments

yup used frame 2 and info args info locals etc commands
It was printf I placed in my code and type specifier was incorrect such as %s instead of %d. But still wanted to reach to that point using info symbol. I found it using line numbers in bt

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.