|
|
0b42f8 |
commit 4c9a21f6a57e0e2e382aac327f6edaa1475dd3f1
|
|
|
0b42f8 |
Author: Tom Tromey <tromey@redhat.com>
|
|
|
0b42f8 |
Date: Wed Jan 22 08:44:41 2014 -0700
|
|
|
0b42f8 |
|
|
|
0b42f8 |
fix erroneous error-handling in frame filter code
|
|
|
0b42f8 |
|
|
|
0b42f8 |
This fixes PR python/16487.
|
|
|
0b42f8 |
|
|
|
0b42f8 |
The bug here is that the function-name-handling code in py_print_frame
|
|
|
0b42f8 |
had a small logic error (really a misplaced closing brace). This
|
|
|
0b42f8 |
error could lead to a Py_DECREF(NULL), which crashes.
|
|
|
0b42f8 |
|
|
|
0b42f8 |
This patch fixes the bug in the obvious way.
|
|
|
0b42f8 |
|
|
|
0b42f8 |
Built and regtested on x86-64 Fedora 18. New test case included.
|
|
|
0b42f8 |
|
|
|
0b42f8 |
2014-01-23 Tom Tromey <tromey@redhat.com>
|
|
|
0b42f8 |
|
|
|
0b42f8 |
PR python/16487:
|
|
|
0b42f8 |
* python/py-framefilter.c (py_print_frame): Don't call Py_DECREF
|
|
|
0b42f8 |
on a NULL pointer. Move "goto error" to correct place.
|
|
|
0b42f8 |
|
|
|
0b42f8 |
2014-01-23 Tom Tromey <tromey@redhat.com>
|
|
|
0b42f8 |
|
|
|
0b42f8 |
PR python/16487:
|
|
|
0b42f8 |
* gdb.python/py-framefilter.exp: Add test using "Error" filter.
|
|
|
0b42f8 |
* gdb.python/py-framefilter.py (ErrorInName, ErrorFilter): New
|
|
|
0b42f8 |
classes.
|
|
|
0b42f8 |
|
|
|
0b42f8 |
### a/gdb/ChangeLog
|
|
|
0b42f8 |
### b/gdb/ChangeLog
|
|
|
0b42f8 |
## -1,5 +1,11 @@
|
|
|
0b42f8 |
2014-01-23 Tom Tromey <tromey@redhat.com>
|
|
|
0b42f8 |
|
|
|
0b42f8 |
+ PR python/16487:
|
|
|
0b42f8 |
+ * python/py-framefilter.c (py_print_frame): Don't call Py_DECREF
|
|
|
0b42f8 |
+ on a NULL pointer. Move "goto error" to correct place.
|
|
|
0b42f8 |
+
|
|
|
0b42f8 |
+2014-01-23 Tom Tromey <tromey@redhat.com>
|
|
|
0b42f8 |
+
|
|
|
0b42f8 |
PR python/16491:
|
|
|
0b42f8 |
* python/py-framefilter.c (apply_frame_filter): Call
|
|
|
0b42f8 |
ensure_python_env after computing gdbarch.
|
|
|
0b42f8 |
--- a/gdb/python/py-framefilter.c
|
|
|
0b42f8 |
+++ b/gdb/python/py-framefilter.c
|
|
|
0b42f8 |
@@ -1218,11 +1218,11 @@ py_print_frame (PyObject *filter, int flags, enum py_frame_args args_type,
|
|
|
0b42f8 |
gdbpy_convert_exception (except);
|
|
|
0b42f8 |
goto error;
|
|
|
0b42f8 |
}
|
|
|
0b42f8 |
+ Py_DECREF (py_func);
|
|
|
0b42f8 |
}
|
|
|
0b42f8 |
- Py_DECREF (py_func);
|
|
|
0b42f8 |
+ else
|
|
|
0b42f8 |
+ goto error;
|
|
|
0b42f8 |
}
|
|
|
0b42f8 |
- else
|
|
|
0b42f8 |
- goto error;
|
|
|
0b42f8 |
}
|
|
|
0b42f8 |
|
|
|
0b42f8 |
|
|
|
0b42f8 |
### a/gdb/testsuite/ChangeLog
|
|
|
0b42f8 |
### b/gdb/testsuite/ChangeLog
|
|
|
0b42f8 |
## -1,5 +1,12 @@
|
|
|
0b42f8 |
2014-01-23 Tom Tromey <tromey@redhat.com>
|
|
|
0b42f8 |
|
|
|
0b42f8 |
+ PR python/16487:
|
|
|
0b42f8 |
+ * gdb.python/py-framefilter.exp: Add test using "Error" filter.
|
|
|
0b42f8 |
+ * gdb.python/py-framefilter.py (ErrorInName, ErrorFilter): New
|
|
|
0b42f8 |
+ classes.
|
|
|
0b42f8 |
+
|
|
|
0b42f8 |
+2014-01-23 Tom Tromey <tromey@redhat.com>
|
|
|
0b42f8 |
+
|
|
|
0b42f8 |
PR python/16491:
|
|
|
0b42f8 |
* gdb.python/py-framefilter.py (Reverse_Function.function): Read a
|
|
|
0b42f8 |
string from an inferior frame.
|
|
|
0b42f8 |
--- a/gdb/testsuite/gdb.python/py-framefilter.exp
|
|
|
0b42f8 |
+++ b/gdb/testsuite/gdb.python/py-framefilter.exp
|
|
|
0b42f8 |
@@ -177,6 +177,17 @@ gdb_test "bt 1" \
|
|
|
0b42f8 |
"#0 end_func \\(foo=21, bar=\"Param\", fb=, bf=\{nothing = \"Foo Bar\", f = 42, s = 19\}\\) at .*py-framefilter.c.*" \
|
|
|
0b42f8 |
"bt 1 no addresss"
|
|
|
0b42f8 |
|
|
|
0b42f8 |
+gdb_test_no_output "set python print-stack message" \
|
|
|
0b42f8 |
+ "Set python print-stack to message for Error filter"
|
|
|
0b42f8 |
+gdb_test_no_output "enable frame-filter global Error" \
|
|
|
0b42f8 |
+ "enable frame-filter global Error"
|
|
|
0b42f8 |
+set test "bt 1 with Error filter"
|
|
|
0b42f8 |
+gdb_test_multiple "bt 1" $test {
|
|
|
0b42f8 |
+ -re "Python Exception .*whoops:.*$gdb_prompt $" {
|
|
|
0b42f8 |
+ pass $test
|
|
|
0b42f8 |
+ }
|
|
|
0b42f8 |
+}
|
|
|
0b42f8 |
+
|
|
|
0b42f8 |
remote_file host delete ${remote_python_file}
|
|
|
0b42f8 |
|
|
|
0b42f8 |
# Test with no debuginfo
|
|
|
0b42f8 |
--- a/gdb/testsuite/gdb.python/py-framefilter.py
|
|
|
0b42f8 |
+++ b/gdb/testsuite/gdb.python/py-framefilter.py
|
|
|
0b42f8 |
@@ -128,5 +128,25 @@ class FrameElider ():
|
|
|
0b42f8 |
def filter (self, frame_iter):
|
|
|
0b42f8 |
return ElidingIterator (frame_iter)
|
|
|
0b42f8 |
|
|
|
0b42f8 |
+# A simple decorator that gives an error when computing the function.
|
|
|
0b42f8 |
+class ErrorInName(FrameDecorator):
|
|
|
0b42f8 |
+ def __init__(self, frame):
|
|
|
0b42f8 |
+ FrameDecorator.__init__(self, frame)
|
|
|
0b42f8 |
+
|
|
|
0b42f8 |
+ def function(self):
|
|
|
0b42f8 |
+ raise RuntimeError('whoops')
|
|
|
0b42f8 |
+
|
|
|
0b42f8 |
+# A filter that supplies buggy frames. Disabled by default.
|
|
|
0b42f8 |
+class ErrorFilter():
|
|
|
0b42f8 |
+ def __init__ (self):
|
|
|
0b42f8 |
+ self.name = "Error"
|
|
|
0b42f8 |
+ self.priority = 1
|
|
|
0b42f8 |
+ self.enabled = False
|
|
|
0b42f8 |
+ gdb.frame_filters [self.name] = self
|
|
|
0b42f8 |
+
|
|
|
0b42f8 |
+ def filter(self, frame_iter):
|
|
|
0b42f8 |
+ return itertools.imap(ErrorInName, frame_iter)
|
|
|
0b42f8 |
+
|
|
|
0b42f8 |
FrameFilter()
|
|
|
0b42f8 |
FrameElider()
|
|
|
0b42f8 |
+ErrorFilter()
|