public inbox for archer-commits@sourceware.org
help / color / mirror / Atom feed
* [SCM] archer-pmuldoon-python-backtrace: Modify how frame filters are called.
@ 2012-03-29 14:20 pmuldoon
0 siblings, 0 replies; only message in thread
From: pmuldoon @ 2012-03-29 14:20 UTC (permalink / raw)
To: archer-commits
The branch, archer-pmuldoon-python-backtrace has been updated
via ec9f7997ebf301d320fe4c9293788f7cc55feac1 (commit)
from 20f87ab1f910cdebb5d23eb5e5db0d3647959cb0 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email.
- Log -----------------------------------------------------------------
commit ec9f7997ebf301d320fe4c9293788f7cc55feac1
Author: Phil Muldoon <pmuldoon@redhat.com>
Date: Thu Mar 29 15:19:49 2012 +0100
Modify how frame filters are called.
-----------------------------------------------------------------------
Summary of changes:
gdb/python/py-framefilter.c | 4 ++++
gdb/testsuite/gdb.python/py-framefilter.c | 4 ++--
gdb/testsuite/gdb.python/py-framefilter.exp | 2 +-
gdb/testsuite/gdb.python/py-framefilter.py | 17 +++++++++--------
4 files changed, 16 insertions(+), 11 deletions(-)
First 500 lines of diff:
diff --git a/gdb/python/py-framefilter.c b/gdb/python/py-framefilter.c
index f5ce701..36dc7f1 100644
--- a/gdb/python/py-framefilter.c
+++ b/gdb/python/py-framefilter.c
@@ -64,6 +64,8 @@ search_frame_filter_list (PyObject *list, PyObject *frame,
if (!attr)
return NULL;
cmp = PyObject_IsTrue (attr);
+
+ Py_DECREF (attr);
if (cmp == -1)
return NULL;
@@ -73,6 +75,7 @@ search_frame_filter_list (PyObject *list, PyObject *frame,
filter = PyObject_CallFunctionObjArgs (function, frame, level,
what, args, NULL);
+
if (! filter)
return NULL;
else if (filter != Py_None)
@@ -101,6 +104,7 @@ find_frame_filter_from_gdb (PyObject *frame, PyObject *level,
/* Fetch the global frame filter list. */
if (! PyObject_HasAttrString (gdb_module, "frame_filters"))
Py_RETURN_NONE;
+
filter_list = PyObject_GetAttrString (gdb_module, "frame_filters");
if (filter_list == NULL || ! PyList_Check (filter_list))
{
diff --git a/gdb/testsuite/gdb.python/py-framefilter.c b/gdb/testsuite/gdb.python/py-framefilter.c
index bcd73e2..25a8a6e 100644
--- a/gdb/testsuite/gdb.python/py-framefilter.c
+++ b/gdb/testsuite/gdb.python/py-framefilter.c
@@ -86,7 +86,7 @@ int func4(int j)
return 2;
}
-int func5(int f)
+int func5(int f, int d)
{
int i = 0;
char *random = "random";
@@ -98,5 +98,5 @@ int func5(int f)
main()
{
- func5(3);
+ func5(3,5);
}
diff --git a/gdb/testsuite/gdb.python/py-framefilter.exp b/gdb/testsuite/gdb.python/py-framefilter.exp
index d53ab01..f6f8191 100644
--- a/gdb/testsuite/gdb.python/py-framefilter.exp
+++ b/gdb/testsuite/gdb.python/py-framefilter.exp
@@ -38,7 +38,7 @@ if ![runto_main ] then {
set remote_python_file [remote_download host ${srcdir}/${subdir}/${testfile}.py]
gdb_test_no_output "python execfile ('${remote_python_file}')"
-gdb_test_no_output "python gdb.frame_filters.append(register_frame_filters)"
+gdb_test_no_output "python gdb.frame_filters.append(TestFilter)"
gdb_breakpoint [gdb_get_line_number "Backtrace end breakpoint"]
gdb_continue_to_breakpoint "Backtrace end breakpoint"
gdb_test "bt" "#0.*in end_func.*#22.*in func1.*Composite frame func3.*#27.*in main ().*"
diff --git a/gdb/testsuite/gdb.python/py-framefilter.py b/gdb/testsuite/gdb.python/py-framefilter.py
index d6a41d4..c6528c3 100644
--- a/gdb/testsuite/gdb.python/py-framefilter.py
+++ b/gdb/testsuite/gdb.python/py-framefilter.py
@@ -16,8 +16,8 @@
# This file is part of the GDB testsuite. It tests Python-based
# frame-filters.
-class Main_filter:
- "Example main () filter"
+class TestFilter:
+ "Testcase filter"
def __init__ (self, frame, what, level, args):
self.frame = frame
@@ -25,6 +25,13 @@ class Main_filter:
self.lvl = level
self.args = args
+ def __new__ (self):
+ fname = str (self.frame.function())
+ if fname == "main":
+ return None
+ else:
+ return self
+
def omit (self):
fname = str (self.frame.function())
if fname == "func2":
@@ -139,9 +146,3 @@ class Main_filter:
else:
return "<unknown line>"
-
-def register_frame_filters (frame, what, level, args):
-
-# if (frame.name() == "main"):
- x = Main_filter (frame, what, level, args)
- return x
hooks/post-receive
--
Repository for Project Archer.
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2012-03-29 14:20 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-29 14:20 [SCM] archer-pmuldoon-python-backtrace: Modify how frame filters are called pmuldoon
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).