<type>documentation</type>
<domain>debug</domain>
<id>debugger</id>
<title>Debugger</title>
<date>$Date$</date>
<version>$Revision$</version>
<product>all</product>

~~~if WING101:
Wing's Python debugger can be used to locate and fix bugs in Python code, and as a way to step
through and better understand how the code works. Wing 101 omits most of the debugger features found
in Wing Pro, in order to focus on the minimum functionality necessary for students learning to
program for the first time.
~~~

~~~if WINGPER:
Wing Personal's Python debugger provides a toolset for rapidly locating and fixing bugs in single
and multi-threaded Python code. It supports breakpoints, stepping through code, and inspecting and
changing stack or module data. Wing Personal omits many of the more advanced debugger features found
in Wing Pro, including support for multi-process debugging, remote debugging, containers, interactive
command line debugging, conditional breakpoints, and other functionality.
~~~

~~~if WINGPRO:
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.
~~~

~~~if not WING101:
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
<ref:debug/quick-start>`__ for a quick introduction.
~~~

~~~if WINGPRO:
**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 <ref:proj/remote-hosts>`__.

**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 <ref:proj/containers>`__ and `Using Wing Pro with Docker <ref:howtos/docker>`__.
~~~

~~~if not WING101:
**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 <ref:debug/debugging-externally-launched-code>`__.
~~~

~~~if WINGPRO:
**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 <ref:debug/remote-debugging>`__.
~~~

~~~if not WING101:
**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 <ref:debug/manual-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.
~~~

~~~if WEBSITE:
Wing Personal and Wing 101 omit some of the above features.
~~~
