PR14291: KeyboardInterrupt not caught for Python output

This commit is contained in:
Michael Eager 2012-06-25 16:53:20 +00:00
parent 944a90619c
commit adb4fe3b30
2 changed files with 23 additions and 13 deletions

View file

@ -1,3 +1,8 @@
2012-06-25 Michael Eager <eager@eagercon.com>
PR python/14291
* python/python.c (gdbpy_write): Check for interrupted output.
2012-06-25 Greta Yorsh <greta.yorsh@arm.com> 2012-06-25 Greta Yorsh <greta.yorsh@arm.com>
* arm-tdep.c (arm_in_function_epilogue_p): Recognize POP with a single * arm-tdep.c (arm_in_function_epilogue_p): Recognize POP with a single

View file

@ -862,26 +862,31 @@ gdbpy_write (PyObject *self, PyObject *args, PyObject *kw)
const char *arg; const char *arg;
static char *keywords[] = {"text", "stream", NULL }; static char *keywords[] = {"text", "stream", NULL };
int stream_type = 0; int stream_type = 0;
volatile struct gdb_exception except;
if (! PyArg_ParseTupleAndKeywords (args, kw, "s|i", keywords, &arg, if (! PyArg_ParseTupleAndKeywords (args, kw, "s|i", keywords, &arg,
&stream_type)) &stream_type))
return NULL; return NULL;
switch (stream_type) TRY_CATCH (except, RETURN_MASK_ALL)
{ {
case 1: switch (stream_type)
{ {
fprintf_filtered (gdb_stderr, "%s", arg); case 1:
break; {
} fprintf_filtered (gdb_stderr, "%s", arg);
case 2: break;
{ }
fprintf_filtered (gdb_stdlog, "%s", arg); case 2:
break; {
} fprintf_filtered (gdb_stdlog, "%s", arg);
default: break;
fprintf_filtered (gdb_stdout, "%s", arg); }
default:
fprintf_filtered (gdb_stdout, "%s", arg);
}
} }
GDB_PY_HANDLE_EXCEPTION (except);
Py_RETURN_NONE; Py_RETURN_NONE;
} }