Debugger
Wing Pro's Python debugger includes a powerful toolset for rapidly locating and fixing bugs in single and multi-threaded Python code running in a single or multi-process environment. The debugger supports breakpoints, stepping through code, inspecting and changing stack or module data, watch points, expression evaluation, and command shell style interaction with the paused debug process. Code may be run locally, on a remote host, virtual machine or device, or in a container like those provided by Docker.
There are a number of ways to use the debugger. Which one you choose depends on where your code is running, and how it is invoked:
Local Stand-Alone Code -- Wing can debug stand-alone scripts and applications that run on your local machine and that are launched on demand from within Wing. See Debugger Quick-Start for a quick introduction.
Remote Stand-Alone Code -- Wing Pro can debug stand-alone code running on a remote host, virtual machine or device, in the same way as it debugs locally running code. Wing uses a remote agent launched by SSH in order to work directly with files stored on the remote host, as if Wing were itself running on that system. For details, see Remote Development.
Containerized Code -- Wing Pro can also debug code running in containers like those provided by Docker. In this model, the IDE works with the local files that are used to build the container, and launches code for unit tests and debug in the container environment. For details, see Working with Containers and Using Wing Pro with Docker.
Local Externally Launched or Embedded Code -- Wing can debug locally running code that is launched by a web server or framework, embedded Python code that is used to script a larger application, and any other Python code that cannot be directly launched from the IDE. In this case, the code is started from outside Wing and connects to the IDE by importing Wing's debugger. Debug can be controlled from the IDE and through an API accessible from the debug process. For details, see Debugging Externally Launched Code.
Remote Externally Launched or Embedded Code -- Wing Pro can also debug externally launched or embedded code that is running on another host. In this case, Wing uses a remote agent to access the remote host via SSH and the debugged code imports Wing's debugger in order to connect back to the IDE through an automatically established reverse SSH tunnel. For details, see Debugging Externally Launched Remote Code.
Manually Configured Remote Debugging -- Wing can also debug code running on a remote host or device that is not accessible through SSH or where Wing's remote agent cannot be run. In this case, the device must be able to connect to the host where Wing is running via TCP/IP. Connectivity, file sharing, file location mapping, and other configuration needed to make debugging possible is accomplished entirely manually. For details, see Manually Configured Remote Debugging.
Because the debugger core is written in optimized C, debug overhead is relatively low. However, you should expect your code to run 25-30% slower within the debugger. Overhead is proportional to number of Python byte codes executed, so code that does a lot of work in Python and very little in support libraries will incur more overhead.
Wing Personal and Wing 101 omit some of the above features.
Section Contents
15.1. Debug Environment
15.2. Named Entry Points
15.3. Specifying Main Entry Point
15.4. Setting Breakpoints
15.5. Starting Debug
15.6. Debugger Status
15.7. Flow Control
15.8. Viewing the Stack
15.9. Viewing Debug Data
15.9.0. Stack Data Tool
15.9.0.0. Array, Data Frame, and Textual Data Views
15.9.0.1. Stack Data Options Menu
15.9.0.2. Stack Data Context Menu
15.9.0.3. Filtering Value Display
15.9.0.4. Advanced Data Display
15.9.1. Viewing Data on the Editor
15.9.2. Watching Values
15.9.3. Evaluating Expressions
15.9.4. Problems Handling Values
15.10. Debug Process I/O
15.10.0. External I/O Consoles
15.10.1. Debug Process I/O Multiplexing
15.11. Interactive Debug Console
15.11.0. Managing Program State
15.11.1. Debugging Code Recursively
15.11.2. Debug Console Options
15.11.3. Debug Console Limitations
15.12. Multi-Process Debugging
15.12.0. Debugging Child Processes
15.12.1. Process Control
15.13. Debugging Multi-threaded Code
15.14. Managing Exceptions
15.15. Running Without Debug