Bug 12615 - Interrupt a running script
Summary: Interrupt a running script
Status: RESOLVED FIXED
Alias: None
Product: gdb
Classification: Unclassified
Component: python (show other bugs)
Version: HEAD
: P2 normal
Target Milestone: 7.6
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-03-29 06:52 UTC by Andre'
Modified: 2012-08-23 14:26 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andre' 2011-03-29 06:52:39 UTC
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.
Comment 1 Kevin Pouget 2011-12-05 12:54:03 UTC
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.
Comment 2 Tom Tromey 2012-08-22 20:38:41 UTC
Delivering SIGINT to gdb should work ok now.
It should do the right thing in Python code.
Comment 3 Andre' 2012-08-23 07:06:21 UTC
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.