aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhil Muldoon <pmuldoon@redhat.com>2013-08-29 09:24:33 +0000
committerPhil Muldoon <pmuldoon@redhat.com>2013-08-29 09:24:33 +0000
commit8ee002dfdc61eeda5448253021bf183ed2a301e3 (patch)
treed42041f6d9ba592392094abb79822c936c1d4d1c
parentaf4c453a83806e30812667a382871c4181dc59b0 (diff)
downloadgdb-8ee002dfdc61eeda5448253021bf183ed2a301e3.zip
gdb-8ee002dfdc61eeda5448253021bf183ed2a301e3.tar.gz
gdb-8ee002dfdc61eeda5448253021bf183ed2a301e3.tar.bz2
2013-08-29 Phil Muldoon <pmuldoon@redhat.com>
PR python/15752 * python/py-framefilter.c (apply_frame_filter): Check gdb_python_initialized. Exit if the Python frame-filter code cannot be initialized.
-rw-r--r--gdb/ChangeLog8
-rw-r--r--gdb/python/py-framefilter.c24
2 files changed, 31 insertions, 1 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 411d2b2..3ce275f 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,13 @@
2013-08-29 Phil Muldoon <pmuldoon@redhat.com>
+ PR python/15752
+
+ * python/py-framefilter.c (apply_frame_filter): Check
+ gdb_python_initialized. Exit if the Python frame-filter code
+ cannot be initialized.
+
+2013-08-29 Phil Muldoon <pmuldoon@redhat.com>
+
PR cli/15842
* top.c (print_gdb_version): Remove erroneous newline after help
diff --git a/gdb/python/py-framefilter.c b/gdb/python/py-framefilter.c
index d62c596..5ac8e47 100644
--- a/gdb/python/py-framefilter.c
+++ b/gdb/python/py-framefilter.c
@@ -1468,6 +1468,9 @@ apply_frame_filter (struct frame_info *frame, int flags,
PyObject *item;
htab_t levels_printed;
+ if (!gdb_python_initialized)
+ return PY_BT_NO_FILTERS;
+
cleanups = ensure_python_env (gdbarch, current_language);
TRY_CATCH (except, RETURN_MASK_ALL)
@@ -1483,7 +1486,24 @@ apply_frame_filter (struct frame_info *frame, int flags,
iterable = bootstrap_python_frame_filters (frame, frame_low, frame_high);
if (iterable == NULL)
- goto error;
+ {
+ /* Normally if there is an error GDB prints the exception,
+ abandons the backtrace and exits. The user can then call "bt
+ no-filters", and get a default backtrace (it would be
+ confusing to automatically start a standard backtrace halfway
+ through a Python filtered backtrace). However in the case
+ where GDB cannot initialize the frame filters (most likely
+ due to incorrect auto-load paths), GDB has printed nothing.
+ In this case it is OK to print the default backtrace after
+ printing the error message. GDB returns PY_BT_NO_FILTERS
+ here to signify there are no filters after printing the
+ initialization error. This return code will trigger a
+ default backtrace. */
+
+ gdbpy_print_stack ();
+ do_cleanups (cleanups);
+ return PY_BT_NO_FILTERS;
+ }
/* If iterable is None, then there are no frame filters registered.
If this is the case, defer to default GDB printing routines in MI
@@ -1521,6 +1541,8 @@ apply_frame_filter (struct frame_info *frame, int flags,
do_cleanups (cleanups);
return success;
+ /* Exit and abandon backtrace on error, printing the exception that
+ is set. */
error:
gdbpy_print_stack ();
do_cleanups (cleanups);