diciotto
diciotto

Reputation: 67

Can gdb used to step through the assembler instructions of a program not compiled with -g?

I tried to run a program which is not compiled with the -g option inside gdb in Linux (e.g. /bin/ls). gdb runs the program (BTW lldb does not). I wonder whether it is possible to execute the program stepping through the machine instructions with si(I don't see why not, in principle). But the question is: how do you set breakpoints? If you simply run the program, it executes and exits.

Upvotes: 0

Views: 602

Answers (1)

that other guy
that other guy

Reputation: 123400

Yes, of course:

  • Use starti to start the program but break on the first instruction
  • Use disassemble to show the instructions for the current function
  • Use break *0x00007ffff7ec3f2d to set a breakpoint by address

Upvotes: 5

Related Questions