linuxdebugginggdbstripping

gdb debugging stripped executables


I have an executable provided as is. The creators have compiled it with minimal dependencies and no symbols. When I load it in gdb it sais:

...(no debugging symbols found)...done.

I would like to do step-by-step debugging in the assembler code with the optional exit point in case the execution does leave the shared executable. The reason I need this is because I have an executable which segfaults and I have no other means of tackling the problem.

I have created a minimalist example (simple.c++):

#include <stdlib.h>
#include <iostream>

int main () {
  std::cout << "Hello World!" << std::endl;

  return EXIT_SUCCESS;
}

and compile it with:

g++ -static -O3 simple.c++ -o simple
strip simple

Thank You in Advance.


Solution

  • I would like to do step-by-step debugging in the assembler code

    What is stopping you from doing just that?

    readelf -h a.out will tell you what address the start is at. Set a breakpoint there and continue with stepi or nexti.

    This will actually take a really long time, so a more efficient approach might be go backwards from the crash point, rather than forward from start. That is, run the binary until crash point, then figure out how you got there, set a breakpoint earlier, and re-run. Reverse debugging may also help.