13.5.1 How it works
A step is the interval between two consecutive trace events: entering a statement, taking a decision, writing, calling, returning. Advancing one step delivers exactly the next event; there is nothing smaller.
The debugger's moves are built on events:
| Move | Until |
|---|---|
| next statement | the next statement of the same frame or an outer one |
| step into | the next statement, even inside a call |
| step out | the return that closes the current frame |
A line with five events: enter, decision, write, exit and end. An arc between two events marks a step. Below, a state change: n = 3.
ProgramA program to watch
Algorithm Observar
Define n As Integer <- 3;
If n > 2 Then
Write "grande";
EndIf
EndAlgorithmOutput
grande
The program finishes normally.
Trace
| Line | Event |
|---|---|
| 2 | enters statement |
| 3 | enters statement |
| 3 | decision · true branch |
| 4 | enters statement |
| 4 | writes · grande |
Every event can carry the state change: written variables, created objects, frames pushed or popped. Adding up the changes from the start gives the full state at any event, and asking about a past event again always gives the same answer. Events are delivered in batches of whatever size the host prefers, without losses or duplicates.
In short
- The trace is the list of events; a step is an event.
- Next, step into and step out are defined on events.
- State changes rebuild memory at any point.