Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH 00/10] Rename some symtab find functions
@ 2025-10-16  0:07 simon.marchi
  2025-10-16  0:07 ` [PATCH 01/10] gdb: rename find_pc_function -> find_symbol_for_pc simon.marchi
                   ` (10 more replies)
  0 siblings, 11 replies; 13+ messages in thread
From: simon.marchi @ 2025-10-16  0:07 UTC (permalink / raw)
  To: gdb-patches; +Cc: Simon Marchi

From: Simon Marchi <simon.marchi@polymtl.ca>

I have long been confused by the names of the functions to look up
things in symtab.  For a function named find_foo_bar, it's not obvious
if it finds a foo from a bar or vice-versa (answer: it finds a bar for a
given foo).  When asking around on IRC a while ago, a few people agreed.
I'm therefore proposing to rename those functions to be of the form
find_bar_for_foo.

Simon Marchi (10):
  gdb: rename find_pc_function -> find_symbol_for_pc
  gdb: rename find_pc_sect_function -> find_symbol_for_pc_sect
  gdb: rename find_pc_sect_containing_function ->
    find_symbol_for_pc_sect_maybe_inline
  gdb: rename find_pc_compunit_symtab -> find_compunit_symtab_for_pc
  gdb: rename find_pc_sect_compunit_symtab ->
    find_compunit_symtab_for_pc_sect
  gdb: rename find_pc_line_pc_range -> find_line_pc_range_for_pc
  gdb: rename find_pc_line -> find_sal_for_pc
  gdb: rename find_pc_sect_line -> find_sal_for_pc_sect
  gdb: rename find_pc_line_symtab -> find_symtab_for_pc
  gdb: rename find_line_pc_range -> find_pc_range_for_sal

 gdb/aarch64-tdep.c               |  2 +-
 gdb/alpha-tdep.c                 |  2 +-
 gdb/amd64-tdep.c                 | 10 ++--
 gdb/amdgpu-tdep.c                |  2 +-
 gdb/arc-tdep.c                   |  2 +-
 gdb/arm-linux-tdep.c             |  2 +-
 gdb/arm-tdep.c                   |  4 +-
 gdb/block.c                      |  4 +-
 gdb/blockframe.c                 | 14 +++---
 gdb/breakpoint.c                 | 24 +++++-----
 gdb/btrace.c                     |  2 +-
 gdb/c-exp.y                      |  2 +-
 gdb/cli/cli-cmds.c               |  6 +--
 gdb/compile/compile-c-support.c  |  2 +-
 gdb/compile/compile.c            |  2 +-
 gdb/cp-namespace.c               |  2 +-
 gdb/cris-tdep.c                  |  2 +-
 gdb/disasm.c                     | 10 ++--
 gdb/dwarf2/frame.c               |  2 +-
 gdb/dwarf2/loc.c                 |  2 +-
 gdb/elfread.c                    |  2 +-
 gdb/eval.c                       |  2 +-
 gdb/frame.c                      |  6 +--
 gdb/frv-tdep.c                   |  2 +-
 gdb/ft32-tdep.c                  |  2 +-
 gdb/guile/scm-block.c            |  2 +-
 gdb/guile/scm-frame.c            |  2 +-
 gdb/guile/scm-symtab.c           |  2 +-
 gdb/h8300-tdep.c                 |  2 +-
 gdb/hppa-tdep.c                  |  2 +-
 gdb/i386-tdep.c                  |  4 +-
 gdb/ia64-tdep.c                  |  4 +-
 gdb/infcall.c                    |  2 +-
 gdb/infcmd.c                     | 24 +++++-----
 gdb/infrun.c                     | 16 +++----
 gdb/iq2000-tdep.c                |  6 +--
 gdb/linespec.c                   |  6 +--
 gdb/linux-fork.c                 |  2 +-
 gdb/loongarch-tdep.c             |  2 +-
 gdb/m32r-tdep.c                  |  2 +-
 gdb/m68hc11-tdep.c               |  2 +-
 gdb/macroscope.c                 |  2 +-
 gdb/mi/mi-cmd-disas.c            |  2 +-
 gdb/mi/mi-main.c                 |  2 +-
 gdb/microblaze-tdep.c            |  2 +-
 gdb/moxie-tdep.c                 |  2 +-
 gdb/namespace.c                  |  2 +-
 gdb/or1k-tdep.c                  |  2 +-
 gdb/printcmd.c                   |  6 +--
 gdb/python/py-finishbreakpoint.c |  2 +-
 gdb/python/py-progspace.c        |  4 +-
 gdb/python/py-record-btrace.c    |  2 +-
 gdb/record-btrace.c              |  4 +-
 gdb/reverse.c                    |  2 +-
 gdb/rs6000-tdep.c                |  4 +-
 gdb/solib-frv.c                  |  2 +-
 gdb/source.c                     |  2 +-
 gdb/sparc-tdep.c                 |  4 +-
 gdb/sparc64-tdep.c               |  2 +-
 gdb/symmisc.c                    |  2 +-
 gdb/symtab.c                     | 78 ++++++++++++++++----------------
 gdb/symtab.h                     | 28 ++++++------
 gdb/tracepoint.c                 | 16 +++----
 gdb/tui/tui-disasm.c             |  2 +-
 gdb/tui/tui-source.c             |  6 +--
 gdb/tui/tui-winsource.c          | 10 ++--
 gdb/v850-tdep.c                  |  2 +-
 gdb/xstormy16-tdep.c             |  2 +-
 gdb/xtensa-tdep.c                |  4 +-
 gdb/z80-tdep.c                   |  2 +-
 70 files changed, 196 insertions(+), 196 deletions(-)


base-commit: b6753354fbbe7c2c66ae9f452ba7aa049db0fe0c
-- 
2.51.0


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH 01/10] gdb: rename find_pc_function -> find_symbol_for_pc
  2025-10-16  0:07 [PATCH 00/10] Rename some symtab find functions simon.marchi
@ 2025-10-16  0:07 ` simon.marchi
  2025-10-16  0:07 ` [PATCH 02/10] gdb: rename find_pc_sect_function -> find_symbol_for_pc_sect simon.marchi
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 13+ messages in thread
From: simon.marchi @ 2025-10-16  0:07 UTC (permalink / raw)
  To: gdb-patches; +Cc: Simon Marchi

From: Simon Marchi <simon.marchi@polymtl.ca>

Change-Id: I2069be1a6d7c3250cf330574c941bf851c89bab4
---
 gdb/blockframe.c                 | 4 ++--
 gdb/btrace.c                     | 2 +-
 gdb/cli/cli-cmds.c               | 4 ++--
 gdb/dwarf2/loc.c                 | 2 +-
 gdb/eval.c                       | 2 +-
 gdb/guile/scm-frame.c            | 2 +-
 gdb/infcall.c                    | 2 +-
 gdb/infcmd.c                     | 6 +++---
 gdb/infrun.c                     | 4 ++--
 gdb/python/py-finishbreakpoint.c | 2 +-
 gdb/solib-frv.c                  | 2 +-
 gdb/sparc-tdep.c                 | 4 ++--
 gdb/symtab.c                     | 2 +-
 gdb/symtab.h                     | 2 +-
 gdb/tracepoint.c                 | 2 +-
 15 files changed, 21 insertions(+), 21 deletions(-)

diff --git a/gdb/blockframe.c b/gdb/blockframe.c
index 5a3e342ee513..7c421a0ad3f7 100644
--- a/gdb/blockframe.c
+++ b/gdb/blockframe.c
@@ -145,7 +145,7 @@ find_pc_sect_function (CORE_ADDR pc, struct obj_section *section)
    Backward compatibility, no section */
 
 struct symbol *
-find_pc_function (CORE_ADDR pc)
+find_symbol_for_pc (CORE_ADDR pc)
 {
   return find_pc_sect_function (pc, find_pc_mapped_section (pc));
 }
@@ -419,7 +419,7 @@ find_function_entry_range_from_pc (CORE_ADDR pc, const char **name,
 struct type *
 find_function_type (CORE_ADDR pc)
 {
-  struct symbol *sym = find_pc_function (pc);
+  struct symbol *sym = find_symbol_for_pc (pc);
 
   if (sym != NULL && sym->value_block ()->entry_pc () == pc)
     return sym->type ();
diff --git a/gdb/btrace.c b/gdb/btrace.c
index ed7e41d3b79c..b5516a1499c8 100644
--- a/gdb/btrace.c
+++ b/gdb/btrace.c
@@ -557,7 +557,7 @@ ftrace_update_function (struct btrace_thread_info *btinfo,
      only a minimal symbol.  */
   if (pc.has_value ())
     {
-      fun = find_pc_function (*pc);
+      fun = find_symbol_for_pc (*pc);
       bound_minimal_symbol bmfun = lookup_minimal_symbol_by_pc (*pc);
       mfun = bmfun.minsym;
 
diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c
index d3536547c337..1007af46cbad 100644
--- a/gdb/cli/cli-cmds.c
+++ b/gdb/cli/cli-cmds.c
@@ -1039,7 +1039,7 @@ edit_command (const char *arg, int from_tty)
 		   paddress (get_current_arch (), sal.pc));
 
 	  gdbarch = sal.symtab->compunit ()->objfile ()->arch ();
-	  sym = find_pc_function (sal.pc);
+	  sym = find_symbol_for_pc (sal.pc);
 	  if (sym)
 	    gdb_printf ("%ps is in %ps (%ps:%ps).\n",
 			styled_string (address_style.style (),
@@ -1475,7 +1475,7 @@ list_command (const char *arg, int from_tty)
 	       paddress (get_current_arch (), sal.pc));
 
       gdbarch = sal.symtab->compunit ()->objfile ()->arch ();
-      sym = find_pc_function (sal.pc);
+      sym = find_symbol_for_pc (sal.pc);
       if (sym)
 	gdb_printf ("%s is in %s (%s:%d).\n",
 		    paddress (gdbarch, sal.pc),
diff --git a/gdb/dwarf2/loc.c b/gdb/dwarf2/loc.c
index 37c85d8d1921..cb4a39e65ad5 100644
--- a/gdb/dwarf2/loc.c
+++ b/gdb/dwarf2/loc.c
@@ -759,7 +759,7 @@ call_site_target::iterate_over_addresses (gdbarch *call_site_gdbarch,
 static struct symbol *
 func_addr_to_tail_call_list (struct gdbarch *gdbarch, CORE_ADDR addr)
 {
-  struct symbol *sym = find_pc_function (addr);
+  struct symbol *sym = find_symbol_for_pc (addr);
   struct type *type;
 
   if (sym == NULL || sym->value_block ()->entry_pc () != addr)
diff --git a/gdb/eval.c b/gdb/eval.c
index 07fa0af47223..5455164dc634 100644
--- a/gdb/eval.c
+++ b/gdb/eval.c
@@ -2054,7 +2054,7 @@ eval_op_objc_msgcall (struct type *expect_type, struct expression *exp,
 	(exp->gdbarch, addr, current_inferior ()->top_target ());
 
       /* Is it a high_level symbol?  */
-      sym = find_pc_function (addr);
+      sym = find_symbol_for_pc (addr);
       if (sym != NULL)
 	method = value_of_variable (sym, 0);
     }
diff --git a/gdb/guile/scm-frame.c b/gdb/guile/scm-frame.c
index db35ae525967..c77633cb59aa 100644
--- a/gdb/guile/scm-frame.c
+++ b/gdb/guile/scm-frame.c
@@ -665,7 +665,7 @@ gdbscm_frame_function (SCM self)
       if (frame != NULL)
 	{
 	  found = true;
-	  sym = find_pc_function (get_frame_address_in_block (frame));
+	  sym = find_symbol_for_pc (get_frame_address_in_block (frame));
 	}
     }
   catch (const gdb_exception &except)
diff --git a/gdb/infcall.c b/gdb/infcall.c
index c4b4c8f0bead..3b7542cf70c8 100644
--- a/gdb/infcall.c
+++ b/gdb/infcall.c
@@ -480,7 +480,7 @@ static const char *
 get_function_name (CORE_ADDR funaddr, char *buf, int buf_size)
 {
   {
-    struct symbol *symbol = find_pc_function (funaddr);
+    struct symbol *symbol = find_symbol_for_pc (funaddr);
 
     if (symbol)
       return symbol->print_name ();
diff --git a/gdb/infcmd.c b/gdb/infcmd.c
index e4b3e5b61f82..7747f03b63b2 100644
--- a/gdb/infcmd.c
+++ b/gdb/infcmd.c
@@ -743,7 +743,7 @@ set_step_frame (thread_info *tp)
   set_step_info (tp, frame, sal);
 
   CORE_ADDR pc = get_frame_pc (frame);
-  tp->control.step_start_function = find_pc_function (pc);
+  tp->control.step_start_function = find_symbol_for_pc (pc);
 }
 
 /* Step until outside of current statement.  */
@@ -1352,7 +1352,7 @@ until_next_command (int from_tty)
      not).  */
 
   pc = get_frame_pc (frame);
-  func = find_pc_function (pc);
+  func = find_symbol_for_pc (pc);
 
   if (!func)
     {
@@ -1834,7 +1834,7 @@ finish_command (const char *arg, int from_tty)
 
   /* Find the function we will return from.  */
   frame_info_ptr callee_frame = get_selected_frame (nullptr);
-  sm->function = find_pc_function (get_frame_pc (callee_frame));
+  sm->function = find_symbol_for_pc (get_frame_pc (callee_frame));
   sm->return_buf = 0;    /* Initialize buffer address is not available.  */
 
   /* Determine the return convention.  If it is RETURN_VALUE_STRUCT_CONVENTION,
diff --git a/gdb/infrun.c b/gdb/infrun.c
index b3c408feb304..b5d2e43d5361 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -7865,7 +7865,7 @@ process_event_stop_test (struct execution_control_state *ecs)
 	  && ((ecs->event_thread->control.step_stack_frame_id
 	       != outer_frame_id)
 	      || (ecs->event_thread->control.step_start_function
-		  != find_pc_function (ecs->event_thread->stop_pc ())))))
+		  != find_symbol_for_pc (ecs->event_thread->stop_pc ())))))
     {
       CORE_ADDR stop_pc = ecs->event_thread->stop_pc ();
       CORE_ADDR real_stop_pc;
@@ -9350,7 +9350,7 @@ print_stop_location (const target_waitstatus &ws)
 	  && (tp->control.step_frame_id
 	      == get_frame_id (get_current_frame ()))
 	  && (tp->control.step_start_function
-	      == find_pc_function (tp->stop_pc ())))
+	      == find_symbol_for_pc (tp->stop_pc ())))
 	{
 	  symtab_and_line sal = find_frame_sal (get_selected_frame (nullptr));
 	  if (sal.symtab != tp->current_symtab)
diff --git a/gdb/python/py-finishbreakpoint.c b/gdb/python/py-finishbreakpoint.c
index 70e1684524d8..75224b6d2d7e 100644
--- a/gdb/python/py-finishbreakpoint.c
+++ b/gdb/python/py-finishbreakpoint.c
@@ -251,7 +251,7 @@ bpfinishpy_init (PyObject *self, PyObject *args, PyObject *kwargs)
     {
       if ((pc = get_frame_pc_if_available (frame)))
 	{
-	  struct symbol *function = find_pc_function (*pc);
+	  struct symbol *function = find_symbol_for_pc (*pc);
 	  if (function != nullptr)
 	    {
 	      struct type *ret_type =
diff --git a/gdb/solib-frv.c b/gdb/solib-frv.c
index beb880228fcd..d5c83f4573b0 100644
--- a/gdb/solib-frv.c
+++ b/gdb/solib-frv.c
@@ -904,7 +904,7 @@ frv_fdpic_find_canonical_descriptor (CORE_ADDR entry_point)
   /* Attempt to find the name of the function.  If the name is available,
      it'll be used as an aid in finding matching functions in the dynamic
      symbol table.  */
-  sym = find_pc_function (entry_point);
+  sym = find_symbol_for_pc (entry_point);
   if (sym == 0)
     name = 0;
   else
diff --git a/gdb/sparc-tdep.c b/gdb/sparc-tdep.c
index 914a568c98b9..6ac02def8c00 100644
--- a/gdb/sparc-tdep.c
+++ b/gdb/sparc-tdep.c
@@ -1249,7 +1249,7 @@ sparc32_frame_cache (const frame_info_ptr &this_frame, void **this_cache)
 
   cache = sparc_frame_cache (this_frame, this_cache);
 
-  sym = find_pc_function (cache->pc);
+  sym = find_symbol_for_pc (cache->pc);
   if (sym)
     {
       cache->struct_return_p = sparc32_struct_return_from_sym (sym);
@@ -1552,7 +1552,7 @@ static int
 sparc32_dwarf2_struct_return_p (const frame_info_ptr &this_frame)
 {
   CORE_ADDR pc = get_frame_address_in_block (this_frame);
-  struct symbol *sym = find_pc_function (pc);
+  struct symbol *sym = find_symbol_for_pc (pc);
 
   if (sym)
     return sparc32_struct_return_from_sym (sym);
diff --git a/gdb/symtab.c b/gdb/symtab.c
index b0cea7a06b5b..9109103da416 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -4108,7 +4108,7 @@ find_function_alias_target (bound_minimal_symbol msymbol)
   if (!msymbol_is_function (msymbol.objfile, msymbol.minsym, &func_addr))
     return NULL;
 
-  symbol *sym = find_pc_function (func_addr);
+  symbol *sym = find_symbol_for_pc (func_addr);
   if (sym != NULL
       && sym->loc_class () == LOC_BLOCK
       && sym->value_block ()->entry_pc () == func_addr)
diff --git a/gdb/symtab.h b/gdb/symtab.h
index 64028bf271f0..ea34228df12d 100644
--- a/gdb/symtab.h
+++ b/gdb/symtab.h
@@ -2206,7 +2206,7 @@ extern struct type *lookup_enum (const char *, const struct block *);
    return value will not be an inlined function; the containing
    function will be returned instead.  */
 
-extern struct symbol *find_pc_function (CORE_ADDR);
+extern struct symbol *find_symbol_for_pc (CORE_ADDR);
 
 /* lookup the function corresponding to the address and section.  The
    return value will not be an inlined function; the containing
diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c
index 879e4a6b33e3..ade745a08653 100644
--- a/gdb/tracepoint.c
+++ b/gdb/tracepoint.c
@@ -217,7 +217,7 @@ set_traceframe_context (const frame_info_ptr &trace_frame)
       && (trace_pc = get_frame_pc_if_available (trace_frame)))
     {
       traceframe_sal = find_pc_line (*trace_pc, 0);
-      traceframe_fun = find_pc_function (*trace_pc);
+      traceframe_fun = find_symbol_for_pc (*trace_pc);
 
       /* Save linenumber as "$trace_line", a debugger variable visible to
 	 users.  */
-- 
2.51.0


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH 02/10] gdb: rename find_pc_sect_function -> find_symbol_for_pc_sect
  2025-10-16  0:07 [PATCH 00/10] Rename some symtab find functions simon.marchi
  2025-10-16  0:07 ` [PATCH 01/10] gdb: rename find_pc_function -> find_symbol_for_pc simon.marchi
@ 2025-10-16  0:07 ` simon.marchi
  2025-10-16  0:07 ` [PATCH 03/10] gdb: rename find_pc_sect_containing_function -> find_symbol_for_pc_sect_maybe_inline simon.marchi
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 13+ messages in thread
From: simon.marchi @ 2025-10-16  0:07 UTC (permalink / raw)
  To: gdb-patches; +Cc: Simon Marchi

From: Simon Marchi <simon.marchi@polymtl.ca>

Change-Id: I24d584024053655b469cabc78809abf05f0f0f02
---
 gdb/blockframe.c | 6 +++---
 gdb/breakpoint.c | 2 +-
 gdb/printcmd.c   | 2 +-
 gdb/symtab.c     | 2 +-
 gdb/symtab.h     | 2 +-
 gdb/tracepoint.c | 2 +-
 6 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/gdb/blockframe.c b/gdb/blockframe.c
index 7c421a0ad3f7..9374cb15184f 100644
--- a/gdb/blockframe.c
+++ b/gdb/blockframe.c
@@ -131,7 +131,7 @@ get_frame_function (const frame_info_ptr &frame)
    Returns 0 if function is not known.  */
 
 struct symbol *
-find_pc_sect_function (CORE_ADDR pc, struct obj_section *section)
+find_symbol_for_pc_sect (CORE_ADDR pc, struct obj_section *section)
 {
   const struct block *b = block_for_pc_sect (pc, section);
 
@@ -147,7 +147,7 @@ find_pc_sect_function (CORE_ADDR pc, struct obj_section *section)
 struct symbol *
 find_symbol_for_pc (CORE_ADDR pc)
 {
-  return find_pc_sect_function (pc, find_pc_mapped_section (pc));
+  return find_symbol_for_pc_sect (pc, find_pc_mapped_section (pc));
 }
 
 /* See symtab.h.  */
@@ -249,7 +249,7 @@ find_pc_partial_function_sym (CORE_ADDR pc,
 	 address of the function.  This will happen when the function
 	 has more than one range and the entry pc is not within the
 	 lowest range of addresses.  */
-      f = find_pc_sect_function (mapped_pc, section);
+      f = find_symbol_for_pc_sect (mapped_pc, section);
       if (f != NULL
 	  && (msymbol.minsym == NULL
 	      || (f->value_block ()->entry_pc ()
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index bfcfc2404b0b..de98a2327d7e 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -12891,7 +12891,7 @@ update_static_tracepoint (tracepoint *tp, struct symtab_and_line sal)
 		   tp->number, tp->static_trace_marker_id.c_str ());
 
 	  symtab_and_line sal2 = find_pc_line (tpmarker->address, 0);
-	  sym = find_pc_sect_function (tpmarker->address, NULL);
+	  sym = find_symbol_for_pc_sect (tpmarker->address, NULL);
 	  uiout->text ("Now in ");
 	  if (sym)
 	    {
diff --git a/gdb/printcmd.c b/gdb/printcmd.c
index e27ccd05d4fb..047833a261d9 100644
--- a/gdb/printcmd.c
+++ b/gdb/printcmd.c
@@ -636,7 +636,7 @@ build_address_symbolic (struct gdbarch *gdbarch,
      symbols anyway).  */
   bound_minimal_symbol msymbol
     = lookup_minimal_symbol_by_pc_section (addr, section);
-  symbol = find_pc_sect_function (addr, section);
+  symbol = find_symbol_for_pc_sect (addr, section);
 
   if (symbol)
     {
diff --git a/gdb/symtab.c b/gdb/symtab.c
index 9109103da416..386107451be3 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -3700,7 +3700,7 @@ skip_prologue_sal (struct symtab_and_line *sal)
 
   switch_to_program_space_and_thread (sal->pspace);
 
-  symbol *sym = find_pc_sect_function (sal->pc, sal->section);
+  symbol *sym = find_symbol_for_pc_sect (sal->pc, sal->section);
   objfile *objfile;
   CORE_ADDR pc;
   obj_section *section;
diff --git a/gdb/symtab.h b/gdb/symtab.h
index ea34228df12d..5d64e2149c0f 100644
--- a/gdb/symtab.h
+++ b/gdb/symtab.h
@@ -2212,7 +2212,7 @@ extern struct symbol *find_symbol_for_pc (CORE_ADDR);
    return value will not be an inlined function; the containing
    function will be returned instead.  */
 
-extern struct symbol *find_pc_sect_function (CORE_ADDR, struct obj_section *);
+extern struct symbol *find_symbol_for_pc_sect (CORE_ADDR, struct obj_section *);
 
 /* lookup the function symbol corresponding to the address and
    section.  The return value will be the closest enclosing function,
diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c
index ade745a08653..ce5418b87913 100644
--- a/gdb/tracepoint.c
+++ b/gdb/tracepoint.c
@@ -3618,7 +3618,7 @@ print_one_static_tracepoint_marker (int count,
   uiout->field_core_addr ("addr", marker.gdbarch, marker.address);
 
   sal = find_pc_line (marker.address, 0);
-  sym = find_pc_sect_function (marker.address, NULL);
+  sym = find_symbol_for_pc_sect (marker.address, NULL);
   if (sym)
     {
       uiout->text ("in ");
-- 
2.51.0


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH 03/10] gdb: rename find_pc_sect_containing_function -> find_symbol_for_pc_sect_maybe_inline
  2025-10-16  0:07 [PATCH 00/10] Rename some symtab find functions simon.marchi
  2025-10-16  0:07 ` [PATCH 01/10] gdb: rename find_pc_function -> find_symbol_for_pc simon.marchi
  2025-10-16  0:07 ` [PATCH 02/10] gdb: rename find_pc_sect_function -> find_symbol_for_pc_sect simon.marchi
@ 2025-10-16  0:07 ` simon.marchi
  2025-10-16  0:07 ` [PATCH 04/10] gdb: rename find_pc_compunit_symtab -> find_compunit_symtab_for_pc simon.marchi
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 13+ messages in thread
From: simon.marchi @ 2025-10-16  0:07 UTC (permalink / raw)
  To: gdb-patches; +Cc: Simon Marchi

From: Simon Marchi <simon.marchi@polymtl.ca>

Use the suffix "maybe_inline" to differentiate it from
find_symbol_for_pc_sect.  find_symbol_for_pc_sect_maybe_inline can
return symbols for inline functions, while find_symbol_for_pc_sect
doesn't.

Change-Id: I6c4ef961383429ee26c8fcc0cc5df2e4e1e24959
---
 gdb/blockframe.c | 2 +-
 gdb/infcmd.c     | 2 +-
 gdb/linespec.c   | 2 +-
 gdb/symtab.c     | 2 +-
 gdb/symtab.h     | 2 +-
 5 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/gdb/blockframe.c b/gdb/blockframe.c
index 9374cb15184f..434208c7e269 100644
--- a/gdb/blockframe.c
+++ b/gdb/blockframe.c
@@ -153,7 +153,7 @@ find_symbol_for_pc (CORE_ADDR pc)
 /* See symtab.h.  */
 
 struct symbol *
-find_pc_sect_containing_function (CORE_ADDR pc, struct obj_section *section)
+find_symbol_for_pc_sect_maybe_inline (CORE_ADDR pc, struct obj_section *section)
 {
   const block *bl = block_for_pc_sect (pc, section);
 
diff --git a/gdb/infcmd.c b/gdb/infcmd.c
index 7747f03b63b2..bb929240978f 100644
--- a/gdb/infcmd.c
+++ b/gdb/infcmd.c
@@ -1093,7 +1093,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_pc_sect_containing_function (sal.pc,
+  sfn = find_symbol_for_pc_sect_maybe_inline (sal.pc,
 					  find_pc_mapped_section (sal.pc));
   if (fn != nullptr && sfn != fn)
     {
diff --git a/gdb/linespec.c b/gdb/linespec.c
index fe1fb4c07fb9..b6fe4e170bf3 100644
--- a/gdb/linespec.c
+++ b/gdb/linespec.c
@@ -2165,7 +2165,7 @@ convert_address_location_to_sals (struct linespec_state *self,
   sal.pc = address;
   sal.section = find_pc_overlay (address);
   sal.explicit_pc = 1;
-  sal.symbol = find_pc_sect_containing_function (sal.pc, sal.section);
+  sal.symbol = find_symbol_for_pc_sect_maybe_inline (sal.pc, sal.section);
 
   std::vector<symtab_and_line> sals;
   add_sal_to_sals (self, sals, sal, core_addr_to_string (address), true);
diff --git a/gdb/symtab.c b/gdb/symtab.c
index 386107451be3..100e7dbbda14 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -3565,7 +3565,7 @@ find_function_start_sal (CORE_ADDR func_addr, bool funfirstline)
   /* find_function_start_sal_1 does a linetable search, so it finds
      the symtab and linenumber, but not a symbol.  Fill in the
      function symbol too.  */
-  sal.symbol = find_pc_sect_containing_function (sal.pc, sal.section);
+  sal.symbol = find_symbol_for_pc_sect_maybe_inline (sal.pc, sal.section);
 
   return sal;
 }
diff --git a/gdb/symtab.h b/gdb/symtab.h
index 5d64e2149c0f..f6f25a62d2c4 100644
--- a/gdb/symtab.h
+++ b/gdb/symtab.h
@@ -2218,7 +2218,7 @@ extern struct symbol *find_symbol_for_pc_sect (CORE_ADDR, struct obj_section *);
    section.  The return value will be the closest enclosing function,
    which might be an inline function.  */
 
-extern struct symbol *find_pc_sect_containing_function
+extern struct symbol *find_symbol_for_pc_sect_maybe_inline
   (CORE_ADDR pc, struct obj_section *section);
 
 /* Find the symbol at the given address.  Returns NULL if no symbol
-- 
2.51.0


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH 04/10] gdb: rename find_pc_compunit_symtab -> find_compunit_symtab_for_pc
  2025-10-16  0:07 [PATCH 00/10] Rename some symtab find functions simon.marchi
                   ` (2 preceding siblings ...)
  2025-10-16  0:07 ` [PATCH 03/10] gdb: rename find_pc_sect_containing_function -> find_symbol_for_pc_sect_maybe_inline simon.marchi
@ 2025-10-16  0:07 ` simon.marchi
  2025-10-16  0:07 ` [PATCH 05/10] gdb: rename find_pc_sect_compunit_symtab -> find_compunit_symtab_for_pc_sect simon.marchi
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 13+ messages in thread
From: simon.marchi @ 2025-10-16  0:07 UTC (permalink / raw)
  To: gdb-patches; +Cc: Simon Marchi

From: Simon Marchi <simon.marchi@polymtl.ca>

Change-Id: I6eef5db4ae55f3eb0415768207ae3c26b305f773
---
 gdb/amd64-tdep.c          | 6 +++---
 gdb/amdgpu-tdep.c         | 2 +-
 gdb/arm-tdep.c            | 2 +-
 gdb/block.c               | 2 +-
 gdb/compile/compile.c     | 2 +-
 gdb/dwarf2/frame.c        | 2 +-
 gdb/frame.c               | 4 ++--
 gdb/guile/scm-block.c     | 2 +-
 gdb/i386-tdep.c           | 4 ++--
 gdb/infrun.c              | 4 ++--
 gdb/python/py-progspace.c | 2 +-
 gdb/symtab.c              | 6 +++---
 gdb/symtab.h              | 2 +-
 13 files changed, 20 insertions(+), 20 deletions(-)

diff --git a/gdb/amd64-tdep.c b/gdb/amd64-tdep.c
index 9245889210b3..b1021c071c55 100755
--- a/gdb/amd64-tdep.c
+++ b/gdb/amd64-tdep.c
@@ -2850,7 +2850,7 @@ amd64_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR start_pc)
     {
       CORE_ADDR post_prologue_pc
 	= skip_prologue_using_sal (gdbarch, func_addr);
-      struct compunit_symtab *cust = find_pc_compunit_symtab (func_addr);
+      struct compunit_symtab *cust = find_compunit_symtab_for_pc (func_addr);
 
       /* LLVM backend (Clang/Flang) always emits a line note before the
 	 prologue and another one after.  We trust clang and newer Intel
@@ -3233,7 +3233,7 @@ amd64_stack_frame_destroyed_p_1 (struct gdbarch *gdbarch, CORE_ADDR pc)
 static int
 amd64_stack_frame_destroyed_p (struct gdbarch *gdbarch, CORE_ADDR pc)
 {
-  struct compunit_symtab *cust = find_pc_compunit_symtab (pc);
+  struct compunit_symtab *cust = find_compunit_symtab_for_pc (pc);
 
   if (cust != nullptr && cust->producer () != nullptr
       && producer_is_llvm (cust->producer ()))
@@ -3255,7 +3255,7 @@ amd64_epilogue_frame_sniffer_1 (const struct frame_unwind *self,
     return 0;
 
   bool unwind_valid_p
-    = compunit_epilogue_unwind_valid (find_pc_compunit_symtab (pc));
+    = compunit_epilogue_unwind_valid (find_compunit_symtab_for_pc (pc));
   if (override_p)
     {
       if (unwind_valid_p)
diff --git a/gdb/amdgpu-tdep.c b/gdb/amdgpu-tdep.c
index 26e5a27a749a..07ad307afc18 100644
--- a/gdb/amdgpu-tdep.c
+++ b/gdb/amdgpu-tdep.c
@@ -1002,7 +1002,7 @@ amdgpu_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR start_pc)
     {
       CORE_ADDR post_prologue_pc
 	= skip_prologue_using_sal (gdbarch, func_addr);
-      struct compunit_symtab *cust = find_pc_compunit_symtab (func_addr);
+      struct compunit_symtab *cust = find_compunit_symtab_for_pc (func_addr);
 
       /* Clang always emits a line note before the prologue and another
 	 one after.  We trust clang to emit usable line notes.  */
diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c
index f4c2e0413f19..b03e67b1aa82 100644
--- a/gdb/arm-tdep.c
+++ b/gdb/arm-tdep.c
@@ -1780,7 +1780,7 @@ arm_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
     {
       CORE_ADDR post_prologue_pc
 	= skip_prologue_using_sal (gdbarch, func_addr);
-      struct compunit_symtab *cust = find_pc_compunit_symtab (func_addr);
+      struct compunit_symtab *cust = find_compunit_symtab_for_pc (func_addr);
 
       if (post_prologue_pc)
 	post_prologue_pc
diff --git a/gdb/block.c b/gdb/block.c
index e09bccdcf862..9ce14849566b 100644
--- a/gdb/block.c
+++ b/gdb/block.c
@@ -219,7 +219,7 @@ call_site_for_pc (struct gdbarch *gdbarch, CORE_ADDR pc)
   call_site *cs = nullptr;
 
   /* -1 as tail call PC can be already after the compilation unit range.  */
-  cust = find_pc_compunit_symtab (pc - 1);
+  cust = find_compunit_symtab_for_pc (pc - 1);
 
   if (cust != nullptr)
     cs = cust->find_call_site (pc);
diff --git a/gdb/compile/compile.c b/gdb/compile/compile.c
index 5d81ec12b714..79c6af157629 100644
--- a/gdb/compile/compile.c
+++ b/gdb/compile/compile.c
@@ -437,7 +437,7 @@ static const char *
 get_selected_pc_producer_options (void)
 {
   CORE_ADDR pc = get_frame_pc (get_selected_frame (NULL));
-  struct compunit_symtab *symtab = find_pc_compunit_symtab (pc);
+  struct compunit_symtab *symtab = find_compunit_symtab_for_pc (pc);
   const char *cs;
 
   if (symtab == NULL || symtab->producer () == NULL
diff --git a/gdb/dwarf2/frame.c b/gdb/dwarf2/frame.c
index 8d0d59fb5671..525b581cf393 100644
--- a/gdb/dwarf2/frame.c
+++ b/gdb/dwarf2/frame.c
@@ -740,7 +740,7 @@ dwarf2_frame_find_quirks (struct dwarf2_frame_state *fs,
 {
   struct compunit_symtab *cust;
 
-  cust = find_pc_compunit_symtab (fs->pc);
+  cust = find_compunit_symtab_for_pc (fs->pc);
   if (cust == NULL)
     return;
 
diff --git a/gdb/frame.c b/gdb/frame.c
index 5c41dcdc3457..4162a35b7533 100644
--- a/gdb/frame.c
+++ b/gdb/frame.c
@@ -1991,7 +1991,7 @@ select_frame (const frame_info_ptr &fi)
 	 block.  */
       if (get_frame_address_in_block_if_available (fi, &pc))
 	{
-	  struct compunit_symtab *cust = find_pc_compunit_symtab (pc);
+	  struct compunit_symtab *cust = find_compunit_symtab_for_pc (pc);
 
 	  if (cust != NULL
 	      && cust->language () != current_language->la_language
@@ -3143,7 +3143,7 @@ get_frame_language (const frame_info_ptr &frame)
 
   if (pc_p)
     {
-      struct compunit_symtab *cust = find_pc_compunit_symtab (pc);
+      struct compunit_symtab *cust = find_compunit_symtab_for_pc (pc);
 
       if (cust != NULL)
 	return cust->language ();
diff --git a/gdb/guile/scm-block.c b/gdb/guile/scm-block.c
index a4e692b8ccb1..e1b2928df180 100644
--- a/gdb/guile/scm-block.c
+++ b/gdb/guile/scm-block.c
@@ -676,7 +676,7 @@ gdbscm_lookup_block (SCM pc_scm)
   gdbscm_gdb_exception exc {};
   try
     {
-      cust = find_pc_compunit_symtab (pc);
+      cust = find_compunit_symtab_for_pc (pc);
 
       if (cust != NULL && cust->objfile () != NULL)
 	block = block_for_pc (pc);
diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c
index d3ad402addc1..e00b3337beaf 100644
--- a/gdb/i386-tdep.c
+++ b/gdb/i386-tdep.c
@@ -1803,7 +1803,7 @@ i386_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR start_pc)
     {
       CORE_ADDR post_prologue_pc
 	= skip_prologue_using_sal (gdbarch, func_addr);
-      struct compunit_symtab *cust = find_pc_compunit_symtab (func_addr);
+      struct compunit_symtab *cust = find_compunit_symtab_for_pc (func_addr);
 
       /* LLVM backend (Clang/Flang) always emits a line note before the
 	 prologue and another one after.  We trust clang and newer Intel
@@ -2197,7 +2197,7 @@ i386_epilogue_frame_sniffer_1 (const struct frame_unwind *self,
     return 0;
 
   bool unwind_valid_p
-    = compunit_epilogue_unwind_valid (find_pc_compunit_symtab (pc));
+    = compunit_epilogue_unwind_valid (find_compunit_symtab_for_pc (pc));
   if (override_p)
     {
       if (unwind_valid_p)
diff --git a/gdb/infrun.c b/gdb/infrun.c
index b5d2e43d5361..959393d3e5e7 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -8671,7 +8671,7 @@ handle_step_into_function (struct gdbarch *gdbarch,
   fill_in_stop_func (gdbarch, ecs);
 
   compunit_symtab *cust
-    = find_pc_compunit_symtab (ecs->event_thread->stop_pc ());
+    = find_compunit_symtab_for_pc (ecs->event_thread->stop_pc ());
   if (cust != nullptr && cust->language () != language_asm)
     ecs->stop_func_start
       = gdbarch_skip_prologue_noexcept (gdbarch, ecs->stop_func_start);
@@ -8750,7 +8750,7 @@ handle_step_into_function_backward (struct gdbarch *gdbarch,
 
   fill_in_stop_func (gdbarch, ecs);
 
-  cust = find_pc_compunit_symtab (ecs->event_thread->stop_pc ());
+  cust = find_compunit_symtab_for_pc (ecs->event_thread->stop_pc ());
   if (cust != nullptr && cust->language () != language_asm)
     ecs->stop_func_start
       = gdbarch_skip_prologue_noexcept (gdbarch, ecs->stop_func_start);
diff --git a/gdb/python/py-progspace.c b/gdb/python/py-progspace.c
index 9f3e45c0cc65..a0afc7b7dba3 100644
--- a/gdb/python/py-progspace.c
+++ b/gdb/python/py-progspace.c
@@ -515,7 +515,7 @@ pspy_block_for_pc (PyObject *o, PyObject *args)
       scoped_restore_current_program_space saver;
 
       set_current_program_space (self->pspace);
-      cust = find_pc_compunit_symtab (pc);
+      cust = find_compunit_symtab_for_pc (pc);
 
       if (cust != NULL && cust->objfile () != NULL)
 	block = block_for_pc (pc);
diff --git a/gdb/symtab.c b/gdb/symtab.c
index 100e7dbbda14..0180c4eadac5 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -2825,7 +2825,7 @@ find_pc_sect_compunit_symtab (CORE_ADDR pc, struct obj_section *section)
    Backward compatibility, no section.  */
 
 struct compunit_symtab *
-find_pc_compunit_symtab (CORE_ADDR pc)
+find_compunit_symtab_for_pc (CORE_ADDR pc)
 {
   return find_pc_sect_compunit_symtab (pc, find_pc_mapped_section (pc));
 }
@@ -4755,7 +4755,7 @@ global_symbol_searcher::expand_symtabs
 		     msymbols to the results list, and that requires that
 		     the symbols tables are expanded.  */
 		  if ((kind & SEARCH_FUNCTION_DOMAIN) != 0
-		      ? (find_pc_compunit_symtab
+		      ? (find_compunit_symtab_for_pc
 			 (msymbol->value_address (objfile)) == NULL)
 		      : (lookup_symbol_in_objfile_from_linkage_name
 			 (objfile, msymbol->linkage_name (),
@@ -4875,7 +4875,7 @@ global_symbol_searcher::add_matching_msymbols
 	      /* For functions we can do a quick check of whether the
 		 symbol might be found via find_pc_symtab.  */
 	      if ((kind & SEARCH_FUNCTION_DOMAIN) == 0
-		  || (find_pc_compunit_symtab
+		  || (find_compunit_symtab_for_pc
 		      (msymbol->value_address (objfile)) == NULL))
 		{
 		  if (lookup_symbol_in_objfile_from_linkage_name
diff --git a/gdb/symtab.h b/gdb/symtab.h
index f6f25a62d2c4..c8c43b9f7cf4 100644
--- a/gdb/symtab.h
+++ b/gdb/symtab.h
@@ -2308,7 +2308,7 @@ extern void clear_pc_function_cache (void);
 
 /* lookup full symbol table by address.  */
 
-extern struct compunit_symtab *find_pc_compunit_symtab (CORE_ADDR);
+extern struct compunit_symtab *find_compunit_symtab_for_pc (CORE_ADDR);
 
 /* lookup full symbol table by address and section.  */
 
-- 
2.51.0


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH 05/10] gdb: rename find_pc_sect_compunit_symtab -> find_compunit_symtab_for_pc_sect
  2025-10-16  0:07 [PATCH 00/10] Rename some symtab find functions simon.marchi
                   ` (3 preceding siblings ...)
  2025-10-16  0:07 ` [PATCH 04/10] gdb: rename find_pc_compunit_symtab -> find_compunit_symtab_for_pc simon.marchi
@ 2025-10-16  0:07 ` simon.marchi
  2025-10-16  0:08 ` [PATCH 06/10] gdb: rename find_pc_line_pc_range -> find_line_pc_range_for_pc simon.marchi
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 13+ messages in thread
From: simon.marchi @ 2025-10-16  0:07 UTC (permalink / raw)
  To: gdb-patches; +Cc: Simon Marchi

From: Simon Marchi <simon.marchi@polymtl.ca>

Change-Id: Idb4941f6a24ddd97ee98d35a40bfbe7ceba82ec1
---
 gdb/block.c      | 2 +-
 gdb/blockframe.c | 2 +-
 gdb/symtab.c     | 6 +++---
 gdb/symtab.h     | 2 +-
 4 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/gdb/block.c b/gdb/block.c
index 9ce14849566b..42ace7c60cfa 100644
--- a/gdb/block.c
+++ b/gdb/block.c
@@ -183,7 +183,7 @@ blockvector_for_pc_sect (CORE_ADDR pc, struct obj_section *section,
   if (cust == NULL)
     {
       /* First search all symtabs for one whose file contains our pc */
-      cust = find_pc_sect_compunit_symtab (pc, section);
+      cust = find_compunit_symtab_for_pc_sect (pc, section);
       if (cust == NULL)
 	return 0;
     }
diff --git a/gdb/blockframe.c b/gdb/blockframe.c
index 434208c7e269..654d635f8ba7 100644
--- a/gdb/blockframe.c
+++ b/gdb/blockframe.c
@@ -236,7 +236,7 @@ find_pc_partial_function_sym (CORE_ADDR pc,
     goto return_cached_value;
 
   msymbol = lookup_minimal_symbol_by_pc_section (mapped_pc, section);
-  compunit_symtab = find_pc_sect_compunit_symtab (mapped_pc, section);
+  compunit_symtab = find_compunit_symtab_for_pc_sect (mapped_pc, section);
 
   if (compunit_symtab != NULL)
     {
diff --git a/gdb/symtab.c b/gdb/symtab.c
index 0180c4eadac5..8a65fdfb226a 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -2706,7 +2706,7 @@ iterate_over_symbols_terminated
    This will read in debug info as necessary.  */
 
 struct compunit_symtab *
-find_pc_sect_compunit_symtab (CORE_ADDR pc, struct obj_section *section)
+find_compunit_symtab_for_pc_sect (CORE_ADDR pc, struct obj_section *section)
 {
   struct compunit_symtab *best_cust = NULL;
   CORE_ADDR best_cust_range = 0;
@@ -2827,7 +2827,7 @@ find_pc_sect_compunit_symtab (CORE_ADDR pc, struct obj_section *section)
 struct compunit_symtab *
 find_compunit_symtab_for_pc (CORE_ADDR pc)
 {
-  return find_pc_sect_compunit_symtab (pc, find_pc_mapped_section (pc));
+  return find_compunit_symtab_for_pc_sect (pc, find_pc_mapped_section (pc));
 }
 
 /* See symtab.h.  */
@@ -3027,7 +3027,7 @@ find_pc_sect_line (CORE_ADDR pc, struct obj_section *section, int notcurrent)
   symtab_and_line val;
   val.pspace = current_program_space;
 
-  compunit_symtab *cust = find_pc_sect_compunit_symtab (pc, section);
+  compunit_symtab *cust = find_compunit_symtab_for_pc_sect (pc, section);
   if (cust == NULL)
     {
       /* If no symbol information, return previous pc.  */
diff --git a/gdb/symtab.h b/gdb/symtab.h
index c8c43b9f7cf4..795611eacf18 100644
--- a/gdb/symtab.h
+++ b/gdb/symtab.h
@@ -2313,7 +2313,7 @@ extern struct compunit_symtab *find_compunit_symtab_for_pc (CORE_ADDR);
 /* lookup full symbol table by address and section.  */
 
 extern struct compunit_symtab *
-  find_pc_sect_compunit_symtab (CORE_ADDR, struct obj_section *);
+  find_compunit_symtab_for_pc_sect (CORE_ADDR, struct obj_section *);
 
 extern bool find_pc_line_pc_range (CORE_ADDR, CORE_ADDR *, CORE_ADDR *);
 
-- 
2.51.0


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH 06/10] gdb: rename find_pc_line_pc_range -> find_line_pc_range_for_pc
  2025-10-16  0:07 [PATCH 00/10] Rename some symtab find functions simon.marchi
                   ` (4 preceding siblings ...)
  2025-10-16  0:07 ` [PATCH 05/10] gdb: rename find_pc_sect_compunit_symtab -> find_compunit_symtab_for_pc_sect simon.marchi
@ 2025-10-16  0:08 ` simon.marchi
  2025-10-16  0:08 ` [PATCH 07/10] gdb: rename find_pc_line -> find_sal_for_pc simon.marchi
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 13+ messages in thread
From: simon.marchi @ 2025-10-16  0:08 UTC (permalink / raw)
  To: gdb-patches; +Cc: Simon Marchi

From: Simon Marchi <simon.marchi@polymtl.ca>

Change-Id: Iff7590d9d4e914ae74ba4818f338e911f7ab5416
---
 gdb/infcmd.c | 6 +++---
 gdb/symtab.c | 2 +-
 gdb/symtab.h | 2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/gdb/infcmd.c b/gdb/infcmd.c
index bb929240978f..ff49c2e29253 100644
--- a/gdb/infcmd.c
+++ b/gdb/infcmd.c
@@ -964,9 +964,9 @@ prepare_one_step (thread_info *tp, struct step_command_fsm *sm)
 	    }
 
 	  pc = get_frame_pc (frame);
-	  find_pc_line_pc_range (pc,
-				 &tp->control.step_range_start,
-				 &tp->control.step_range_end);
+	  find_line_pc_range_for_pc (pc,
+		 		     &tp->control.step_range_start,
+				     &tp->control.step_range_end);
 
 	  if (execution_direction == EXEC_REVERSE)
 	    {
diff --git a/gdb/symtab.c b/gdb/symtab.c
index 8a65fdfb226a..f3377ff2a7eb 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -3505,7 +3505,7 @@ find_line_common (const linetable *l, int lineno,
 }
 
 bool
-find_pc_line_pc_range (CORE_ADDR pc, CORE_ADDR *startptr, CORE_ADDR *endptr)
+find_line_pc_range_for_pc (CORE_ADDR pc, CORE_ADDR *startptr, CORE_ADDR *endptr)
 {
   struct symtab_and_line sal;
 
diff --git a/gdb/symtab.h b/gdb/symtab.h
index 795611eacf18..1d419dd16e68 100644
--- a/gdb/symtab.h
+++ b/gdb/symtab.h
@@ -2315,7 +2315,7 @@ extern struct compunit_symtab *find_compunit_symtab_for_pc (CORE_ADDR);
 extern struct compunit_symtab *
   find_compunit_symtab_for_pc_sect (CORE_ADDR, struct obj_section *);
 
-extern bool find_pc_line_pc_range (CORE_ADDR, CORE_ADDR *, CORE_ADDR *);
+extern bool find_line_pc_range_for_pc (CORE_ADDR, CORE_ADDR *, CORE_ADDR *);
 
 extern void reread_symbols (int from_tty);
 
-- 
2.51.0


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH 07/10] gdb: rename find_pc_line -> find_sal_for_pc
  2025-10-16  0:07 [PATCH 00/10] Rename some symtab find functions simon.marchi
                   ` (5 preceding siblings ...)
  2025-10-16  0:08 ` [PATCH 06/10] gdb: rename find_pc_line_pc_range -> find_line_pc_range_for_pc simon.marchi
@ 2025-10-16  0:08 ` simon.marchi
  2025-10-16  0:08 ` [PATCH 08/10] gdb: rename find_pc_sect_line -> find_sal_for_pc_sect simon.marchi
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 13+ messages in thread
From: simon.marchi @ 2025-10-16  0:08 UTC (permalink / raw)
  To: gdb-patches; +Cc: Simon Marchi

From: Simon Marchi <simon.marchi@polymtl.ca>

Change-Id: I293b655e8753fc650f3ec10bb4e34a9632d8e377
---
 gdb/aarch64-tdep.c              |  2 +-
 gdb/alpha-tdep.c                |  2 +-
 gdb/arc-tdep.c                  |  2 +-
 gdb/arm-linux-tdep.c            |  2 +-
 gdb/arm-tdep.c                  |  2 +-
 gdb/breakpoint.c                | 14 +++++++-------
 gdb/c-exp.y                     |  2 +-
 gdb/cli/cli-cmds.c              |  2 +-
 gdb/compile/compile-c-support.c |  2 +-
 gdb/cp-namespace.c              |  2 +-
 gdb/cris-tdep.c                 |  2 +-
 gdb/disasm.c                    |  8 ++++----
 gdb/elfread.c                   |  2 +-
 gdb/frame.c                     |  2 +-
 gdb/frv-tdep.c                  |  2 +-
 gdb/ft32-tdep.c                 |  2 +-
 gdb/guile/scm-symtab.c          |  2 +-
 gdb/h8300-tdep.c                |  2 +-
 gdb/hppa-tdep.c                 |  2 +-
 gdb/ia64-tdep.c                 |  4 ++--
 gdb/infcmd.c                    | 10 +++++-----
 gdb/infrun.c                    |  8 ++++----
 gdb/iq2000-tdep.c               |  6 +++---
 gdb/linespec.c                  |  2 +-
 gdb/linux-fork.c                |  2 +-
 gdb/loongarch-tdep.c            |  2 +-
 gdb/m32r-tdep.c                 |  2 +-
 gdb/m68hc11-tdep.c              |  2 +-
 gdb/macroscope.c                |  2 +-
 gdb/microblaze-tdep.c           |  2 +-
 gdb/moxie-tdep.c                |  2 +-
 gdb/namespace.c                 |  2 +-
 gdb/or1k-tdep.c                 |  2 +-
 gdb/python/py-progspace.c       |  2 +-
 gdb/python/py-record-btrace.c   |  2 +-
 gdb/record-btrace.c             |  2 +-
 gdb/reverse.c                   |  2 +-
 gdb/rs6000-tdep.c               |  4 ++--
 gdb/sparc64-tdep.c              |  2 +-
 gdb/symtab.c                    | 28 ++++++++++++++--------------
 gdb/symtab.h                    |  4 ++--
 gdb/tracepoint.c                |  8 ++++----
 gdb/tui/tui-winsource.c         |  6 +++---
 gdb/v850-tdep.c                 |  2 +-
 gdb/xstormy16-tdep.c            |  2 +-
 gdb/xtensa-tdep.c               |  4 ++--
 gdb/z80-tdep.c                  |  2 +-
 47 files changed, 87 insertions(+), 87 deletions(-)

diff --git a/gdb/aarch64-tdep.c b/gdb/aarch64-tdep.c
index 500ac77d75a8..89142e0a2149 100644
--- a/gdb/aarch64-tdep.c
+++ b/gdb/aarch64-tdep.c
@@ -1026,7 +1026,7 @@ aarch64_scan_prologue (const frame_info_ptr &this_frame,
   if (find_pc_partial_function (block_addr, NULL, &prologue_start,
 				&prologue_end))
     {
-      struct symtab_and_line sal = find_pc_line (prologue_start, 0);
+      struct symtab_and_line sal = find_sal_for_pc (prologue_start, 0);
 
       if (sal.line == 0)
 	{
diff --git a/gdb/alpha-tdep.c b/gdb/alpha-tdep.c
index 59e01620ae6d..654cef2c2f23 100644
--- a/gdb/alpha-tdep.c
+++ b/gdb/alpha-tdep.c
@@ -637,7 +637,7 @@ alpha_after_prologue (CORE_ADDR pc)
   if (!find_pc_partial_function (pc, NULL, &func_addr, &func_end))
     return 0;
 
-  sal = find_pc_line (func_addr, 0);
+  sal = find_sal_for_pc (func_addr, 0);
   if (sal.end < func_end)
     return sal.end;
 
diff --git a/gdb/arc-tdep.c b/gdb/arc-tdep.c
index f5ae11c4ecb9..d7c908b1c6cb 100644
--- a/gdb/arc-tdep.c
+++ b/gdb/arc-tdep.c
@@ -1663,7 +1663,7 @@ arc_make_frame_cache (const frame_info_ptr &this_frame)
   CORE_ADDR entrypoint, prologue_end;
   if (find_pc_partial_function (block_addr, NULL, &entrypoint, &prologue_end))
     {
-      struct symtab_and_line sal = find_pc_line (entrypoint, 0);
+      struct symtab_and_line sal = find_sal_for_pc (entrypoint, 0);
       CORE_ADDR prev_pc = get_frame_pc (this_frame);
       if (sal.line == 0)
 	/* No line info so use current PC.  */
diff --git a/gdb/arm-linux-tdep.c b/gdb/arm-linux-tdep.c
index ff20ed88d466..200ba9d35af6 100644
--- a/gdb/arm-linux-tdep.c
+++ b/gdb/arm-linux-tdep.c
@@ -1035,7 +1035,7 @@ arm_linux_copy_svc (struct gdbarch *gdbarch, struct regcache *regs,
       gdb_assert (inferior_thread ()->control.step_resume_breakpoint
 		  == NULL);
 
-      sal = find_pc_line (return_to, 0);
+      sal = find_sal_for_pc (return_to, 0);
       sal.pc = return_to;
       sal.section = find_pc_overlay (return_to);
       sal.explicit_pc = 1;
diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c
index b03e67b1aa82..ad708e9bd45b 100644
--- a/gdb/arm-tdep.c
+++ b/gdb/arm-tdep.c
@@ -2238,7 +2238,7 @@ arm_scan_prologue (const frame_info_ptr &this_frame,
       /* One way to find the end of the prologue (which works well
 	 for unoptimized code) is to do the following:
 
-	    struct symtab_and_line sal = find_pc_line (prologue_start, 0);
+	    struct symtab_and_line sal = find_sal_for_pc (prologue_start, 0);
 
 	    if (sal.line == 0)
 	      prologue_end = prev_pc;
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index de98a2327d7e..a2c326b9f3fe 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -8537,7 +8537,7 @@ set_momentary_breakpoint_at_pc (struct gdbarch *gdbarch, CORE_ADDR pc,
 {
   struct symtab_and_line sal;
 
-  sal = find_pc_line (pc, 0);
+  sal = find_sal_for_pc (pc, 0);
   sal.pc = pc;
   sal.section = find_pc_overlay (pc);
   sal.explicit_pc = 1;
@@ -9009,11 +9009,11 @@ parse_breakpoint_sals (location_spec *locspec,
 		 corresponding to the last call to print_frame_info.
 		 Be sure to reinitialize LINE with NOTCURRENT == 0
 		 as the breakpoint line number is inappropriate otherwise.
-		 find_pc_line would adjust PC, re-set it back.  */
+		 find_sal_for_pc would adjust PC, re-set it back.  */
 	      symtab_and_line sal = get_last_displayed_sal ();
 	      CORE_ADDR pc = sal.pc;
 
-	      sal = find_pc_line (pc, 0);
+	      sal = find_sal_for_pc (pc, 0);
 
 	      /* "break" without arguments is equivalent to "break *PC"
 		 where PC is the last displayed codepoint's address.  So
@@ -9131,7 +9131,7 @@ decode_static_tracepoint_spec (const char **arg_p)
 
   for (const static_tracepoint_marker &marker : markers)
     {
-      symtab_and_line sal = find_pc_line (marker.address, 0);
+      symtab_and_line sal = find_sal_for_pc (marker.address, 0);
       sal.pc = marker.address;
       sals.push_back (sal);
    }
@@ -10979,7 +10979,7 @@ until_break_command (const char *arg, int from_tty, int anywhere)
       struct symtab_and_line sal2;
       struct gdbarch *caller_gdbarch;
 
-      sal2 = find_pc_line (frame_unwind_caller_pc (frame), 0);
+      sal2 = find_sal_for_pc (frame_unwind_caller_pc (frame), 0);
       sal2.pc = frame_unwind_caller_pc (frame);
       caller_gdbarch = frame_unwind_caller_arch (frame);
 
@@ -12890,7 +12890,7 @@ update_static_tracepoint (tracepoint *tp, struct symtab_and_line sal)
 		     "found at previous line number"),
 		   tp->number, tp->static_trace_marker_id.c_str ());
 
-	  symtab_and_line sal2 = find_pc_line (tpmarker->address, 0);
+	  symtab_and_line sal2 = find_sal_for_pc (tpmarker->address, 0);
 	  sym = find_symbol_for_pc_sect (tpmarker->address, NULL);
 	  uiout->text ("Now in ");
 	  if (sym)
@@ -13989,7 +13989,7 @@ insert_single_step_breakpoint (struct gdbarch *gdbarch,
 	= add_to_breakpoint_chain (std::move (b));
     }
 
-  sal = find_pc_line (pc, 0);
+  sal = find_sal_for_pc (pc, 0);
   sal.pc = pc;
   sal.section = find_pc_overlay (pc);
   sal.explicit_pc = 1;
diff --git a/gdb/c-exp.y b/gdb/c-exp.y
index 11f0d88bfc02..9f1cb1b2e2a4 100644
--- a/gdb/c-exp.y
+++ b/gdb/c-exp.y
@@ -3504,7 +3504,7 @@ c_parse (struct parser_state *par_state)
 
   if (par_state->expression_context_block)
     macro_scope
-      = sal_macro_scope (find_pc_line (par_state->expression_context_pc, 0));
+      = sal_macro_scope (find_sal_for_pc (par_state->expression_context_pc, 0));
   else
     macro_scope = default_macro_scope ();
   if (!macro_scope.is_valid ())
diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c
index 1007af46cbad..1eda034ff12e 100644
--- a/gdb/cli/cli-cmds.c
+++ b/gdb/cli/cli-cmds.c
@@ -1312,7 +1312,7 @@ list_command (const char *arg, int from_tty)
 		 selected frame, and finding the line associated to it.  */
 	      frame_info_ptr frame = get_selected_frame (nullptr);
 	      CORE_ADDR curr_pc = get_frame_pc (frame);
-	      cursal = find_pc_line (curr_pc, 0);
+	      cursal = find_sal_for_pc (curr_pc, 0);
 
 	      if (cursal.symtab == nullptr)
 		error
diff --git a/gdb/compile/compile-c-support.c b/gdb/compile/compile-c-support.c
index ac8888fb16bb..2ff1a9ff371c 100644
--- a/gdb/compile/compile-c-support.c
+++ b/gdb/compile/compile-c-support.c
@@ -188,7 +188,7 @@ write_macro_definitions (const struct block *block, CORE_ADDR pc,
   macro_scope scope;
 
   if (block != NULL)
-    scope = sal_macro_scope (find_pc_line (pc, 0));
+    scope = sal_macro_scope (find_sal_for_pc (pc, 0));
   else
     scope = default_macro_scope ();
   if (!scope.is_valid ())
diff --git a/gdb/cp-namespace.c b/gdb/cp-namespace.c
index 009ea4b4c96c..caece67d0bf7 100644
--- a/gdb/cp-namespace.c
+++ b/gdb/cp-namespace.c
@@ -416,7 +416,7 @@ cp_lookup_symbol_via_imports (const char *scope,
 
   /* Due to a GCC bug, we need to know the boundaries of the current block
      to know if a certain using directive is valid.  */
-  symtab_and_line boundary_sal = find_pc_line (block->end () - 1, 0);
+  symtab_and_line boundary_sal = find_sal_for_pc (block->end () - 1, 0);
 
   /* Go through the using directives.  If any of them add new names to
      the namespace we're searching in, see if we can find a match by
diff --git a/gdb/cris-tdep.c b/gdb/cris-tdep.c
index 9cfc1ebd6fb3..5c04c7cb8cc6 100644
--- a/gdb/cris-tdep.c
+++ b/gdb/cris-tdep.c
@@ -1343,7 +1343,7 @@ cris_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
      should the first assembly instruction of the first source line.  */
   if (find_pc_partial_function (pc, NULL, &func_addr, &func_end))
     {
-      sal = find_pc_line (func_addr, 0);
+      sal = find_sal_for_pc (func_addr, 0);
       if (sal.end > 0 && sal.end < func_end)
 	return sal.end;
     }
diff --git a/gdb/disasm.c b/gdb/disasm.c
index 73b094b11732..b2e795d5c69c 100644
--- a/gdb/disasm.c
+++ b/gdb/disasm.c
@@ -594,7 +594,7 @@ do_mixed_source_and_assembly_deprecated
     {
       mle[newlines].line = le[i].line;
       mle[newlines].start_pc = le[i].pc (objfile);
-      sal = find_pc_line (le[i].pc (objfile), 0);
+      sal = find_sal_for_pc (le[i].pc (objfile), 0);
       mle[newlines].end_pc = sal.end;
       newlines++;
     }
@@ -712,7 +712,7 @@ do_mixed_source_and_assembly (struct gdbarch *gdbarch,
 
   /* The prologue may be empty, but there may still be a line number entry
      for the opening brace which is distinct from the first line of code.
-     If the prologue has been eliminated find_pc_line may return the source
+     If the prologue has been eliminated find_sal_for_pc may return the source
      line after the opening brace.  We still want to print this opening brace.
      first_le is used to implement this.  */
 
@@ -733,7 +733,7 @@ do_mixed_source_and_assembly (struct gdbarch *gdbarch,
       struct symtab_and_line sal;
       int length;
 
-      sal = find_pc_line (pc, 0);
+      sal = find_sal_for_pc (pc, 0);
       length = gdb_insn_length (gdbarch, pc);
       pc += length;
 
@@ -782,7 +782,7 @@ do_mixed_source_and_assembly (struct gdbarch *gdbarch,
       int end_preceding_line_to_display = 0;
       int new_source_line = 0;
 
-      sal = find_pc_line (pc, 0);
+      sal = find_sal_for_pc (pc, 0);
 
       if (sal.symtab != last_symtab)
 	{
diff --git a/gdb/elfread.c b/gdb/elfread.c
index 152576d3523a..20c124cf14f4 100644
--- a/gdb/elfread.c
+++ b/gdb/elfread.c
@@ -973,7 +973,7 @@ elf_gnu_ifunc_resolver_stop (code_breakpoint *b)
 
   if (b_return == b)
     {
-      /* No need to call find_pc_line for symbols resolving as this is only
+      /* No need to call find_sal_for_pc for symbols resolving as this is only
 	 a helper breakpoint never shown to the user.  */
 
       symtab_and_line sal;
diff --git a/gdb/frame.c b/gdb/frame.c
index 4162a35b7533..b84e30c23903 100644
--- a/gdb/frame.c
+++ b/gdb/frame.c
@@ -2916,7 +2916,7 @@ find_frame_sal (const frame_info_ptr &frame)
     return {};
 
   notcurrent = (*pc != get_frame_address_in_block (frame));
-  return find_pc_line (*pc, notcurrent);
+  return find_sal_for_pc (*pc, notcurrent);
 }
 
 /* Per "frame.h", return the ``address'' of the frame.  Code should
diff --git a/gdb/frv-tdep.c b/gdb/frv-tdep.c
index b2d6e1a1eabf..9bd719cd2fff 100644
--- a/gdb/frv-tdep.c
+++ b/gdb/frv-tdep.c
@@ -986,7 +986,7 @@ frv_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
     {
       struct symtab_and_line sal;
 
-      sal = find_pc_line (func_addr, 0);
+      sal = find_sal_for_pc (func_addr, 0);
 
       if (sal.line != 0 && sal.end < func_end)
 	{
diff --git a/gdb/ft32-tdep.c b/gdb/ft32-tdep.c
index 33849290bb0b..860c98370325 100644
--- a/gdb/ft32-tdep.c
+++ b/gdb/ft32-tdep.c
@@ -303,7 +303,7 @@ ft32_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
 	  /* Don't use line number debug info for assembly source files.  */
 	  if ((sym != NULL) && sym->language () != language_asm)
 	    {
-	      sal = find_pc_line (func_addr, 0);
+	      sal = find_sal_for_pc (func_addr, 0);
 	      if (sal.end && sal.end < func_end)
 		{
 		  /* Found a line number, use it as end of prologue.  */
diff --git a/gdb/guile/scm-symtab.c b/gdb/guile/scm-symtab.c
index e337a4b5927c..09887a41be07 100644
--- a/gdb/guile/scm-symtab.c
+++ b/gdb/guile/scm-symtab.c
@@ -592,7 +592,7 @@ gdbscm_find_pc_line (SCM pc_scm)
     {
       CORE_ADDR pc = (CORE_ADDR) pc_ull;
 
-      sal = find_pc_line (pc, 0);
+      sal = find_sal_for_pc (pc, 0);
     }
   catch (const gdb_exception &except)
     {
diff --git a/gdb/h8300-tdep.c b/gdb/h8300-tdep.c
index 15b0002b8d28..b088b2a342cb 100644
--- a/gdb/h8300-tdep.c
+++ b/gdb/h8300-tdep.c
@@ -536,7 +536,7 @@ h8300_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
       struct h8300_frame_cache cache;
 
       /* Found a function.  */
-      sal = find_pc_line (func_addr, 0);
+      sal = find_sal_for_pc (func_addr, 0);
       if (sal.end && sal.end < func_end)
 	/* Found a line number, use it as end of prologue.  */
 	return sal.end;
diff --git a/gdb/hppa-tdep.c b/gdb/hppa-tdep.c
index acd002863b31..230e9beba39c 100644
--- a/gdb/hppa-tdep.c
+++ b/gdb/hppa-tdep.c
@@ -1774,7 +1774,7 @@ after_prologue (CORE_ADDR pc)
     return 0;
 
   /* Get the line associated with FUNC_ADDR.  */
-  sal = find_pc_line (func_addr, 0);
+  sal = find_sal_for_pc (func_addr, 0);
 
   /* There are only two cases to consider.  First, the end of the source line
      is within the function bounds.  In that case we return the end of the
diff --git a/gdb/ia64-tdep.c b/gdb/ia64-tdep.c
index 370973a652f5..a626cb22fbdf 100644
--- a/gdb/ia64-tdep.c
+++ b/gdb/ia64-tdep.c
@@ -1283,7 +1283,7 @@ refine_prologue_limit (CORE_ADDR pc, CORE_ADDR lim_pc, int *trust_limit)
   /* Start off not trusting the limit.  */
   *trust_limit = 0;
 
-  prologue_sal = find_pc_line (pc, 0);
+  prologue_sal = find_sal_for_pc (pc, 0);
   if (prologue_sal.line != 0)
     {
       int i;
@@ -1302,7 +1302,7 @@ refine_prologue_limit (CORE_ADDR pc, CORE_ADDR lim_pc, int *trust_limit)
 	{
 	  struct symtab_and_line sal;
 
-	  sal = find_pc_line (addr, 0);
+	  sal = find_sal_for_pc (addr, 0);
 	  if (sal.line == 0)
 	    break;
 	  if (sal.line <= prologue_sal.line 
diff --git a/gdb/infcmd.c b/gdb/infcmd.c
index ff49c2e29253..220938221add 100644
--- a/gdb/infcmd.c
+++ b/gdb/infcmd.c
@@ -970,9 +970,9 @@ prepare_one_step (thread_info *tp, struct step_command_fsm *sm)
 
 	  if (execution_direction == EXEC_REVERSE)
 	    {
-	      symtab_and_line sal = find_pc_line (pc, 0);
+	      symtab_and_line sal = find_sal_for_pc (pc, 0);
 	      symtab_and_line sal_start
-		= find_pc_line (tp->control.step_range_start, 0);
+		= find_sal_for_pc (tp->control.step_range_start, 0);
 
 	      if (sal.line == sal_start.line)
 		/* Executing in reverse, the step_range_start address is in
@@ -1368,7 +1368,7 @@ until_next_command (int from_tty)
     }
   else
     {
-      sal = find_pc_line (pc, 0);
+      sal = find_sal_for_pc (pc, 0);
 
       tp->control.step_range_start = func->value_block ()->entry_pc ();
       tp->control.step_range_end = sal.end;
@@ -1669,7 +1669,7 @@ finish_backward (struct finish_command_fsm *sm)
   if (find_pc_partial_function (pc, nullptr, &func_addr, nullptr) == 0)
     error (_("Cannot find bounds of current function"));
 
-  sal = find_pc_line (func_addr, 0);
+  sal = find_sal_for_pc (func_addr, 0);
   alt_entry_point = sal.pc;
   entry_point = alt_entry_point;
 
@@ -1728,7 +1728,7 @@ finish_forward (struct finish_command_fsm *sm, const frame_info_ptr &frame)
   struct symtab_and_line sal;
   struct thread_info *tp = inferior_thread ();
 
-  sal = find_pc_line (get_frame_pc (frame), 0);
+  sal = find_sal_for_pc (get_frame_pc (frame), 0);
   sal.pc = get_frame_pc (frame);
 
   sm->breakpoint = set_momentary_breakpoint (gdbarch, sal,
diff --git a/gdb/infrun.c b/gdb/infrun.c
index 959393d3e5e7..84c1545f06bf 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -7969,7 +7969,7 @@ process_event_stop_test (struct execution_control_state *ecs)
       {
 	struct symtab_and_line tmp_sal;
 
-	tmp_sal = find_pc_line (ecs->stop_func_start, 0);
+	tmp_sal = find_sal_for_pc (ecs->stop_func_start, 0);
 	if (tmp_sal.line != 0
 	    && !function_name_is_marked_for_skip (ecs->stop_func_name,
 						  tmp_sal)
@@ -8058,7 +8058,7 @@ process_event_stop_test (struct execution_control_state *ecs)
      stack of inlined frames, even if GDB actually believes that it is in a
      more outer frame.  This is checked for below by calls to
      inline_skipped_frames.  */
-  stop_pc_sal = find_pc_line (ecs->event_thread->stop_pc (), 0);
+  stop_pc_sal = find_sal_for_pc (ecs->event_thread->stop_pc (), 0);
 
   /* NOTE: tausq/2004-05-24: This if block used to be done before all
      the trampoline processing logic, however, there are some trampolines 
@@ -8676,7 +8676,7 @@ handle_step_into_function (struct gdbarch *gdbarch,
     ecs->stop_func_start
       = gdbarch_skip_prologue_noexcept (gdbarch, ecs->stop_func_start);
 
-  symtab_and_line stop_func_sal = find_pc_line (ecs->stop_func_start, 0);
+  symtab_and_line stop_func_sal = find_sal_for_pc (ecs->stop_func_start, 0);
   /* Use the step_resume_break to step until the end of the prologue,
      even if that involves jumps (as it seems to on the vax under
      4.2).  */
@@ -8755,7 +8755,7 @@ handle_step_into_function_backward (struct gdbarch *gdbarch,
     ecs->stop_func_start
       = gdbarch_skip_prologue_noexcept (gdbarch, ecs->stop_func_start);
 
-  stop_func_sal = find_pc_line (ecs->event_thread->stop_pc (), 0);
+  stop_func_sal = find_sal_for_pc (ecs->event_thread->stop_pc (), 0);
 
   /* OK, we're just going to keep stepping here.  */
   if (stop_func_sal.pc == ecs->event_thread->stop_pc ())
diff --git a/gdb/iq2000-tdep.c b/gdb/iq2000-tdep.c
index 58a4dfbdb835..782f8b729c81 100644
--- a/gdb/iq2000-tdep.c
+++ b/gdb/iq2000-tdep.c
@@ -170,7 +170,7 @@ iq2000_register_name (struct gdbarch *gdbarch, int regnum)
 static struct symtab_and_line
 find_last_line_symbol (CORE_ADDR start, CORE_ADDR end, int notcurrent)
 {
-  struct symtab_and_line sal = find_pc_line (start, notcurrent);
+  struct symtab_and_line sal = find_sal_for_pc (start, notcurrent);
   struct symtab_and_line best_sal = sal;
 
   if (sal.pc == 0 || sal.line == 0 || sal.end == 0)
@@ -180,7 +180,7 @@ find_last_line_symbol (CORE_ADDR start, CORE_ADDR end, int notcurrent)
     {
       if (sal.line && sal.line <= best_sal.line)
 	best_sal = sal;
-      sal = find_pc_line (sal.end, notcurrent);
+      sal = find_sal_for_pc (sal.end, notcurrent);
     }
   while (sal.pc && sal.pc < end);
 
@@ -343,7 +343,7 @@ iq2000_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
       struct iq2000_frame_cache cache;
 
       /* Found a function.  */
-      sal = find_pc_line (func_addr, 0);
+      sal = find_sal_for_pc (func_addr, 0);
       if (sal.end && sal.end < func_end)
 	/* Found a line number, use it as end of prologue.  */
 	return sal.end;
diff --git a/gdb/linespec.c b/gdb/linespec.c
index b6fe4e170bf3..05f676ee38d4 100644
--- a/gdb/linespec.c
+++ b/gdb/linespec.c
@@ -2161,7 +2161,7 @@ static std::vector<symtab_and_line>
 convert_address_location_to_sals (struct linespec_state *self,
 				  CORE_ADDR address)
 {
-  symtab_and_line sal = find_pc_line (address, 0);
+  symtab_and_line sal = find_sal_for_pc (address, 0);
   sal.pc = address;
   sal.section = find_pc_overlay (address);
   sal.explicit_pc = 1;
diff --git a/gdb/linux-fork.c b/gdb/linux-fork.c
index 48732b70ec35..9e8e1a1f6a94 100644
--- a/gdb/linux-fork.c
+++ b/gdb/linux-fork.c
@@ -904,7 +904,7 @@ print_checkpoints (struct ui_out *uiout, inferior *req_inf, fork_info *req_fi)
 		   : fi.pc);
 	      uiout->field_core_addr ("addr", get_current_arch (), pc);
 
-	      symtab_and_line sal = find_pc_line (pc, 0);
+	      symtab_and_line sal = find_sal_for_pc (pc, 0);
 	      if (sal.symtab)
 		{
 		  uiout->text (", file ");
diff --git a/gdb/loongarch-tdep.c b/gdb/loongarch-tdep.c
index e94b88bc010a..5e09125e400c 100644
--- a/gdb/loongarch-tdep.c
+++ b/gdb/loongarch-tdep.c
@@ -595,7 +595,7 @@ loongarch_analyze_prologue (const frame_info_ptr &this_frame,
   if (find_pc_partial_function (block_addr, NULL, &prologue_start,
 				&prologue_end))
     {
-      struct symtab_and_line sal = find_pc_line (prologue_start, 0);
+      struct symtab_and_line sal = find_sal_for_pc (prologue_start, 0);
 
       if (sal.line == 0)
 	{
diff --git a/gdb/m32r-tdep.c b/gdb/m32r-tdep.c
index 4ac08fdd6c80..ae233a1e94d5 100644
--- a/gdb/m32r-tdep.c
+++ b/gdb/m32r-tdep.c
@@ -463,7 +463,7 @@ m32r_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
 
   if (find_pc_partial_function (pc, NULL, &func_addr, &func_end))
     {
-      sal = find_pc_line (func_addr, 0);
+      sal = find_sal_for_pc (func_addr, 0);
 
       if (sal.line != 0 && sal.end <= func_end)
 	{
diff --git a/gdb/m68hc11-tdep.c b/gdb/m68hc11-tdep.c
index 5389fee9ffd0..a61a49e43bb3 100644
--- a/gdb/m68hc11-tdep.c
+++ b/gdb/m68hc11-tdep.c
@@ -758,7 +758,7 @@ m68hc11_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
      first source line.  */
   if (find_pc_partial_function (pc, NULL, &func_addr, &func_end))
     {
-      sal = find_pc_line (func_addr, 0);
+      sal = find_sal_for_pc (func_addr, 0);
       if (sal.end && sal.end < func_end)
 	return sal.end;
     }
diff --git a/gdb/macroscope.c b/gdb/macroscope.c
index a8b78c9906c9..563ef9931b39 100644
--- a/gdb/macroscope.c
+++ b/gdb/macroscope.c
@@ -102,7 +102,7 @@ default_macro_scope ()
   /* If there's a selected frame, use its PC.  */
   frame = deprecated_safe_get_selected_frame ();
   if (frame && (pc = get_frame_pc_if_available (frame)))
-    sal = find_pc_line (*pc, 0);
+    sal = find_sal_for_pc (*pc, 0);
 
   /* Fall back to the current listing position.  */
   else
diff --git a/gdb/microblaze-tdep.c b/gdb/microblaze-tdep.c
index 404e4cde2ad9..3953a96a4e12 100644
--- a/gdb/microblaze-tdep.c
+++ b/gdb/microblaze-tdep.c
@@ -399,7 +399,7 @@ microblaze_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR start_pc)
      Always analyze the prologue.  */
   if (find_pc_partial_function (start_pc, NULL, &func_start, &func_end))
     {
-      sal = find_pc_line (func_start, 0);
+      sal = find_sal_for_pc (func_start, 0);
 
       if (sal.end < func_end
 	  && start_pc <= sal.end)
diff --git a/gdb/moxie-tdep.c b/gdb/moxie-tdep.c
index bb4887799bd3..7aa9b0536d5f 100644
--- a/gdb/moxie-tdep.c
+++ b/gdb/moxie-tdep.c
@@ -232,7 +232,7 @@ moxie_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
 	     files.  */
 	  if (sym && sym->language () != language_asm)
 	    {
-	      sal = find_pc_line (func_addr, 0);
+	      sal = find_sal_for_pc (func_addr, 0);
 	      if (sal.end && sal.end < func_end)
 		{
 		  /* Found a line number, use it as end of
diff --git a/gdb/namespace.c b/gdb/namespace.c
index 52eb1eae3756..ace854251319 100644
--- a/gdb/namespace.c
+++ b/gdb/namespace.c
@@ -112,7 +112,7 @@ using_direct::valid_line (unsigned int boundary) const
   try
     {
       CORE_ADDR curr_pc = get_frame_pc (get_selected_frame (nullptr));
-      symtab_and_line curr_sal = find_pc_line (curr_pc, 0);
+      symtab_and_line curr_sal = find_sal_for_pc (curr_pc, 0);
       return (decl_line <= curr_sal.line)
 	     || (decl_line >= boundary);
     }
diff --git a/gdb/or1k-tdep.c b/gdb/or1k-tdep.c
index 2db207dafdd1..442bdaf9fab9 100644
--- a/gdb/or1k-tdep.c
+++ b/gdb/or1k-tdep.c
@@ -467,7 +467,7 @@ or1k_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
 
       if (0 != prologue_end)
 	{
-	  struct symtab_and_line prologue_sal = find_pc_line (start_pc, 0);
+	  struct symtab_and_line prologue_sal = find_sal_for_pc (start_pc, 0);
 	  struct compunit_symtab *compunit
 	    = prologue_sal.symtab->compunit ();
 	  const char *debug_format = compunit->debugformat ();
diff --git a/gdb/python/py-progspace.c b/gdb/python/py-progspace.c
index a0afc7b7dba3..7ca9d88bbd20 100644
--- a/gdb/python/py-progspace.c
+++ b/gdb/python/py-progspace.c
@@ -559,7 +559,7 @@ pspy_find_pc_line (PyObject *o, PyObject *args)
 
       set_current_program_space (self->pspace);
 
-      sal = find_pc_line (pc, 0);
+      sal = find_sal_for_pc (pc, 0);
       result = symtab_and_line_to_sal_object (sal);
     }
   catch (const gdb_exception &except)
diff --git a/gdb/python/py-record-btrace.c b/gdb/python/py-record-btrace.c
index 620f033e679e..7acf70ec83b8 100644
--- a/gdb/python/py-record-btrace.c
+++ b/gdb/python/py-record-btrace.c
@@ -213,7 +213,7 @@ recpy_bt_insn_sal (PyObject *self, void *closure)
 
   try
     {
-      result = symtab_and_line_to_sal_object (find_pc_line (insn->pc, 0));
+      result = symtab_and_line_to_sal_object (find_sal_for_pc (insn->pc, 0));
     }
   catch (const gdb_exception &except)
     {
diff --git a/gdb/record-btrace.c b/gdb/record-btrace.c
index 51121817da1c..cc9365d2fa1b 100644
--- a/gdb/record-btrace.c
+++ b/gdb/record-btrace.c
@@ -1093,7 +1093,7 @@ btrace_compute_src_line_range (const struct btrace_function *bfun,
     {
       struct symtab_and_line sal;
 
-      sal = find_pc_line (insn.pc, 0);
+      sal = find_sal_for_pc (insn.pc, 0);
       if (sal.symtab != symtab || sal.line == 0)
 	continue;
 
diff --git a/gdb/reverse.c b/gdb/reverse.c
index dc35bca70faa..376435deab2c 100644
--- a/gdb/reverse.c
+++ b/gdb/reverse.c
@@ -125,7 +125,7 @@ save_bookmark_command (const char *args, int from_tty)
   bookmark &b = all_bookmarks.emplace_back ();
   b.number = ++bookmark_count;
   b.pc = regcache_read_pc (regcache);
-  b.sal = find_pc_line (b.pc, 0);
+  b.sal = find_sal_for_pc (b.pc, 0);
   b.sal.pspace = get_frame_program_space (get_current_frame ());
   b.opaque_data.reset (bookmark_id);
 
diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c
index 75079b9e211c..7c8a6f70ef63 100644
--- a/gdb/rs6000-tdep.c
+++ b/gdb/rs6000-tdep.c
@@ -1827,8 +1827,8 @@ skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc, CORE_ADDR lim_pc,
 	     associated with the prologue.  */
 	  if ((pc - orig_pc) > 8)
 	    {
-	      struct symtab_and_line prologue_sal = find_pc_line (orig_pc, 0);
-	      struct symtab_and_line this_sal = find_pc_line (pc, 0);
+	      struct symtab_and_line prologue_sal = find_sal_for_pc (orig_pc, 0);
+	      struct symtab_and_line this_sal = find_sal_for_pc (pc, 0);
 
 	      if ((prologue_sal.line == 0)
 		  || (prologue_sal.line != this_sal.line))
diff --git a/gdb/sparc64-tdep.c b/gdb/sparc64-tdep.c
index 68464212802f..a16f5c4111a9 100644
--- a/gdb/sparc64-tdep.c
+++ b/gdb/sparc64-tdep.c
@@ -1048,7 +1048,7 @@ sparc64_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR start_pc)
      using the debugging information.  */
   if (find_pc_partial_function (start_pc, NULL, &func_start, &func_end))
     {
-      sal = find_pc_line (func_start, 0);
+      sal = find_sal_for_pc (func_start, 0);
 
       if (sal.end < func_end
 	  && start_pc <= sal.end)
diff --git a/gdb/symtab.c b/gdb/symtab.c
index f3377ff2a7eb..f36d5b262955 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -3020,7 +3020,7 @@ find_pc_sect_line (CORE_ADDR pc, struct obj_section *section, int notcurrent)
 	      internal_error (_("Infinite recursion detected in find_pc_sect_line;"
 		  "please file a bug report"));
 
-	    return find_pc_line (mfunsym.value_address (), 0);
+	    return find_sal_for_pc (mfunsym.value_address (), 0);
 	  }
       }
 
@@ -3175,7 +3175,7 @@ find_pc_sect_line (CORE_ADDR pc, struct obj_section *section, int notcurrent)
 /* Backward compatibility (no section).  */
 
 struct symtab_and_line
-find_pc_line (CORE_ADDR pc, int notcurrent)
+find_sal_for_pc (CORE_ADDR pc, int notcurrent)
 {
   struct obj_section *section;
 
@@ -3213,12 +3213,12 @@ sal_line_symtab_matches_p (const symtab_and_line &sal1,
 std::optional<CORE_ADDR>
 find_line_range_start (CORE_ADDR pc)
 {
-  struct symtab_and_line current_sal = find_pc_line (pc, 0);
+  struct symtab_and_line current_sal = find_sal_for_pc (pc, 0);
 
   if (current_sal.line == 0)
     return {};
 
-  struct symtab_and_line prev_sal = find_pc_line (current_sal.pc - 1, 0);
+  struct symtab_and_line prev_sal = find_sal_for_pc (current_sal.pc - 1, 0);
 
   /* If the previous entry is for a different line, that means we are already
      at the entry with the start PC for this line.  */
@@ -3233,7 +3233,7 @@ find_line_range_start (CORE_ADDR pc)
     {
       prev_pc = prev_sal.pc;
 
-      prev_sal = find_pc_line (prev_pc - 1, 0);
+      prev_sal = find_sal_for_pc (prev_pc - 1, 0);
 
       /* Did we notice a line change?  If so, we are done searching.  */
       if (!sal_line_symtab_matches_p (prev_sal, current_sal))
@@ -3250,9 +3250,9 @@ find_pc_line_symtab (CORE_ADDR pc)
 {
   struct symtab_and_line sal;
 
-  /* This always passes zero for NOTCURRENT to find_pc_line.
+  /* This always passes zero for NOTCURRENT to find_sal_for_pc.
      There are currently no callers that ever pass non-zero.  */
-  sal = find_pc_line (pc, 0);
+  sal = find_sal_for_pc (pc, 0);
   return sal.symtab;
 }
 \f
@@ -3509,7 +3509,7 @@ find_line_pc_range_for_pc (CORE_ADDR pc, CORE_ADDR *startptr, CORE_ADDR *endptr)
 {
   struct symtab_and_line sal;
 
-  sal = find_pc_line (pc, 0);
+  sal = find_sal_for_pc (pc, 0);
   *startptr = sal.pc;
   *endptr = sal.end;
   return sal.symtab != 0;
@@ -3642,7 +3642,7 @@ skip_prologue_using_linetable (CORE_ADDR func_addr)
   if (!find_pc_partial_function (func_addr, nullptr, &start_pc, &end_pc))
     return {};
 
-  const struct symtab_and_line prologue_sal = find_pc_line (start_pc, 0);
+  const struct symtab_and_line prologue_sal = find_sal_for_pc (start_pc, 0);
   if (prologue_sal.symtab != nullptr
       && prologue_sal.symtab->language () != language_asm)
     {
@@ -3888,7 +3888,7 @@ skip_prologue_using_sal (struct gdbarch *gdbarch, CORE_ADDR func_addr)
   find_pc_partial_function (func_addr, NULL, &start_pc, &end_pc);
   start_pc += gdbarch_deprecated_function_start_offset (gdbarch);
 
-  prologue_sal = find_pc_line (start_pc, 0);
+  prologue_sal = find_sal_for_pc (start_pc, 0);
   if (prologue_sal.line != 0)
     {
       /* For languages other than assembly, treat two consecutive line
@@ -3927,7 +3927,7 @@ skip_prologue_using_sal (struct gdbarch *gdbarch, CORE_ADDR func_addr)
 	{
 	  struct symtab_and_line sal;
 
-	  sal = find_pc_line (prologue_sal.end, 0);
+	  sal = find_sal_for_pc (prologue_sal.end, 0);
 	  if (sal.line == 0)
 	    break;
 	  /* Assume that a consecutive SAL for the same (or larger)
@@ -3994,10 +3994,10 @@ find_epilogue_using_linetable (CORE_ADDR func_addr)
      The lines of a function can be described by several line tables in case
      there are different files involved.  There's a corner case where a
      function epilogue is in a different file than a function start, and using
-     start_pc as argument to find_pc_line will mean we won't find the
+     start_pc as argument to find_sal_for_pc will mean we won't find the
      epilogue.  Instead, use "end_pc - 1" to maximize our chances of picking
      the line table containing an epilogue.  */
-  const struct symtab_and_line sal = find_pc_line (end_pc - 1, 0);
+  const struct symtab_and_line sal = find_sal_for_pc (end_pc - 1, 0);
   if (sal.symtab != nullptr && sal.symtab->language () != language_asm)
     {
       struct objfile *objfile = sal.symtab->compunit ()->objfile ();
@@ -4032,7 +4032,7 @@ find_epilogue_using_linetable (CORE_ADDR func_addr)
 	     This can happen when the linetable doesn't describe the full
 	     extent of the function.  This can be triggered with:
 	     - compiler-generated debug info, in the cornercase that the pc
-	       with which we call find_pc_line resides in a different file
+	       with which we call find_sal_for_pc resides in a different file
 	       than unrel_end, or
 	     - invalid dwarf assembly debug info.
 	     In the former case, there's no point in iterating further, simply
diff --git a/gdb/symtab.h b/gdb/symtab.h
index 1d419dd16e68..9f6a6c361221 100644
--- a/gdb/symtab.h
+++ b/gdb/symtab.h
@@ -2405,7 +2405,7 @@ struct symtab_and_line
 /* Given a pc value, return line number it is in.  Second arg nonzero means
    if pc is on the boundary use the previous statement's line number.  */
 
-extern struct symtab_and_line find_pc_line (CORE_ADDR, int);
+extern struct symtab_and_line find_sal_for_pc (CORE_ADDR, int);
 
 /* Same function, but specify a section as well as an address.  */
 
@@ -2428,7 +2428,7 @@ extern struct symtab_and_line find_pc_sect_line (CORE_ADDR,
 
 extern std::optional<CORE_ADDR> find_line_range_start (CORE_ADDR pc);
 
-/* Wrapper around find_pc_line to just return the symtab.  */
+/* Wrapper around find_sal_for_pc to just return the symtab.  */
 
 extern struct symtab *find_pc_line_symtab (CORE_ADDR);
 
diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c
index ce5418b87913..c0db7c8e6fa4 100644
--- a/gdb/tracepoint.c
+++ b/gdb/tracepoint.c
@@ -216,7 +216,7 @@ set_traceframe_context (const frame_info_ptr &trace_frame)
   if (trace_frame != NULL
       && (trace_pc = get_frame_pc_if_available (trace_frame)))
     {
-      traceframe_sal = find_pc_line (*trace_pc, 0);
+      traceframe_sal = find_sal_for_pc (*trace_pc, 0);
       traceframe_fun = find_symbol_for_pc (*trace_pc);
 
       /* Save linenumber as "$trace_line", a debugger variable visible to
@@ -2334,7 +2334,7 @@ tfind_line_command (const char *args, int from_tty)
   symtab_and_line sal;
   if (args == 0 || *args == 0)
     {
-      sal = find_pc_line (get_frame_pc (get_current_frame ()), 0);
+      sal = find_sal_for_pc (get_frame_pc (get_current_frame ()), 0);
     }
   else
     {
@@ -2360,7 +2360,7 @@ tfind_line_command (const char *args, int from_tty)
 	  print_address (get_current_arch (), start_pc, gdb_stdout);
 	  gdb_stdout->wrap_here (2);
 	  gdb_printf (" but contains no code.\n");
-	  sal = find_pc_line (start_pc, 0);
+	  sal = find_sal_for_pc (start_pc, 0);
 	  if (sal.line > 0
 	      && find_line_pc_range (sal, &start_pc, &end_pc)
 	      && start_pc != end_pc)
@@ -3617,7 +3617,7 @@ print_one_static_tracepoint_marker (int count,
 
   uiout->field_core_addr ("addr", marker.gdbarch, marker.address);
 
-  sal = find_pc_line (marker.address, 0);
+  sal = find_sal_for_pc (marker.address, 0);
   sym = find_symbol_for_pc_sect (marker.address, NULL);
   if (sym)
     {
diff --git a/gdb/tui/tui-winsource.c b/gdb/tui/tui-winsource.c
index 2fe4914f2706..e66c4596586e 100644
--- a/gdb/tui/tui-winsource.c
+++ b/gdb/tui/tui-winsource.c
@@ -182,7 +182,7 @@ tui_source_window_base::update_source_window_with_addr (struct gdbarch *gdbarch,
 {
   struct symtab_and_line sal {};
   if (addr != 0)
-    sal = find_pc_line (addr, 0);
+    sal = find_sal_for_pc (addr, 0);
 
   maybe_update (gdbarch, sal);
 }
@@ -194,7 +194,7 @@ tui_update_source_windows_with_addr (struct gdbarch *gdbarch, CORE_ADDR addr)
 {
   struct symtab_and_line sal {};
   if (addr != 0)
-    sal = find_pc_line (addr, 0);
+    sal = find_sal_for_pc (addr, 0);
 
   for (struct tui_source_window_base *win_info : tui_source_windows ())
     win_info->update_source_window (gdbarch, sal);
@@ -493,7 +493,7 @@ tui_source_window_base::refill ()
 	{
 	  frame_info_ptr fi = deprecated_safe_get_selected_frame ();
 	  if (fi != nullptr)
-	    sal = find_pc_line (get_frame_pc (fi), 0);
+	    sal = find_sal_for_pc (get_frame_pc (fi), 0);
 	}
     }
 
diff --git a/gdb/v850-tdep.c b/gdb/v850-tdep.c
index d592344e2e3e..0b77cf38d3fd 100644
--- a/gdb/v850-tdep.c
+++ b/gdb/v850-tdep.c
@@ -952,7 +952,7 @@ v850_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
     {
       struct symtab_and_line sal;
 
-      sal = find_pc_line (func_addr, 0);
+      sal = find_sal_for_pc (func_addr, 0);
       if (sal.line != 0 && sal.end < func_end)
 	return sal.end;
 
diff --git a/gdb/xstormy16-tdep.c b/gdb/xstormy16-tdep.c
index b63dfa04be00..64aa16f5a13a 100644
--- a/gdb/xstormy16-tdep.c
+++ b/gdb/xstormy16-tdep.c
@@ -428,7 +428,7 @@ xstormy16_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
       /* Don't use line number debug info for assembly source files.  */
       if (sym && sym->language () != language_asm)
 	{
-	  sal = find_pc_line (func_addr, 0);
+	  sal = find_sal_for_pc (func_addr, 0);
 	  if (sal.end && sal.end < func_end)
 	    {
 	      /* Found a line number, use it as end of prologue.  */
diff --git a/gdb/xtensa-tdep.c b/gdb/xtensa-tdep.c
index 8a2f129c7580..19bec106364a 100644
--- a/gdb/xtensa-tdep.c
+++ b/gdb/xtensa-tdep.c
@@ -2378,7 +2378,7 @@ call0_analyze_prologue (struct gdbarch *gdbarch,
   end_pc = 0;
 
   /* Find out, if we have an information about the prologue from DWARF.  */
-  prologue_sal = find_pc_line (start, 0);
+  prologue_sal = find_sal_for_pc (start, 0);
   if (prologue_sal.line != 0) /* Found debug info.  */
     body_pc = prologue_sal.end;
 
@@ -3000,7 +3000,7 @@ xtensa_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR start_pc)
 
  /* Try to find first body line from debug info.  */
 
-  prologue_sal = find_pc_line (start_pc, 0);
+  prologue_sal = find_sal_for_pc (start_pc, 0);
   if (prologue_sal.line != 0) /* Found debug info.  */
     {
       /* In Call0,  it is possible to have a function with only one instruction
diff --git a/gdb/z80-tdep.c b/gdb/z80-tdep.c
index 9ae8b7a5857d..31d319392ddb 100644
--- a/gdb/z80-tdep.c
+++ b/gdb/z80-tdep.c
@@ -494,7 +494,7 @@ z80_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
 
   if (prologue_end != 0)
     {
-      struct symtab_and_line prologue_sal = find_pc_line (func_addr, 0);
+      struct symtab_and_line prologue_sal = find_sal_for_pc (func_addr, 0);
       struct compunit_symtab *compunit = prologue_sal.symtab->compunit ();
       const char *debug_format = compunit->debugformat ();
 
-- 
2.51.0


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH 08/10] gdb: rename find_pc_sect_line -> find_sal_for_pc_sect
  2025-10-16  0:07 [PATCH 00/10] Rename some symtab find functions simon.marchi
                   ` (6 preceding siblings ...)
  2025-10-16  0:08 ` [PATCH 07/10] gdb: rename find_pc_line -> find_sal_for_pc simon.marchi
@ 2025-10-16  0:08 ` simon.marchi
  2025-10-16  0:08 ` [PATCH 09/10] gdb: rename find_pc_line_symtab -> find_symtab_for_pc simon.marchi
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 13+ messages in thread
From: simon.marchi @ 2025-10-16  0:08 UTC (permalink / raw)
  To: gdb-patches; +Cc: Simon Marchi

From: Simon Marchi <simon.marchi@polymtl.ca>

Change-Id: I9c2a72de57a4ea9c316fc949db4fb0bf7f78eb4b
---
 gdb/amd64-tdep.c |  4 ++--
 gdb/linespec.c   |  2 +-
 gdb/printcmd.c   |  4 ++--
 gdb/symtab.c     | 22 +++++++++++-----------
 gdb/symtab.h     |  4 ++--
 5 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/gdb/amd64-tdep.c b/gdb/amd64-tdep.c
index b1021c071c55..b670586050b2 100755
--- a/gdb/amd64-tdep.c
+++ b/gdb/amd64-tdep.c
@@ -2784,14 +2784,14 @@ amd64_skip_xmm_prologue (CORE_ADDR pc, CORE_ADDR start_pc)
   if (pc == start_pc)
     return pc;
 
-  start_pc_sal = find_pc_sect_line (start_pc, NULL, 0);
+  start_pc_sal = find_sal_for_pc_sect (start_pc, NULL, 0);
   if (start_pc_sal.symtab == NULL
       || producer_is_gcc_ge_4 (start_pc_sal.symtab->compunit ()
 			       ->producer ()) < 6
       || start_pc_sal.pc != start_pc || pc >= start_pc_sal.end)
     return pc;
 
-  next_sal = find_pc_sect_line (start_pc_sal.end, NULL, 0);
+  next_sal = find_sal_for_pc_sect (start_pc_sal.end, NULL, 0);
   if (next_sal.line != start_pc_sal.line)
     return pc;
 
diff --git a/gdb/linespec.c b/gdb/linespec.c
index 05f676ee38d4..703af9ccdb95 100644
--- a/gdb/linespec.c
+++ b/gdb/linespec.c
@@ -4113,7 +4113,7 @@ add_minsym (struct minimal_symbol *minsym, struct objfile *objfile,
       CORE_ADDR func_addr;
       if (msymbol_is_function (objfile, minsym, &func_addr))
 	{
-	  symtab_and_line sal = find_pc_sect_line (func_addr, NULL, 0);
+	  symtab_and_line sal = find_sal_for_pc_sect (func_addr, NULL, 0);
 
 	  if (symtab != sal.symtab)
 	    return;
diff --git a/gdb/printcmd.c b/gdb/printcmd.c
index 047833a261d9..887c8546c424 100644
--- a/gdb/printcmd.c
+++ b/gdb/printcmd.c
@@ -719,7 +719,7 @@ build_address_symbolic (struct gdbarch *gdbarch,
     {
       struct symtab_and_line sal;
 
-      sal = find_pc_sect_line (addr, section, 0);
+      sal = find_sal_for_pc_sect (addr, section, 0);
 
       if (sal.symtab)
 	{
@@ -815,7 +815,7 @@ find_instruction_backward (struct gdbarch *gdbarch, CORE_ADDR addr,
   do
     {
       pcs.clear ();
-      sal = find_pc_sect_line (loop_start, NULL, 1);
+      sal = find_sal_for_pc_sect (loop_start, NULL, 1);
       if (sal.line <= 0)
 	{
 	  /* We reach here when line info is not available.  In this case,
diff --git a/gdb/symtab.c b/gdb/symtab.c
index f36d5b262955..fab16f7ad48c 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -2902,7 +2902,7 @@ find_symbol_at_address (CORE_ADDR address)
    symtab.  */
 
 struct symtab_and_line
-find_pc_sect_line (CORE_ADDR pc, struct obj_section *section, int notcurrent)
+find_sal_for_pc_sect (CORE_ADDR pc, struct obj_section *section, int notcurrent)
 {
   /* Info on best line seen so far, and where it starts, and its file.  */
   const linetable_entry *best = NULL;
@@ -3017,7 +3017,7 @@ find_pc_sect_line (CORE_ADDR pc, struct obj_section *section, int notcurrent)
 	       should occur, we'd like to know about it, so error out,
 	       fatally.  */
 	    if (mfunsym.value_address () == pc)
-	      internal_error (_("Infinite recursion detected in find_pc_sect_line;"
+	      internal_error (_("Infinite recursion detected in find_sal_for_pc_sect;"
 		  "please file a bug report"));
 
 	    return find_sal_for_pc (mfunsym.value_address (), 0);
@@ -3181,14 +3181,14 @@ find_sal_for_pc (CORE_ADDR pc, int notcurrent)
 
   section = find_pc_overlay (pc);
   if (!pc_in_unmapped_range (pc, section))
-    return find_pc_sect_line (pc, section, notcurrent);
+    return find_sal_for_pc_sect (pc, section, notcurrent);
 
   /* If the original PC was an unmapped address then we translate this to a
      mapped address in order to lookup the sal.  However, as the user
      passed us an unmapped address it makes more sense to return a result
      that has the pc and end fields translated to unmapped addresses.  */
   pc = overlay_mapped_address (pc, section);
-  symtab_and_line sal = find_pc_sect_line (pc, section, notcurrent);
+  symtab_and_line sal = find_sal_for_pc_sect (pc, section, notcurrent);
   sal.pc = overlay_unmapped_address (sal.pc, section);
   sal.end = overlay_unmapped_address (sal.end, section);
   return sal;
@@ -3434,7 +3434,7 @@ find_line_pc_range (struct symtab_and_line sal, CORE_ADDR *startptr,
      This also insures that we never give a range like "starts at 0x134
      and ends at 0x12c".  */
 
-  found_sal = find_pc_sect_line (startaddr, sal.section, 0);
+  found_sal = find_sal_for_pc_sect (startaddr, sal.section, 0);
   if (found_sal.line != sal.line)
     {
       /* The specified line (sal) has zero bytes.  */
@@ -3522,7 +3522,7 @@ static symtab_and_line
 find_function_start_sal_1 (CORE_ADDR func_addr, obj_section *section,
 			   bool funfirstline)
 {
-  symtab_and_line sal = find_pc_sect_line (func_addr, section, 0);
+  symtab_and_line sal = find_sal_for_pc_sect (func_addr, section, 0);
 
   if (funfirstline && sal.symtab != NULL
       && (sal.symtab->compunit ()->locations_valid ()
@@ -3760,7 +3760,7 @@ skip_prologue_sal (struct symtab_and_line *sal)
 	  if (linetable_pc)
 	    {
 	      pc = *linetable_pc;
-	      start_sal = find_pc_sect_line (pc, section, 0);
+	      start_sal = find_sal_for_pc_sect (pc, section, 0);
 	      force_skip = 1;
 	      continue;
 	    }
@@ -3782,7 +3782,7 @@ skip_prologue_sal (struct symtab_and_line *sal)
       pc = overlay_mapped_address (pc, section);
 
       /* Calculate line number.  */
-      start_sal = find_pc_sect_line (pc, section, 0);
+      start_sal = find_sal_for_pc_sect (pc, section, 0);
 
       /* Check if gdbarch_skip_prologue left us in mid-line, and the next
 	 line is still part of the same function.  */
@@ -3795,7 +3795,7 @@ skip_prologue_sal (struct symtab_and_line *sal)
 	  /* First pc of next line */
 	  pc = start_sal.end;
 	  /* Recalculate the line number (might not be N+1).  */
-	  start_sal = find_pc_sect_line (pc, section, 0);
+	  start_sal = find_sal_for_pc_sect (pc, section, 0);
 	}
 
       /* On targets with executable formats that don't have a concept of
@@ -3807,7 +3807,7 @@ skip_prologue_sal (struct symtab_and_line *sal)
 	{
 	  pc = gdbarch_skip_main_prologue (gdbarch, pc);
 	  /* Recalculate the line number (might not be N+1).  */
-	  start_sal = find_pc_sect_line (pc, section, 0);
+	  start_sal = find_sal_for_pc_sect (pc, section, 0);
 	  force_skip = 1;
 	}
     }
@@ -3825,7 +3825,7 @@ skip_prologue_sal (struct symtab_and_line *sal)
     {
       pc = skip_prologue_using_lineinfo (pc, sym->symtab ());
       /* Recalculate the line number.  */
-      start_sal = find_pc_sect_line (pc, section, 0);
+      start_sal = find_sal_for_pc_sect (pc, section, 0);
     }
 
   /* If we're already past the prologue, leave SAL unchanged.  Otherwise
diff --git a/gdb/symtab.h b/gdb/symtab.h
index 9f6a6c361221..6e8283280623 100644
--- a/gdb/symtab.h
+++ b/gdb/symtab.h
@@ -2409,8 +2409,8 @@ extern struct symtab_and_line find_sal_for_pc (CORE_ADDR, int);
 
 /* Same function, but specify a section as well as an address.  */
 
-extern struct symtab_and_line find_pc_sect_line (CORE_ADDR,
-						 struct obj_section *, int);
+extern struct symtab_and_line find_sal_for_pc_sect (CORE_ADDR,
+						    obj_section *, int);
 
 /* Given PC, and assuming it is part of a range of addresses that is part of
    a line, go back through the linetable and find the starting PC of that
-- 
2.51.0


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH 09/10] gdb: rename find_pc_line_symtab -> find_symtab_for_pc
  2025-10-16  0:07 [PATCH 00/10] Rename some symtab find functions simon.marchi
                   ` (7 preceding siblings ...)
  2025-10-16  0:08 ` [PATCH 08/10] gdb: rename find_pc_sect_line -> find_sal_for_pc_sect simon.marchi
@ 2025-10-16  0:08 ` simon.marchi
  2025-10-16  0:08 ` [PATCH 10/10] gdb: rename find_line_pc_range -> find_pc_range_for_sal simon.marchi
  2025-10-19  4:07 ` [PATCH 00/10] Rename some symtab find functions Kevin Buettner
  10 siblings, 0 replies; 13+ messages in thread
From: simon.marchi @ 2025-10-16  0:08 UTC (permalink / raw)
  To: gdb-patches; +Cc: Simon Marchi

From: Simon Marchi <simon.marchi@polymtl.ca>

Change-Id: I2940e0f80c4b1d63fb1aee85f5753df5fbf4326a
---
 gdb/disasm.c            | 2 +-
 gdb/record-btrace.c     | 2 +-
 gdb/symmisc.c           | 2 +-
 gdb/symtab.c            | 2 +-
 gdb/symtab.h            | 2 +-
 gdb/tui/tui-source.c    | 2 +-
 gdb/tui/tui-winsource.c | 2 +-
 7 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/gdb/disasm.c b/gdb/disasm.c
index b2e795d5c69c..512edcf4cc34 100644
--- a/gdb/disasm.c
+++ b/gdb/disasm.c
@@ -1150,7 +1150,7 @@ gdb_disassembly (struct gdbarch *gdbarch, struct ui_out *uiout,
   int nlines = -1;
 
   /* Assume symtab is valid for whole PC range.  */
-  symtab = find_pc_line_symtab (low);
+  symtab = find_symtab_for_pc (low);
 
   if (symtab != NULL && symtab->linetable () != NULL)
     nlines = symtab->linetable ()->nitems;
diff --git a/gdb/record-btrace.c b/gdb/record-btrace.c
index cc9365d2fa1b..be3a3955974a 100644
--- a/gdb/record-btrace.c
+++ b/gdb/record-btrace.c
@@ -709,7 +709,7 @@ btrace_find_line_range (CORE_ADDR pc)
   struct symtab *symtab;
   int nlines, i;
 
-  symtab = find_pc_line_symtab (pc);
+  symtab = find_symtab_for_pc (pc);
   if (symtab == NULL)
     return btrace_mk_line_range (NULL, 0, 0);
 
diff --git a/gdb/symmisc.c b/gdb/symmisc.c
index 2ad3620c9f27..78c44e899482 100644
--- a/gdb/symmisc.c
+++ b/gdb/symmisc.c
@@ -447,7 +447,7 @@ maintenance_print_symbols (const char *args, int from_tty)
   if (address_arg != NULL)
     {
       CORE_ADDR pc = parse_and_eval_address (address_arg);
-      struct symtab *s = find_pc_line_symtab (pc);
+      struct symtab *s = find_symtab_for_pc (pc);
 
       if (s == NULL)
 	error (_("No symtab for address: %s"), address_arg);
diff --git a/gdb/symtab.c b/gdb/symtab.c
index fab16f7ad48c..bb17276102f9 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -3246,7 +3246,7 @@ find_line_range_start (CORE_ADDR pc)
 /* See symtab.h.  */
 
 struct symtab *
-find_pc_line_symtab (CORE_ADDR pc)
+find_symtab_for_pc (CORE_ADDR pc)
 {
   struct symtab_and_line sal;
 
diff --git a/gdb/symtab.h b/gdb/symtab.h
index 6e8283280623..3a2088cb6af3 100644
--- a/gdb/symtab.h
+++ b/gdb/symtab.h
@@ -2430,7 +2430,7 @@ extern std::optional<CORE_ADDR> find_line_range_start (CORE_ADDR pc);
 
 /* Wrapper around find_sal_for_pc to just return the symtab.  */
 
-extern struct symtab *find_pc_line_symtab (CORE_ADDR);
+extern struct symtab *find_symtab_for_pc (CORE_ADDR);
 
 /* Given a symtab and line number, return the pc there.  */
 
diff --git a/gdb/tui/tui-source.c b/gdb/tui/tui-source.c
index e2dff84a5d58..9485ad960022 100644
--- a/gdb/tui/tui-source.c
+++ b/gdb/tui/tui-source.c
@@ -157,7 +157,7 @@ tui_source_window::do_scroll_vertical (int num_to_scroll)
       if (cursal.symtab == NULL)
 	{
 	  frame_info_ptr fi = get_selected_frame (NULL);
-	  s = find_pc_line_symtab (get_frame_pc (fi));
+	  s = find_symtab_for_pc (get_frame_pc (fi));
 	  arch = get_frame_arch (fi);
 	}
       else
diff --git a/gdb/tui/tui-winsource.c b/gdb/tui/tui-winsource.c
index e66c4596586e..27f682b7ea80 100644
--- a/gdb/tui/tui-winsource.c
+++ b/gdb/tui/tui-winsource.c
@@ -55,7 +55,7 @@ tui_display_main ()
 	  tui_batch_rendering defer;
 
 	  tui_update_source_windows_with_addr (gdbarch, addr);
-	  struct symtab *s = find_pc_line_symtab (addr);
+	  struct symtab *s = find_symtab_for_pc (addr);
 	  tui_location.set_location (s);
 	}
     }
-- 
2.51.0


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH 10/10] gdb: rename find_line_pc_range -> find_pc_range_for_sal
  2025-10-16  0:07 [PATCH 00/10] Rename some symtab find functions simon.marchi
                   ` (8 preceding siblings ...)
  2025-10-16  0:08 ` [PATCH 09/10] gdb: rename find_pc_line_symtab -> find_symtab_for_pc simon.marchi
@ 2025-10-16  0:08 ` simon.marchi
  2025-10-19  4:07 ` [PATCH 00/10] Rename some symtab find functions Kevin Buettner
  10 siblings, 0 replies; 13+ messages in thread
From: simon.marchi @ 2025-10-16  0:08 UTC (permalink / raw)
  To: gdb-patches; +Cc: Simon Marchi

From: Simon Marchi <simon.marchi@polymtl.ca>

Change-Id: Ibd1692292dfcad088ae74b797c38a483080f2ec1
---
 gdb/breakpoint.c        | 8 ++++----
 gdb/mi/mi-cmd-disas.c   | 2 +-
 gdb/mi/mi-main.c        | 2 +-
 gdb/source.c            | 2 +-
 gdb/symtab.c            | 6 +++---
 gdb/symtab.h            | 6 +++---
 gdb/tracepoint.c        | 4 ++--
 gdb/tui/tui-disasm.c    | 2 +-
 gdb/tui/tui-source.c    | 4 ++--
 gdb/tui/tui-winsource.c | 2 +-
 10 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index a2c326b9f3fe..494a1773e16b 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -9482,7 +9482,7 @@ resolve_sal_pc (struct symtab_and_line *sal)
 
   if (sal->pc == 0 && sal->symtab != NULL)
     {
-      if (!find_line_pc (sal->symtab, sal->line, &pc))
+      if (!find_pc_for_line (sal->symtab, sal->line, &pc))
 	error (_("No line %d in file \"%s\"."),
 	       sal->line, symtab_to_filename_for_display (sal->symtab));
       sal->pc = pc;
@@ -9735,11 +9735,11 @@ find_breakpoint_range_end (struct symtab_and_line sal)
       int ret;
       CORE_ADDR start;
 
-      ret = find_line_pc_range (sal, &start, &end);
+      ret = find_pc_range_for_sal (sal, &start, &end);
       if (!ret)
 	error (_("Could not find location of the end of the range."));
 
-      /* find_line_pc_range returns the start of the next line.  */
+      /* find_pc_range_for_sal returns the start of the next line.  */
       end--;
     }
 
@@ -12851,7 +12851,7 @@ update_static_tracepoint (tracepoint *tp, struct symtab_and_line sal)
 
   pc = sal.pc;
   if (sal.line)
-    find_line_pc (sal.symtab, sal.line, &pc);
+    find_pc_for_line (sal.symtab, sal.line, &pc);
 
   if (target_static_tracepoint_marker_at (pc, &marker))
     {
diff --git a/gdb/mi/mi-cmd-disas.c b/gdb/mi/mi-cmd-disas.c
index cb839e742ff6..6051cbadefc9 100644
--- a/gdb/mi/mi-cmd-disas.c
+++ b/gdb/mi/mi-cmd-disas.c
@@ -248,7 +248,7 @@ mi_cmd_disassemble (const char *command, const char *const *argv, int argc)
       s = lookup_symtab (current_program_space, file_string);
       if (s == NULL)
 	error (_("-data-disassemble: Invalid filename."));
-      if (!find_line_pc (s, line_num, &start))
+      if (!find_pc_for_line (s, line_num, &start))
 	error (_("-data-disassemble: Invalid line number"));
       if (find_pc_partial_function (start, NULL, &low, &high) == 0)
 	error (_("-data-disassemble: "
diff --git a/gdb/mi/mi-main.c b/gdb/mi/mi-main.c
index bf1070030e27..2d91bb1667bf 100644
--- a/gdb/mi/mi-main.c
+++ b/gdb/mi/mi-main.c
@@ -2355,7 +2355,7 @@ mi_cmd_trace_find (const char *command, const char *const *argv, int argc)
 	error (_("Could not find the specified line"));
 
       CORE_ADDR start_pc, end_pc;
-      if (sal.line > 0 && find_line_pc_range (sal, &start_pc, &end_pc))
+      if (sal.line > 0 && find_pc_range_for_sal (sal, &start_pc, &end_pc))
 	tfind_1 (tfind_range, 0, start_pc, end_pc - 1, 0);
       else
 	error (_("Could not find the specified line"));
diff --git a/gdb/source.c b/gdb/source.c
index 1018d2ce6be3..27fa657afb81 100644
--- a/gdb/source.c
+++ b/gdb/source.c
@@ -1574,7 +1574,7 @@ info_line_command (const char *arg, int from_tty)
 	  gdb_printf ("\n");
 	}
       else if (sal.line > 0
-	       && find_line_pc_range (sal, &start_pc, &end_pc))
+	       && find_pc_range_for_sal (sal, &start_pc, &end_pc))
 	{
 	  gdbarch *gdbarch = sal.symtab->compunit ()->objfile ()->arch ();
 
diff --git a/gdb/symtab.c b/gdb/symtab.c
index bb17276102f9..fdba441ec541 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -3390,7 +3390,7 @@ find_pcs_for_symtab_line (struct symtab *symtab, int line,
    The source file is specified with a struct symtab.  */
 
 bool
-find_line_pc (struct symtab *symtab, int line, CORE_ADDR *pc)
+find_pc_for_line (struct symtab *symtab, int line, CORE_ADDR *pc)
 {
   const struct linetable *l;
   int ind;
@@ -3417,14 +3417,14 @@ find_line_pc (struct symtab *symtab, int line, CORE_ADDR *pc)
    Returns false if could not find the specified line.  */
 
 bool
-find_line_pc_range (struct symtab_and_line sal, CORE_ADDR *startptr,
+find_pc_range_for_sal (struct symtab_and_line sal, CORE_ADDR *startptr,
 		    CORE_ADDR *endptr)
 {
   CORE_ADDR startaddr;
   struct symtab_and_line found_sal;
 
   startaddr = sal.pc;
-  if (startaddr == 0 && !find_line_pc (sal.symtab, sal.line, &startaddr))
+  if (startaddr == 0 && !find_pc_for_line (sal.symtab, sal.line, &startaddr))
     return false;
 
   /* This whole function is based on address.  For example, if line 10 has
diff --git a/gdb/symtab.h b/gdb/symtab.h
index 3a2088cb6af3..6c19f138c2f4 100644
--- a/gdb/symtab.h
+++ b/gdb/symtab.h
@@ -2434,10 +2434,10 @@ extern struct symtab *find_symtab_for_pc (CORE_ADDR);
 
 /* Given a symtab and line number, return the pc there.  */
 
-extern bool find_line_pc (struct symtab *, int, CORE_ADDR *);
+extern bool find_pc_for_line (struct symtab *, int, CORE_ADDR *);
 
-extern bool find_line_pc_range (struct symtab_and_line, CORE_ADDR *,
-				CORE_ADDR *);
+extern bool find_pc_range_for_sal (struct symtab_and_line, CORE_ADDR *,
+				   CORE_ADDR *);
 
 extern void resolve_sal_pc (struct symtab_and_line *);
 
diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c
index c0db7c8e6fa4..9b84fbe384ab 100644
--- a/gdb/tracepoint.c
+++ b/gdb/tracepoint.c
@@ -2347,7 +2347,7 @@ tfind_line_command (const char *args, int from_tty)
     error (_("No line number information available."));
 
   CORE_ADDR start_pc, end_pc;
-  if (sal.line > 0 && find_line_pc_range (sal, &start_pc, &end_pc))
+  if (sal.line > 0 && find_pc_range_for_sal (sal, &start_pc, &end_pc))
     {
       if (start_pc == end_pc)
 	{
@@ -2362,7 +2362,7 @@ tfind_line_command (const char *args, int from_tty)
 	  gdb_printf (" but contains no code.\n");
 	  sal = find_sal_for_pc (start_pc, 0);
 	  if (sal.line > 0
-	      && find_line_pc_range (sal, &start_pc, &end_pc)
+	      && find_pc_range_for_sal (sal, &start_pc, &end_pc)
 	      && start_pc != end_pc)
 	    gdb_printf ("Attempting to find line %ps instead.\n",
 			styled_string (line_number_style.style (),
diff --git a/gdb/tui/tui-disasm.c b/gdb/tui/tui-disasm.c
index 07453b4ea5e7..b49a33b84136 100644
--- a/gdb/tui/tui-disasm.c
+++ b/gdb/tui/tui-disasm.c
@@ -401,7 +401,7 @@ tui_get_begin_asm_address (struct gdbarch **gdbarch_p, CORE_ADDR *addr_p)
 	    = get_current_source_symtab_and_line (current_program_space);
 
 	  if (sal.symtab != nullptr)
-	    find_line_pc (sal.symtab, sal.line, &addr);
+	    find_pc_for_line (sal.symtab, sal.line, &addr);
 	}
 
       if (addr == 0)
diff --git a/gdb/tui/tui-source.c b/gdb/tui/tui-source.c
index 9485ad960022..4a2f42352739 100644
--- a/gdb/tui/tui-source.c
+++ b/gdb/tui/tui-source.c
@@ -172,7 +172,7 @@ tui_source_window::do_scroll_vertical (int num_to_scroll)
 	line_no = m_start_line_or_addr.u.line_no;
 
       cursal.line = line_no;
-      find_line_pc (cursal.symtab, cursal.line, &cursal.pc);
+      find_pc_for_line (cursal.symtab, cursal.line, &cursal.pc);
       for (struct tui_source_window_base *win_info : tui_source_windows ())
 	win_info->update_source_window_as_is (arch, cursal);
     }
@@ -238,7 +238,7 @@ tui_source_window::display_start_addr (struct gdbarch **gdbarch_p,
   symtab_and_line cursal = get_current_source_symtab_and_line (current_program_space);
 
   *gdbarch_p = m_gdbarch;
-  find_line_pc (cursal.symtab, m_start_line_or_addr.u.line_no, addr_p);
+  find_pc_for_line (cursal.symtab, m_start_line_or_addr.u.line_no, addr_p);
 }
 
 /* See tui-winsource.h.  */
diff --git a/gdb/tui/tui-winsource.c b/gdb/tui/tui-winsource.c
index 27f682b7ea80..e6bbe1535a30 100644
--- a/gdb/tui/tui-winsource.c
+++ b/gdb/tui/tui-winsource.c
@@ -208,7 +208,7 @@ tui_update_source_windows_with_line (struct symtab_and_line sal)
   struct gdbarch *gdbarch = nullptr;
   if (sal.symtab != nullptr)
     {
-      find_line_pc (sal.symtab, sal.line, &sal.pc);
+      find_pc_for_line (sal.symtab, sal.line, &sal.pc);
       gdbarch = sal.symtab->compunit ()->objfile ()->arch ();
     }
 
-- 
2.51.0


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 00/10] Rename some symtab find functions
  2025-10-16  0:07 [PATCH 00/10] Rename some symtab find functions simon.marchi
                   ` (9 preceding siblings ...)
  2025-10-16  0:08 ` [PATCH 10/10] gdb: rename find_line_pc_range -> find_pc_range_for_sal simon.marchi
@ 2025-10-19  4:07 ` Kevin Buettner
  2025-10-20 19:41   ` Simon Marchi
  10 siblings, 1 reply; 13+ messages in thread
From: Kevin Buettner @ 2025-10-19  4:07 UTC (permalink / raw)
  To: simon.marchi; +Cc: gdb-patches

On Wed, 15 Oct 2025 20:07:54 -0400
simon.marchi@polymtl.ca wrote:

> From: Simon Marchi <simon.marchi@polymtl.ca>
> 
> I have long been confused by the names of the functions to look up
> things in symtab.  For a function named find_foo_bar, it's not obvious
> if it finds a foo from a bar or vice-versa (answer: it finds a bar for a
> given foo).  When asking around on IRC a while ago, a few people agreed.
> I'm therefore proposing to rename those functions to be of the form
> find_bar_for_foo.
> 
> Simon Marchi (10):
>   gdb: rename find_pc_function -> find_symbol_for_pc
>   gdb: rename find_pc_sect_function -> find_symbol_for_pc_sect
>   gdb: rename find_pc_sect_containing_function ->
>     find_symbol_for_pc_sect_maybe_inline
>   gdb: rename find_pc_compunit_symtab -> find_compunit_symtab_for_pc
>   gdb: rename find_pc_sect_compunit_symtab ->
>     find_compunit_symtab_for_pc_sect
>   gdb: rename find_pc_line_pc_range -> find_line_pc_range_for_pc
>   gdb: rename find_pc_line -> find_sal_for_pc
>   gdb: rename find_pc_sect_line -> find_sal_for_pc_sect
>   gdb: rename find_pc_line_symtab -> find_symtab_for_pc
>   gdb: rename find_line_pc_range -> find_pc_range_for_sal

I wholeheartedly approve of these name changes.  Over the years, I've
been confused by these names too.

Approved-by: Kevin Buettner <kevinb@redhat.com>


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 00/10] Rename some symtab find functions
  2025-10-19  4:07 ` [PATCH 00/10] Rename some symtab find functions Kevin Buettner
@ 2025-10-20 19:41   ` Simon Marchi
  0 siblings, 0 replies; 13+ messages in thread
From: Simon Marchi @ 2025-10-20 19:41 UTC (permalink / raw)
  To: Kevin Buettner; +Cc: gdb-patches

On 10/19/25 12:07 AM, Kevin Buettner wrote:
> On Wed, 15 Oct 2025 20:07:54 -0400
> simon.marchi@polymtl.ca wrote:
> 
>> From: Simon Marchi <simon.marchi@polymtl.ca>
>>
>> I have long been confused by the names of the functions to look up
>> things in symtab.  For a function named find_foo_bar, it's not obvious
>> if it finds a foo from a bar or vice-versa (answer: it finds a bar for a
>> given foo).  When asking around on IRC a while ago, a few people agreed.
>> I'm therefore proposing to rename those functions to be of the form
>> find_bar_for_foo.
>>
>> Simon Marchi (10):
>>   gdb: rename find_pc_function -> find_symbol_for_pc
>>   gdb: rename find_pc_sect_function -> find_symbol_for_pc_sect
>>   gdb: rename find_pc_sect_containing_function ->
>>     find_symbol_for_pc_sect_maybe_inline
>>   gdb: rename find_pc_compunit_symtab -> find_compunit_symtab_for_pc
>>   gdb: rename find_pc_sect_compunit_symtab ->
>>     find_compunit_symtab_for_pc_sect
>>   gdb: rename find_pc_line_pc_range -> find_line_pc_range_for_pc
>>   gdb: rename find_pc_line -> find_sal_for_pc
>>   gdb: rename find_pc_sect_line -> find_sal_for_pc_sect
>>   gdb: rename find_pc_line_symtab -> find_symtab_for_pc
>>   gdb: rename find_line_pc_range -> find_pc_range_for_sal
> 
> I wholeheartedly approve of these name changes.  Over the years, I've
> been confused by these names too.
> 
> Approved-by: Kevin Buettner <kevinb@redhat.com>
> 

Thanks, pushed.

Simon

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2025-10-20 19:44 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-10-16  0:07 [PATCH 00/10] Rename some symtab find functions simon.marchi
2025-10-16  0:07 ` [PATCH 01/10] gdb: rename find_pc_function -> find_symbol_for_pc simon.marchi
2025-10-16  0:07 ` [PATCH 02/10] gdb: rename find_pc_sect_function -> find_symbol_for_pc_sect simon.marchi
2025-10-16  0:07 ` [PATCH 03/10] gdb: rename find_pc_sect_containing_function -> find_symbol_for_pc_sect_maybe_inline simon.marchi
2025-10-16  0:07 ` [PATCH 04/10] gdb: rename find_pc_compunit_symtab -> find_compunit_symtab_for_pc simon.marchi
2025-10-16  0:07 ` [PATCH 05/10] gdb: rename find_pc_sect_compunit_symtab -> find_compunit_symtab_for_pc_sect simon.marchi
2025-10-16  0:08 ` [PATCH 06/10] gdb: rename find_pc_line_pc_range -> find_line_pc_range_for_pc simon.marchi
2025-10-16  0:08 ` [PATCH 07/10] gdb: rename find_pc_line -> find_sal_for_pc simon.marchi
2025-10-16  0:08 ` [PATCH 08/10] gdb: rename find_pc_sect_line -> find_sal_for_pc_sect simon.marchi
2025-10-16  0:08 ` [PATCH 09/10] gdb: rename find_pc_line_symtab -> find_symtab_for_pc simon.marchi
2025-10-16  0:08 ` [PATCH 10/10] gdb: rename find_line_pc_range -> find_pc_range_for_sal simon.marchi
2025-10-19  4:07 ` [PATCH 00/10] Rename some symtab find functions Kevin Buettner
2025-10-20 19:41   ` Simon Marchi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox