I am facing a weird problem! When my IDAPython script crashes, it produces a stack trace in the IDA default warning box that pops up right in front. The size of the box is neither adequate enough to hold the entire stack trace, nor it has any vertical scrollbar. Hence, the important part of the message is truncated, thus making debugging difficult. Is it possible to route the stack trace to console?
Yes, it is possible. You can enclose your whole script into try catch clause and print the stack trace with
traceback module such as in this example:
import traceback try: do_your_work() except: traceback.print_exc()
This will print your stack according to
stdout handle definition (which means output window by default).
Tested and works (prints all the stack into output window) in Ida 6.95 with the following script:
import sys import traceback def f(n): if n < 600: f(n+1) else: 0/0 try: f(0) except: traceback.print_exc()