Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: simon.marchi@polymtl.ca
To: gdb-patches@sourceware.org
Cc: Simon Marchi <simon.marchi@polymtl.ca>
Subject: [PATCH 08/10] gdb: rename find_pc_sect_line -> find_sal_for_pc_sect
Date: Wed, 15 Oct 2025 20:08:02 -0400	[thread overview]
Message-ID: <20251016001154.3969223-9-simon.marchi@polymtl.ca> (raw)
In-Reply-To: <20251016001154.3969223-1-simon.marchi@polymtl.ca>

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


  parent reply	other threads:[~2025-10-16  0:18 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 ` simon.marchi [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20251016001154.3969223-9-simon.marchi@polymtl.ca \
    --to=simon.marchi@polymtl.ca \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox