1

If I want to debug my program I call it like this:

gdb ./myprog
$ run < input.txt

But now I want to execute it line by line, but how can I do this? I know the step command but I can only call it, if the run command was called before. Do I have to stop the execution directly after the run command?

NaN
  • 3,501
  • 8
  • 44
  • 77

1 Answers1

4

Gdb has a start command, which takes the same arguments as the run command. After starting the program, it stops as soon as possible, usually at the start of the main function. After that, you can use the step command and any other commands that require a live process.

Reference: Debugging with GDB: Starting your Program

Mark Plotnick
  • 9,598
  • 1
  • 24
  • 40