GDB



next up previous


Pas à pas

"Stepping" means setting your program in motion for a limited time, so
that control will return automatically to the debugger after one line of
code or one machine instruction.  Breakpoints are active during stepping
and the program will stop for them even if it has not gone as far as the
stepping command specifies.

`step'     
     Proceed the program until control reaches a different line, then stop
     it and return to the debugger.  This command is abbreviated `s'.
     
`step COUNT'     
     Proceed as in `step', but do so COUNT times.  If a breakpoint
     or a signal not related to stepping is reached before COUNT steps,
     stepping stops right away.
     
`next'     
     Similar to `step', but any function calls appearing within the line of
     code are executed without stopping.  Execution stops when control reaches a
     different line of code at the stack level which was executing when the
     `next' command was given.  This command is abbreviated `n'.
     
     An argument is a repeat count, as in `step'.
     
`finish'     
     Continue running until just after the selected stack frame returns
     (or until there is some other reason to stop, such as a fatal signal
     or a breakpoint).
     
     Contrast this with the `return' command (*Note Returning::).
     
`stepi'     
`si'     
     Proceed one machine instruction, then stop and return to the debugger.
     
     It is often useful to do `display/i $pc' when stepping by machine
     instructions.  This will cause the next instruction to be executed to
     be displayed automatically at each stop.  *Note Auto Display::.
     
     An argument is a repeat count, as in `step'.
     
`nexti'     
`ni'     
     Proceed one machine instruction, but if it is a subroutine call,
     proceed until the subroutine returns.
     
     An argument is a repeat count, as in `next'.

A typical technique for using stepping is to put a breakpoint
(*Note Breakpoints::) at the beginning of the function or the section of
the program in which a problem is believed to lie, and then step through
the suspect area, examining the variables that are interesting, until the
problem happens.

The `cont' command can be used after stepping to resume execution
until the next breakpoint or signal.