From 0434c3ef8dc4cfa17e6bce21da206e312f5722fb Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Fri, 21 Apr 2023 09:36:54 -0600 Subject: [PATCH] Use "unrelocated" terminology in linetable_entry 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(-) diff --git a/gdb/buildsym.c b/gdb/buildsym.c index d12ad2187ab..832b689cf03 100644 --- a/gdb/buildsym.c +++ b/gdb/buildsym.c @@ -653,7 +653,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 (); @@ -668,7 +668,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 e6b31bf3633..aa5c6dab690 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 25c8ed8499a..804c832f47d 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 aaa0479bc66..83d287b523b 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 e933a428f3a..97447d3e8f8 100644 --- a/gdb/record-btrace.c +++ b/gdb/record-btrace.c @@ -739,7 +739,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 ff7f31f885f..a2f90277227 100644 --- a/gdb/symmisc.c +++ b/gdb/symmisc.c @@ -996,7 +996,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 e3030e462f1..0117a2a59d7 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -3164,13 +3164,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; @@ -3192,7 +3192,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; @@ -3207,7 +3208,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) @@ -3222,7 +3224,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); } @@ -3709,12 +3712,12 @@ skip_prologue_using_linetable (CORE_ADDR func_addr) (linetable->item, linetable->item + linetable->nitems, unrel_start, [] (const linetable_entry <e, 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 abfcb344909..ee4729b14cd 100644 --- a/gdb/symtab.h +++ b/gdb/symtab.h @@ -1583,11 +1583,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. */ @@ -1616,6 +1616,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 a660e1c0265..1538d1c823d 100644 --- a/gdb/xcoffread.c +++ b/gdb/xcoffread.c @@ -432,7 +432,7 @@ arrange_linetable (std::vector &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 &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; -- 2.30.2