From: Michael Eager Date: Mon, 25 Jun 2012 16:53:20 +0000 (+0000) Subject: PR14291: KeyboardInterrupt not caught for Python output X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=adb4fe3b309bace3ceb2c0e305f7faf41eb708a6;p=binutils-gdb.git PR14291: KeyboardInterrupt not caught for Python output --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index fe013dee4b0..a36ce76e2bd 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2012-06-25 Michael Eager + + PR python/14291 + * python/python.c (gdbpy_write): Check for interrupted output. + 2012-06-25 Greta Yorsh * arm-tdep.c (arm_in_function_epilogue_p): Recognize POP with a single diff --git a/gdb/python/python.c b/gdb/python/python.c index 19eb7b546af..c66efe465e7 100644 --- a/gdb/python/python.c +++ b/gdb/python/python.c @@ -862,26 +862,31 @@ gdbpy_write (PyObject *self, PyObject *args, PyObject *kw) const char *arg; static char *keywords[] = {"text", "stream", NULL }; int stream_type = 0; + volatile struct gdb_exception except; if (! PyArg_ParseTupleAndKeywords (args, kw, "s|i", keywords, &arg, &stream_type)) return NULL; - switch (stream_type) + TRY_CATCH (except, RETURN_MASK_ALL) { - case 1: - { - fprintf_filtered (gdb_stderr, "%s", arg); - break; - } - case 2: - { - fprintf_filtered (gdb_stdlog, "%s", arg); - break; - } - default: - fprintf_filtered (gdb_stdout, "%s", arg); + switch (stream_type) + { + case 1: + { + fprintf_filtered (gdb_stderr, "%s", arg); + break; + } + case 2: + { + fprintf_filtered (gdb_stdlog, "%s", arg); + break; + } + default: + fprintf_filtered (gdb_stdout, "%s", arg); + } } + GDB_PY_HANDLE_EXCEPTION (except); Py_RETURN_NONE; }