From: Tom de Vries <tdevries@suse.de>
To: gdb-patches@sourceware.org
Subject: [RFC v2 1/3] [gdb/symtab] Add find_symbol_for_pc_maybe_inline
Date: Tue, 31 Mar 2026 15:23:40 +0200 [thread overview]
Message-ID: <20260331132342.1050954-2-tdevries@suse.de> (raw)
In-Reply-To: <20260331132342.1050954-1-tdevries@suse.de>
We have function find_symbol_for_pc:
...
find_symbol_for_pc (CORE_ADDR pc)
{
return find_symbol_for_pc_sect (pc, find_pc_mapped_section (pc));
}
...
which uses some standard way of getting the section for the given pc.
Add a similar function find_symbol_for_pc_maybe_inline that calls
find_symbol_for_pc_sect_maybe_inline, and use it in jump_command.
Tested on x86_64-linux.
---
gdb/blockframe.c | 8 ++++++++
gdb/infcmd.c | 3 +--
gdb/symtab.h | 6 ++++++
3 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/gdb/blockframe.c b/gdb/blockframe.c
index 59efa391604..ce28d99c7e4 100644
--- a/gdb/blockframe.c
+++ b/gdb/blockframe.c
@@ -152,6 +152,14 @@ find_symbol_for_pc (CORE_ADDR pc)
/* See symtab.h. */
+struct symbol *
+find_symbol_for_pc_maybe_inline (CORE_ADDR pc)
+{
+ return find_symbol_for_pc_sect_maybe_inline (pc, find_pc_mapped_section (pc));
+}
+
+/* See symtab.h. */
+
struct symbol *
find_symbol_for_pc_sect_maybe_inline (CORE_ADDR pc, struct obj_section *section)
{
diff --git a/gdb/infcmd.c b/gdb/infcmd.c
index 9fbee5aaba7..2e1a4d592c1 100644
--- a/gdb/infcmd.c
+++ b/gdb/infcmd.c
@@ -1249,8 +1249,7 @@ jump_command (const char *arg, int from_tty)
/* See if we are trying to jump to another function. */
fn = get_frame_function (get_current_frame ());
- sfn = find_symbol_for_pc_sect_maybe_inline (sal.pc,
- find_pc_mapped_section (sal.pc));
+ sfn = find_symbol_for_pc_maybe_inline (sal.pc);
if (fn != nullptr && sfn != fn)
{
if (!query (_("Line %ps is not in `%ps'. Jump anyway? "),
diff --git a/gdb/symtab.h b/gdb/symtab.h
index 8f0cc728410..132058a0065 100644
--- a/gdb/symtab.h
+++ b/gdb/symtab.h
@@ -2201,6 +2201,12 @@ extern struct type *lookup_enum (const char *, const struct block *);
extern struct symbol *find_symbol_for_pc (CORE_ADDR);
+/* Lookup the function symbol corresponding to the address. The return value
+ will be the closest enclosing function, which might be an inline
+ function. */
+
+extern struct symbol *find_symbol_for_pc_maybe_inline (CORE_ADDR pc);
+
/* lookup the function corresponding to the address and section. The
return value will not be an inlined function; the containing
function will be returned instead. */
--
2.51.0
next prev parent reply other threads:[~2026-03-31 13:25 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-31 13:23 [RFC v2 0/3] [gdb] Fix missing print frame when stepping out of function Tom de Vries
2026-03-31 13:23 ` Tom de Vries [this message]
2026-03-31 13:23 ` [RFC v2 2/3] [gdb] Add thread_control_state::step_start_function methods Tom de Vries
2026-03-31 13:23 ` [RFC v2 3/3] [gdb] Fix missing print frame when stepping out of function Tom de Vries
2026-04-05 10:12 ` [PATCH 0/2] " Andrew Burgess
2026-04-05 10:12 ` [PATCH 1/2] gdb: use get_current_frame consistently in print_stop_location Andrew Burgess
2026-04-09 6:42 ` Tom de Vries
2026-04-09 8:54 ` Andrew Burgess
2026-04-09 13:43 ` Tom de Vries
2026-04-10 8:57 ` Andrew Burgess
2026-04-10 10:17 ` Tom de Vries
2026-04-05 10:12 ` [PATCH 2/2] gdb: fix missing print frame when stepping out of function Andrew Burgess
2026-04-10 10:29 ` Tom de Vries
2026-04-10 10:48 ` [PATCH 0/2] Fix " Tom de Vries
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=20260331132342.1050954-2-tdevries@suse.de \
--to=tdevries@suse.de \
--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