]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
[gdb/symtab] Add find_symbol_for_pc_maybe_inline
authorTom de Vries <tdevries@suse.de>
Tue, 14 Apr 2026 20:45:23 +0000 (22:45 +0200)
committerTom de Vries <tdevries@suse.de>
Tue, 14 Apr 2026 20:45:23 +0000 (22:45 +0200)
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.

Approved-By: Tom Tromey <tom@tromey.com>
gdb/blockframe.c
gdb/infcmd.c
gdb/symtab.h

index 59efa391604460ed22d94bf17f9cb4bbe4d3b88c..ce28d99c7e4b4036a16d053b6f2b0a714a60142c 100644 (file)
@@ -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)
 {
index c0d12be6e4a0949109a4d2311271b189e70b43c8..c6519b71abcbf0efb1fdc4fe56297caf57248407 100644 (file)
@@ -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? "),
index 6e155192873f6500cf02e2ad1746f3d90f7c8d7e..0db85bcf5baadd066c7a975be9dfe642a4f949f9 100644 (file)
@@ -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.  */