Flow Control

Index of All Documentation » Wing Pro Reference Manual » Debugger »


Once the debugger is running, the following commands are available to control further execution of the debug process from Wing.

Stepping Through Code

When stopped on a given line of code, execution can be controlled as follows from the Debug menu (some of these are omitted in Wing Personal and Wing 101)

Step Over Instruction will step over a single instruction in Python. This may not leave the current line if it contains something like a list comprehension or single-line for loop.

Step Over Statement will step over the current statement, even if if spans more than one line or contains a looping construct like a list comprehension.

Step Over Block will step over or finish the current block of code, such as a for loop, conditional, function, or method.

Step Into will attempt to step into the next executed function on the current line of code. If there is no function or method to step into, this command acts like Step Over Instruction. When used on an import, this will skip Python code executed in importlib and instead will step directly into the imported module. This behavior can be disabled with the Debugger > Advanced > Step Past importlib Frames preference.

Step Out will complete execution of the current function or method and stop on the first instruction encountered after returning from the current function or method.

Continue will continue execution until the next breakpoint, exception, or program termination.

Run To Cursor will run to the location of the cursor in the frontmost editor, or to the next breakpoint, exception, or program termination.

You can you also step through code using the toolbar icons. The step icon in the toolbar implements Step Over Statement.

Pausing and Terminating Debug

At any time, a freely running debug process can be paused with the Pause item in the Debug menu or with the pause tool bar button. This will stop at the current point of execution of the debug process, as long as some Python code is being executed.

At any time during a debug session, the Stop Debugging menu item or toolbar item can be used to force termination of the debug process. This option is disabled if the current process was launched outside of Wing. It may be enabled for all local processes by using the Debugger > Listening > Kill Externally Launched Processes preference.

Move Program Counter

Move Program Counter Here in the editor's right-click context menu moves the current position of the execution counter within the innermost stack frame to any other valid position within the same scope. Stepping or execution will continue with the selected line.

Because of how Python is implemented, this feature works only in the innermost stack frame and it does not work when the debugger is stopped on an exception.