5

I don't know why I can't see this backtrace. The symbols from my own binary are loaded, and the package libc6-dbg is installed. Do I need to tell gdb where to find the libc symbols?

Program received signal SIGSEGV, Segmentation fault.
__memcpy_ia32 () at ../sysdeps/i386/i686/multiarch/../memcpy.S:74
74  ../sysdeps/i386/i686/multiarch/../memcpy.S: No such file or directory.
(gdb) bt full
#0  __memcpy_ia32 () at ../sysdeps/i386/i686/multiarch/../memcpy.S:74
No locals.
#1  0x00000000 in ?? ()
No symbol table info available.
(gdb)
3
  • Is quite strange that you don't have a proper back trace, did you built with "-g -O0" options? Can it be a stack corruption that is overwriting return address?
    – jcm
    Commented Dec 13, 2013 at 20:03
  • @jcm would -O0 affect it?
    – jsj
    Commented Dec 15, 2013 at 10:15
  • Is possible that the builder is optimizing your application by trimming debug information from binary file. -O0 disables optimization and avoid this possibility. On the other hand, from number of lines in the backtrace, I would bet for a stack corruption. I'll try to add an answer to try to help on this.
    – jcm
    Commented Dec 15, 2013 at 12:03

1 Answer 1

1

From your backtrace, is possible that you've a stack corruption that is overwriting your return address (mainly because there's only two calls and no information about code calling memcpy is available). Is it possible that you're using memcpy over an address in the stack?

One way to check for this kind of corruptions is by using watch gdb command:

  1. Most important part is delimit the call that should be corrupting. In your case should be a call to memcpy or close to it.
  2. once you have a suspicious function, add a break point on it.
  3. Run until break point is reached.
  4. Set a watchpoint into calling function's address by: watch 0xXXXXXX
  5. Run until watchpoint is reached.

If return address is overwritten, db should stop on corrupting call.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.