summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2016-06-12 20:45:29 -0600
committerTom Tromey <tom@tromey.com>2016-08-03 09:04:08 -0600
commit282a0691a725d1f6653840728449adb297c8c856 (patch)
treeebe5354b41485c4c960bf80fc07a9a78f8373d78
parentd10153cfc6cb319a75ceb3e3d34ac30efa17e518 (diff)
downloadbinutils-gdb-282a0691a725d1f6653840728449adb297c8c856.tar.gz
PR python/18565 - make Frame.function work for inline frames
PR python/18565 notes that calling frame filters don't work properly for inlined functions. This happens because Frame.function on an inline frame will yield the wrong result. This patch changes this code to use find_frame_funname instead, which handles inline frames properly. Built and regtested on x86-64 Fedora 24. 2016-08-03 Tom Tromey <tom@tromey.com> PR python/18565: * python/py-frame.c (frapy_function): Use find_frame_funname. 2016-08-03 Tom Tromey <tom@tromey.com> PR python/18565: * gdb.python/py-frame-inline.exp: Add Frame.function test.
-rw-r--r--gdb/ChangeLog5
-rw-r--r--gdb/python/py-frame.c6
-rw-r--r--gdb/testsuite/ChangeLog5
-rw-r--r--gdb/testsuite/gdb.python/py-frame-inline.exp4
4 files changed, 19 insertions, 1 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 48ecd6771ca..24a53a59610 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,10 @@
2016-08-03 Tom Tromey <tom@tromey.com>
+ PR python/18565:
+ * python/py-frame.c (frapy_function): Use find_frame_funname.
+
+2016-08-03 Tom Tromey <tom@tromey.com>
+
* stack.c (find_frame_funname): Avoid any possible leak in case
cp_remove_params can throw.
diff --git a/gdb/python/py-frame.c b/gdb/python/py-frame.c
index 98a7d7b5edb..6bdac08579f 100644
--- a/gdb/python/py-frame.c
+++ b/gdb/python/py-frame.c
@@ -340,9 +340,13 @@ frapy_function (PyObject *self, PyObject *args)
TRY
{
+ char *funname;
+ enum language funlang;
+
FRAPY_REQUIRE_VALID (self, frame);
- sym = find_pc_function (get_frame_address_in_block (frame));
+ find_frame_funname (frame, &funname, &funlang, &sym);
+ xfree (funname);
}
CATCH (except, RETURN_MASK_ALL)
{
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 51e8073eccd..9f336df109a 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2016-08-03 Tom Tromey <tom@tromey.com>
+
+ PR python/18565:
+ * gdb.python/py-frame-inline.exp: Add Frame.function test.
+
2016-08-01 Yao Qi <yao.qi@linaro.org>
* gdb.threads/process-dies-while-detaching.exp (do_test): Set
diff --git a/gdb/testsuite/gdb.python/py-frame-inline.exp b/gdb/testsuite/gdb.python/py-frame-inline.exp
index 6306c8e6e63..1372ee0f63e 100644
--- a/gdb/testsuite/gdb.python/py-frame-inline.exp
+++ b/gdb/testsuite/gdb.python/py-frame-inline.exp
@@ -51,3 +51,7 @@ gdb_test_no_output "set backtrace limit 1"
gdb_continue_to_breakpoint "Block break here."
gdb_test "python print (gdb.newest_frame())" ".*"
+
+# Regression test to verify that Frame.function works properly for
+# inline frames.
+gdb_test "python print (gdb.newest_frame().function())" "f"