Getting backtrace during stack corruption
As we know , if program crashes and if it results in stack corruption, GDB will never give backtrace of the crashes.Even coredump does not help. Consider the below situation of stack corruption, Is it possible to make out anything useful from this for debugging?No Program received signal SIGSEGV , Segmentation fault . 0x00000002 in ?? () ( gdb ) bt #0 0x00000002 in ?? () #1 0x00000001 in ?? () #2 0xbffff284 in ?? () Backtrace stopped : previous frame inner to this frame ( corrupt stack ?) ( gdb ) Those bogus adresses (0x00000002 and the like) are actually PC values, not SP values. Now, when you get this kind of SEGV, with a bogus (very small) PC address, 99% of the time it's due to calling through a bogus function pointer. Note that virtual calls in C++ are implemented via function pointers, so any problem with a virtual call can manifest in the same way. An indirect call instruction just pushes the PC after the call onto the stack and then sets the PC
Comments
Post a Comment