15

IDAPython is great plugin in IDA. It is so handy to write small script to decode, decrypt or fix (patch) a binary in IDA. I can just write, load and run a script, and can use print for the usual shotgun debugging. But when I develop a bigger IDAPython script, I need a way to debug it.

I have searched and found that I can debug IDAPython with WingIDE but I want to find another that doesn't require WingIDE. Is there another way to debug IDAPython scripts?

  • i guess i am old fashioned, i use 'print' – Willem Hengeveld Mar 27 '14 at 20:20
2

UPDATE: This seems to be obsolete.

You can debug IDAPython scripts using Python Tools for Visual Studio. It is completely free, and very easy to use.

See this tutorial for this information.

  • The tutorial is wrong or obsolete. I repeated the steps with Visual Studio 2019 and IDA 7.2, it doesn't work. When Visual Studio starts to attach to IDA, it reports error. The error text is very informative ;) it is "General error occurred"... – Vitalii Aug 7 '19 at 11:10
  • Thanks. Edited the answer to reflect it. – tmr232 Aug 7 '19 at 12:34
8

You can do this. Last summer I worked with Hexrays and WingIDE guys and got this working. In fact its in the docs!

http://wingware.com/doc/howtos/idapython

It rocks.

Riley

4

As far as i know there's no way to debug python inside IDA.

There are, however, a few python tools you could use to debug your own code. but it will essentially require you to develop your own python IDE/debugger utilities around the built-in python debugging tools.

I'm listing the possible methods by order of complexity (simplest first):

Compiling and running your own python code from python
The more basic approach is using the python compile built-in function to compile python code into bytecode, executing that with eval or exec (also built-in functions). compile returns an AST (Abstract Syntax Tree) object you can further manipulate/investigate.

Using The python debugger (from python)
If you want more advanced debugging abilities, python has it's own built-in python debugger module called pdb. You only need to tell pdb what python code to execute, and it'll spawn a debugger interface similar to gdb, the command line debugger lets you set conditional breakpoints, manipulate and analyze python code, and use most of the usual debugging tools.

Using the python debugging framework
the python debugger is built on top of python's bdb (basic debugger), it is a class implementing debugging functionality and can be used from within IDA's python command line. If you're going to use the bdb you'll have to create your own tools and UI around these utilities.

Edit: I saw WingIDE only now. since OP didn't specify what exactly is the issue using WingIDE, I hope at least one of the methods will be relevant.

  • I would imagine the issue is that it isn't cheap. – cb88 Jun 6 '13 at 22:36
  • 1
    @cb88: 45$ vs the ~500$ IDA costs?.. sounds a bit odd but i guess it may be the reason. – NirIzr Jun 6 '13 at 23:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.