From: Tom Tromey <tom@tromey.com>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tom@tromey.com>
Subject: [RFA] PR python/18565 - make Frame.function work for inline frames
Date: Mon, 20 Jun 2016 16:11:00 -0000 [thread overview]
Message-ID: <1466439050-11330-1-git-send-email-tom@tromey.com> (raw)
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 23.
2016-06-20 Tom Tromey <tom@tromey.com>
PR python/18565:
* python/py-frame.c (frapy_function): Use find_frame_funname.
2016-06-20 Tom Tromey <tom@tromey.com>
PR python/18565:
* gdb.python/py-frame-inline.exp: Add Frame.function test.
---
gdb/ChangeLog | 5 +++++
gdb/python/py-frame.c | 6 +++++-
gdb/testsuite/ChangeLog | 5 +++++
gdb/testsuite/gdb.python/py-frame-inline.exp | 4 ++++
4 files changed, 19 insertions(+), 1 deletion(-)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index faa9e9f..8c327c4 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@
+2016-06-20 Tom Tromey <tom@tromey.com>
+
+ PR python/18565:
+ * python/py-frame.c (frapy_function): Use find_frame_funname.
+
2016-06-17 Yan-Ting Lin <currygt52@gmail.com>
* Makefile.in (ALL_TARGET_OBS): Add nds32-tdep.o.
diff --git a/gdb/python/py-frame.c b/gdb/python/py-frame.c
index 98a7d7b..6bdac08 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 e5f1c54..785b2cb 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2016-06-20 Tom Tromey <tom@tromey.com>
+
+ PR python/18565:
+ * gdb.python/py-frame-inline.exp: Add Frame.function test.
+
2016-06-17 Sanjoy Das <sanjoy@playingwithpointers.com>
* gdb.base/jit-reader.exp: New file.
diff --git a/gdb/testsuite/gdb.python/py-frame-inline.exp b/gdb/testsuite/gdb.python/py-frame-inline.exp
index 6306c8e..1372ee0 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"
--
2.5.5
next reply other threads:[~2016-06-20 16:11 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-20 16:11 Tom Tromey [this message]
[not found] ` <86ziqfq6sz.fsf@gmail.com>
2016-06-22 18:43 ` Tom Tromey
2016-07-25 10:23 ` Yao Qi
2016-07-25 11:04 ` Pedro Alves
2016-07-25 15:01 ` Tom Tromey
2016-07-26 11:14 ` Pedro Alves
2016-07-26 13:18 ` Tom Tromey
2016-07-26 14:33 ` Pedro Alves
2016-08-03 8:15 ` Yao Qi
2016-08-03 15:14 ` Tom Tromey
2016-08-03 17:57 ` Pedro Alves
2016-08-03 8:07 ` Yao Qi
2016-08-03 11:35 ` Pedro Alves
2016-08-03 13:15 ` Yao Qi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1466439050-11330-1-git-send-email-tom@tromey.com \
--to=tom@tromey.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox