Currently there seems to be no way to interrupt a running python script in gdb. With the adoption of user defined pretty printers a gdb frontend cannot protect itself from a "rogue" pretty printer that does the equivalent of "while True: pass", or simply takes a very long time to evaluate. It would be nice if there was a supported way to interrupt a running script, or to set a maximal running time for a script in advance.
I agree, gdb/def.h defines this macro: > #define QUIT { \ > if (quit_flag) quit (); \ > if (deprecated_interactive_hook) deprecated_interactive_hook (); \ > } and: > /* Nonzero means a quit has been requested. */ > int quit_flag; > int immediate_quit; it could be convenient to have similar mechanisms in Python.
Delivering SIGINT to gdb should work ok now. It should do the right thing in Python code.
I can confirm this is fixed in current master branch from git://sourceware.org/git/gdb.git. Both Ctrl-C on the command line and kill -SIGINT work. Thank you for fixing this.