Wingware Python IDE

The Intelligent Development Environment for Python Programmers

Using Wing IDE with IDA Python

Wing IDE is an integrated development environment
that can be used to write, test, and debug Python code that is written for
Hex-Rays IDA
multi-processor disassembler and debugger. Wing provides auto-completion, call
tips, a powerful debugger, and many other features that help you write,
navigate, and understand Python code.

Debugging IDA Python in Wing IDE

IDA embeds a Python interpreter that can be used to script the system. In order
to debug Python code that is run within IDA, you need to import a special
module in your code, as follows:

import wingdbstub
wingdbstub.Ensure()

You will need to copy wingdbstub.py out of your Wing IDE installation and
may need to set WINGHOME inside wingdbstub.py to the location where
Wing IDE is installed (on OS X, the name of
Wing's .app folder) if this value is not already set. Even though this is
an embedded instance of Python, leave the kEmbedded flag set to 0.

Next click on the bug icon in the lower left of Wing IDE's main window and make
sure that AcceptDebugConnections is checked. Then restart IDA and the debug
connection should be made as soon as the above code is executed, as indicated
by the color of the bug icon in Wing IDE.

At that point, any breakpoints set in Python code should be reached and Wing
IDE can be used to inspect the runtime state, step through code, and try
out new code in the live runtime.