aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2013-02-28 19:25:42 +0000
committerTom Tromey <tromey@redhat.com>2013-02-28 19:25:42 +0000
commit7f6a5dde442f1c824c4a559c3a3e819d80d91586 (patch)
tree8164e7e33f91e0cbe5aba7bf71d79e40bf4b9bd9
parent9e974e552d14a3755637f24215c563976716c971 (diff)
downloadgdb-7f6a5dde442f1c824c4a559c3a3e819d80d91586.zip
gdb-7f6a5dde442f1c824c4a559c3a3e819d80d91586.tar.gz
gdb-7f6a5dde442f1c824c4a559c3a3e819d80d91586.tar.bz2
* python/python.c (gdbpy_print_stack): Call begin_line and
fprintf_filtered inside TRY_CATCH.
-rw-r--r--gdb/ChangeLog5
-rw-r--r--gdb/python/python.c29
2 files changed, 24 insertions, 10 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index e785983..8194eea 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,10 @@
2013-02-28 Tom Tromey <tromey@redhat.com>
+ * python/python.c (gdbpy_print_stack): Call begin_line and
+ fprintf_filtered inside TRY_CATCH.
+
+2013-02-28 Tom Tromey <tromey@redhat.com>
+
* python/python.c (gdbpy_find_pc_line): Call find_pc_line
inside TRY_CATCH.
diff --git a/gdb/python/python.c b/gdb/python/python.c
index e2c19b3..405eb5b 100644
--- a/gdb/python/python.c
+++ b/gdb/python/python.c
@@ -1043,6 +1043,8 @@ gdbpy_flush (PyObject *self, PyObject *args, PyObject *kw)
void
gdbpy_print_stack (void)
{
+ volatile struct gdb_exception except;
+
/* Print "none", just clear exception. */
if (gdbpy_should_print_stack == python_excp_none)
{
@@ -1055,7 +1057,10 @@ gdbpy_print_stack (void)
/* PyErr_Print doesn't necessarily end output with a newline.
This works because Python's stdout/stderr is fed through
printf_filtered. */
- begin_line ();
+ TRY_CATCH (except, RETURN_MASK_ALL)
+ {
+ begin_line ();
+ }
}
/* Print "message", just error print message. */
else
@@ -1068,17 +1073,21 @@ gdbpy_print_stack (void)
/* Fetch the error message contained within ptype, pvalue. */
msg = gdbpy_exception_to_string (ptype, pvalue);
type = gdbpy_obj_to_string (ptype);
- if (msg == NULL)
+
+ TRY_CATCH (except, RETURN_MASK_ALL)
{
- /* An error occurred computing the string representation of the
- error message. */
- fprintf_filtered (gdb_stderr,
- _("Error occurred computing Python error" \
- "message.\n"));
+ if (msg == NULL)
+ {
+ /* An error occurred computing the string representation of the
+ error message. */
+ fprintf_filtered (gdb_stderr,
+ _("Error occurred computing Python error" \
+ "message.\n"));
+ }
+ else
+ fprintf_filtered (gdb_stderr, "Python Exception %s %s: \n",
+ type, msg);
}
- else
- fprintf_filtered (gdb_stderr, "Python Exception %s %s: \n",
- type, msg);
Py_XDECREF (ptype);
Py_XDECREF (pvalue);