diff options
-rw-r--r-- | gdb/ChangeLog | 6 | ||||
-rw-r--r-- | gdb/python/py-framefilter.c | 6 | ||||
-rw-r--r-- | gdb/testsuite/ChangeLog | 7 | ||||
-rw-r--r-- | gdb/testsuite/gdb.python/py-framefilter.exp | 11 | ||||
-rw-r--r-- | gdb/testsuite/gdb.python/py-framefilter.py | 20 |
5 files changed, 47 insertions, 3 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 861f01b..2e09ef6 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,11 @@ 2014-01-23 Tom Tromey <tromey@redhat.com> + PR python/16487: + * python/py-framefilter.c (py_print_frame): Don't call Py_DECREF + on a NULL pointer. Move "goto error" to correct place. + +2014-01-23 Tom Tromey <tromey@redhat.com> + PR python/16491: * python/py-framefilter.c (apply_frame_filter): Call ensure_python_env after computing gdbarch. diff --git a/gdb/python/py-framefilter.c b/gdb/python/py-framefilter.c index c6a29ef..1a9f3e0 100644 --- a/gdb/python/py-framefilter.c +++ b/gdb/python/py-framefilter.c @@ -1218,11 +1218,11 @@ py_print_frame (PyObject *filter, int flags, enum py_frame_args args_type, gdbpy_convert_exception (except); goto error; } + Py_DECREF (py_func); } - Py_DECREF (py_func); + else + goto error; } - else - goto error; } diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 4e11cd1..b41a167 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,5 +1,12 @@ 2014-01-23 Tom Tromey <tromey@redhat.com> + PR python/16487: + * gdb.python/py-framefilter.exp: Add test using "Error" filter. + * gdb.python/py-framefilter.py (ErrorInName, ErrorFilter): New + classes. + +2014-01-23 Tom Tromey <tromey@redhat.com> + PR python/16491: * gdb.python/py-framefilter.py (Reverse_Function.function): Read a string from an inferior frame. diff --git a/gdb/testsuite/gdb.python/py-framefilter.exp b/gdb/testsuite/gdb.python/py-framefilter.exp index 106240b..905ad8c 100644 --- a/gdb/testsuite/gdb.python/py-framefilter.exp +++ b/gdb/testsuite/gdb.python/py-framefilter.exp @@ -177,6 +177,17 @@ gdb_test "bt 1" \ "#0 end_func \\(foo=21, bar=\"Param\", fb=, bf=\{nothing = \"Foo Bar\", f = 42, s = 19\}\\) at .*py-framefilter.c.*" \ "bt 1 no addresss" +gdb_test_no_output "set python print-stack message" \ + "Set python print-stack to message for Error filter" +gdb_test_no_output "enable frame-filter global Error" \ + "enable frame-filter global Error" +set test "bt 1 with Error filter" +gdb_test_multiple "bt 1" $test { + -re "Python Exception .*whoops:.*$gdb_prompt $" { + pass $test + } +} + remote_file host delete ${remote_python_file} # Test with no debuginfo diff --git a/gdb/testsuite/gdb.python/py-framefilter.py b/gdb/testsuite/gdb.python/py-framefilter.py index 25b3368..a085688 100644 --- a/gdb/testsuite/gdb.python/py-framefilter.py +++ b/gdb/testsuite/gdb.python/py-framefilter.py @@ -128,5 +128,25 @@ class FrameElider (): def filter (self, frame_iter): return ElidingIterator (frame_iter) +# A simple decorator that gives an error when computing the function. +class ErrorInName(FrameDecorator): + def __init__(self, frame): + FrameDecorator.__init__(self, frame) + + def function(self): + raise RuntimeError('whoops') + +# A filter that supplies buggy frames. Disabled by default. +class ErrorFilter(): + def __init__ (self): + self.name = "Error" + self.priority = 1 + self.enabled = False + gdb.frame_filters [self.name] = self + + def filter(self, frame_iter): + return itertools.imap(ErrorInName, frame_iter) + FrameFilter() FrameElider() +ErrorFilter() |