[RFC,07/10] Use "unrelocated" terminology in linetable_entry

Message ID 20230424162211.682763-8-tromey@adacore.com
State New
Headers
Series More use of unrelocated_addr |

Commit Message

Tom Tromey April 24, 2023, 4:22 p.m. UTC
  I forgot to convert struct linetable_entry to use the "unrelocated"
(as opposed to "raw") terminology.  This patch corrects the oversight.
---
 gdb/buildsym.c      |  4 ++--
 gdb/disasm.c        | 10 +++++-----
 gdb/jit.c           |  3 ++-
 gdb/mdebugread.c    |  2 +-
 gdb/record-btrace.c |  2 +-
 gdb/symmisc.c       |  2 +-
 gdb/symtab.c        | 17 ++++++++++-------
 gdb/symtab.h        |  6 ++++--
 gdb/xcoffread.c     |  5 +++--
 9 files changed, 29 insertions(+), 22 deletions(-)
  

Patch

diff --git a/gdb/buildsym.c b/gdb/buildsym.c
index f000233dafa..4a711a9cf22 100644
--- a/gdb/buildsym.c
+++ b/gdb/buildsym.c
@@ -655,7 +655,7 @@  buildsym_compunit::record_line (struct subfile *subfile, int line,
 	  linetable_entry *last = &subfile->line_vector_entries.back ();
 	  last_line = last->line;
 
-	  if (last->raw_pc () != pc)
+	  if (last->unrelocated_pc () != pc)
 	    break;
 
 	  subfile->line_vector_entries.pop_back ();
@@ -670,7 +670,7 @@  buildsym_compunit::record_line (struct subfile *subfile, int line,
   linetable_entry &e = subfile->line_vector_entries.back ();
   e.line = line;
   e.is_stmt = (flags & LEF_IS_STMT) != 0;
-  e.set_raw_pc (pc);
+  e.set_unrelocated_pc (pc);
   e.prologue_end = (flags & LEF_PROLOGUE_END) != 0;
 }
 
diff --git a/gdb/disasm.c b/gdb/disasm.c
index 03cd4b7ee02..05397abc3fd 100644
--- a/gdb/disasm.c
+++ b/gdb/disasm.c
@@ -606,11 +606,11 @@  do_mixed_source_and_assembly_deprecated
 
   /* First, skip all the preceding functions.  */
 
-  for (i = 0; i < nlines - 1 && le[i].raw_pc () < unrel_low; i++);
+  for (i = 0; i < nlines - 1 && le[i].unrelocated_pc () < unrel_low; i++);
 
   /* Now, copy all entries before the end of this function.  */
 
-  for (; i < nlines - 1 && le[i].raw_pc () < unrel_high; i++)
+  for (; i < nlines - 1 && le[i].unrelocated_pc () < unrel_high; i++)
     {
       if (le[i] == le[i + 1])
 	continue;		/* Ignore duplicates.  */
@@ -630,7 +630,7 @@  do_mixed_source_and_assembly_deprecated
   /* If we're on the last line, and it's part of the function,
      then we need to get the end pc in a special way.  */
 
-  if (i == nlines - 1 && le[i].raw_pc () < unrel_high)
+  if (i == nlines - 1 && le[i].unrelocated_pc () < unrel_high)
     {
       mle[newlines].line = le[i].line;
       mle[newlines].start_pc = le[i].pc (objfile);
@@ -761,10 +761,10 @@  do_mixed_source_and_assembly (struct gdbarch *gdbarch,
   first_le = NULL;
 
   /* Skip all the preceding functions.  */
-  for (i = 0; i < nlines && le[i].raw_pc () < unrel_low; i++)
+  for (i = 0; i < nlines && le[i].unrelocated_pc () < unrel_low; i++)
     continue;
 
-  if (i < nlines && le[i].raw_pc () < unrel_high)
+  if (i < nlines && le[i].unrelocated_pc () < unrel_high)
     first_le = &le[i];
 
   /* Add lines for every pc value.  */
diff --git a/gdb/jit.c b/gdb/jit.c
index e085d562333..41f8e992b4a 100644
--- a/gdb/jit.c
+++ b/gdb/jit.c
@@ -491,7 +491,8 @@  jit_symtab_line_mapping_add_impl (struct gdb_symbol_callbacks *cb,
   stab->linetable->nitems = nlines;
   for (i = 0; i < nlines; i++)
     {
-      stab->linetable->item[i].set_raw_pc (unrelocated_addr (map[i].pc));
+      stab->linetable->item[i].set_unrelocated_pc
+	(unrelocated_addr (map[i].pc));
       stab->linetable->item[i].line = map[i].line;
       stab->linetable->item[i].is_stmt = true;
     }
diff --git a/gdb/mdebugread.c b/gdb/mdebugread.c
index 697ce0b5b1a..673767fbdee 100644
--- a/gdb/mdebugread.c
+++ b/gdb/mdebugread.c
@@ -4546,7 +4546,7 @@  add_line (struct linetable *lt, int lineno, CORE_ADDR adr, int last)
     return lineno;
 
   lt->item[lt->nitems].line = lineno;
-  lt->item[lt->nitems++].set_raw_pc (unrelocated_addr (adr << 2));
+  lt->item[lt->nitems++].set_unrelocated_pc (unrelocated_addr (adr << 2));
   return lineno;
 }
 
diff --git a/gdb/record-btrace.c b/gdb/record-btrace.c
index 9dd8474673b..dd2fc790847 100644
--- a/gdb/record-btrace.c
+++ b/gdb/record-btrace.c
@@ -738,7 +738,7 @@  btrace_find_line_range (CORE_ADDR pc)
 	 possibly adding more line numbers to the range.  At the time this
 	 change was made I was unsure how to test this so chose to go with
 	 maintaining the existing experience.  */
-      if (lines[i].raw_pc () == unrel_pc && lines[i].line != 0
+      if (lines[i].unrelocated_pc () == unrel_pc && lines[i].line != 0
 	  && lines[i].is_stmt)
 	range = btrace_line_range_add (range, lines[i].line);
     }
diff --git a/gdb/symmisc.c b/gdb/symmisc.c
index 4b68f2b1f6f..e25bf032185 100644
--- a/gdb/symmisc.c
+++ b/gdb/symmisc.c
@@ -998,7 +998,7 @@  maintenance_print_one_line_table (struct symtab *symtab, void *data)
 	  uiout->field_core_addr ("rel-address", objfile->arch (),
 				  item->pc (objfile));
 	  uiout->field_core_addr ("unrel-address", objfile->arch (),
-				  CORE_ADDR (item->raw_pc ()));
+				  CORE_ADDR (item->unrelocated_pc ()));
 	  uiout->field_string ("is-stmt", item->is_stmt ? "Y" : "");
 	  uiout->field_string ("prologue-end", item->prologue_end ? "Y" : "");
 	  uiout->text ("\n");
diff --git a/gdb/symtab.c b/gdb/symtab.c
index 25e5825d42b..c367c055c05 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -3166,13 +3166,13 @@  find_pc_sect_line (CORE_ADDR pc, struct obj_section *section, int notcurrent)
       /* Is this file's first line closer than the first lines of other files?
 	 If so, record this file, and its first line, as best alternate.  */
       if (item->pc (objfile) > pc
-	  && (!alt || item->raw_pc () < alt->raw_pc ()))
+	  && (!alt || item->unrelocated_pc () < alt->unrelocated_pc ()))
 	alt = item;
 
       auto pc_compare = [] (const unrelocated_addr &comp_pc,
 			    const struct linetable_entry & lhs)
       {
-	return comp_pc < lhs.raw_pc ();
+	return comp_pc < lhs.unrelocated_pc ();
       };
 
       const linetable_entry *first = item;
@@ -3194,7 +3194,8 @@  find_pc_sect_line (CORE_ADDR pc, struct obj_section *section, int notcurrent)
 	 save prev if it represents the end of a function (i.e. line number
 	 0) instead of a real line.  */
 
-      if (prev && prev->line && (!best || prev->raw_pc () > best->raw_pc ()))
+      if (prev && prev->line
+	  && (!best || prev->unrelocated_pc () > best->unrelocated_pc ()))
 	{
 	  best = prev;
 	  best_symtab = iter_s;
@@ -3209,7 +3210,8 @@  find_pc_sect_line (CORE_ADDR pc, struct obj_section *section, int notcurrent)
 	  if (!best->is_stmt)
 	    {
 	      const linetable_entry *tmp = best;
-	      while (tmp > first && (tmp - 1)->raw_pc () == tmp->raw_pc ()
+	      while (tmp > first
+		     && (tmp - 1)->unrelocated_pc () == tmp->unrelocated_pc ()
 		     && (tmp - 1)->line != 0 && !tmp->is_stmt)
 		--tmp;
 	      if (tmp->is_stmt)
@@ -3224,7 +3226,8 @@  find_pc_sect_line (CORE_ADDR pc, struct obj_section *section, int notcurrent)
       /* If another line (denoted by ITEM) is in the linetable and its
 	 PC is after BEST's PC, but before the current BEST_END, then
 	 use ITEM's PC as the new best_end.  */
-      if (best && item < last && item->raw_pc () > best->raw_pc ()
+      if (best && item < last
+	  && item->unrelocated_pc () > best->unrelocated_pc ()
 	  && (best_end == 0 || best_end > item->pc (objfile)))
 	best_end = item->pc (objfile);
     }
@@ -3711,12 +3714,12 @@  skip_prologue_using_linetable (CORE_ADDR func_addr)
 	(linetable->item, linetable->item + linetable->nitems, unrel_start,
 	 [] (const linetable_entry &lte, unrelocated_addr pc)
 	 {
-	   return lte.raw_pc () < pc;
+	   return lte.unrelocated_pc () < pc;
 	 });
 
       for (;
 	   (it < linetable->item + linetable->nitems
-	    && it->raw_pc () < unrel_end);
+	    && it->unrelocated_pc () < unrel_end);
 	   it++)
 	if (it->prologue_end)
 	  return {it->pc (objfile)};
diff --git a/gdb/symtab.h b/gdb/symtab.h
index 600f2e47cec..d6b28c4eece 100644
--- a/gdb/symtab.h
+++ b/gdb/symtab.h
@@ -1571,11 +1571,11 @@  struct rust_vtable_symbol : public symbol
 struct linetable_entry
 {
   /* Set the (unrelocated) PC for this entry.  */
-  void set_raw_pc (unrelocated_addr pc)
+  void set_unrelocated_pc (unrelocated_addr pc)
   { m_pc = pc; }
 
   /* Return the unrelocated PC for this entry.  */
-  unrelocated_addr raw_pc () const
+  unrelocated_addr unrelocated_pc () const
   { return m_pc; }
 
   /* Return the relocated PC for this entry.  */
@@ -1604,6 +1604,8 @@  struct linetable_entry
      function prologue.  */
   bool prologue_end : 1;
 
+private:
+
   /* The address for this entry.  */
   unrelocated_addr m_pc;
 };
diff --git a/gdb/xcoffread.c b/gdb/xcoffread.c
index d71127b40f6..0631d18459e 100644
--- a/gdb/xcoffread.c
+++ b/gdb/xcoffread.c
@@ -432,7 +432,7 @@  arrange_linetable (std::vector<linetable_entry> &old_linetable)
 	  linetable_entry &e = fentries.back ();
 	  e.line = ii;
 	  e.is_stmt = true;
-	  e.set_raw_pc (old_linetable[ii].raw_pc ());
+	  e.set_unrelocated_pc (old_linetable[ii].unrelocated_pc ());
 	}
     }
 
@@ -457,7 +457,8 @@  arrange_linetable (std::vector<linetable_entry> &old_linetable)
 	 extra line to cover the function prologue.  */
       int jj = entry.line;
       if (jj + 1 < old_linetable.size ()
-	  && old_linetable[jj].raw_pc () != old_linetable[jj + 1].raw_pc ())
+	  && (old_linetable[jj].unrelocated_pc ()
+	      != old_linetable[jj + 1].unrelocated_pc ()))
 	{
 	  new_linetable.push_back (old_linetable[jj]);
 	  new_linetable.back ().line = old_linetable[jj + 1].line;