* [PATCH 0/1] [gdb/symtab] Add find_symbol_for_pc_maybe_inline
@ 2026-04-10 11:28 Tom de Vries
2026-04-10 11:28 ` [PATCH 1/1] " Tom de Vries
0 siblings, 1 reply; 3+ messages in thread
From: Tom de Vries @ 2026-04-10 11:28 UTC (permalink / raw)
To: gdb-patches
I originally wrote the one patch in this series as part of this v2 series [1],
but it got dropped in v3 because it was no longer required.
Still, it makes sense as a separate cleanup.
[1] https://sourceware.org/pipermail/gdb-patches/2026-March/226269.html
Tom de Vries (1):
[gdb/symtab] Add find_symbol_for_pc_maybe_inline
gdb/blockframe.c | 8 ++++++++
gdb/infcmd.c | 3 +--
gdb/symtab.h | 6 ++++++
3 files changed, 15 insertions(+), 2 deletions(-)
base-commit: 65e4798d49afe18c20acd5f5830e706b175ba844
--
2.51.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 1/1] [gdb/symtab] Add find_symbol_for_pc_maybe_inline
2026-04-10 11:28 [PATCH 0/1] [gdb/symtab] Add find_symbol_for_pc_maybe_inline Tom de Vries
@ 2026-04-10 11:28 ` Tom de Vries
2026-04-14 19:23 ` Tom Tromey
0 siblings, 1 reply; 3+ messages in thread
From: Tom de Vries @ 2026-04-10 11:28 UTC (permalink / raw)
To: gdb-patches
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 fa7b273ae57..f1edef534db 100644
--- a/gdb/infcmd.c
+++ b/gdb/infcmd.c
@@ -1250,8 +1250,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 6e155192873..0db85bcf5ba 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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 1/1] [gdb/symtab] Add find_symbol_for_pc_maybe_inline
2026-04-10 11:28 ` [PATCH 1/1] " Tom de Vries
@ 2026-04-14 19:23 ` Tom Tromey
0 siblings, 0 replies; 3+ messages in thread
From: Tom Tromey @ 2026-04-14 19:23 UTC (permalink / raw)
To: Tom de Vries; +Cc: gdb-patches
>>>>> "Tom" == Tom de Vries <tdevries@suse.de> writes:
Tom> Add a similar function find_symbol_for_pc_maybe_inline that calls
Tom> find_symbol_for_pc_sect_maybe_inline, and use it in jump_command.
Looks good, thanks.
Approved-By: Tom Tromey <tom@tromey.com>
Tom
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-04-14 19:23 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-04-10 11:28 [PATCH 0/1] [gdb/symtab] Add find_symbol_for_pc_maybe_inline Tom de Vries
2026-04-10 11:28 ` [PATCH 1/1] " Tom de Vries
2026-04-14 19:23 ` Tom Tromey
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox