From patchwork Mon Apr 24 16:22:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 68229 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id ED0253853548 for ; Mon, 24 Apr 2023 16:24:48 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org ED0253853548 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1682353489; bh=jKTY6CS0eq6zW+A1UTS6BPeKQRIaodkKsx2FnLFxURU=; h=To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=mHwnh4YeAxQ5koDK3jfRSU8VXDVpUEng66icj8/XRcSZWqjcD9SKmeFylIIE2M2cD rLesSD/wtsda7dvoO0A51fFd8d078liMK63aU1FBlrxtkJolD/koaMUFK2FrHmJ+tB MtPXG7gztT1gwPONp69iQEgFb4VoHPZ5QAPPRAbw= X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from mail-il1-x12c.google.com (mail-il1-x12c.google.com [IPv6:2607:f8b0:4864:20::12c]) by sourceware.org (Postfix) with ESMTPS id 4B1DA3858431 for ; Mon, 24 Apr 2023 16:22:28 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 4B1DA3858431 Received: by mail-il1-x12c.google.com with SMTP id e9e14a558f8ab-32b0cc0eb43so41430025ab.0 for ; Mon, 24 Apr 2023 09:22:28 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682353347; x=1684945347; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=jKTY6CS0eq6zW+A1UTS6BPeKQRIaodkKsx2FnLFxURU=; b=YgeWx9ki1lfwBsjs4LqYdbuTqx9rKwXhVv1YlRx8MphCOwSkvcsJvFj3xcbQnxAQo4 nIaxiCUUMU7fZXB4CuqAmgTc3o8u78/qpsEusc3h3nxIgY0OAdbURMapkIf7gTglMQxT sVfi90LRCbuIzdgwMJOfWKOF/GeyLSFTY0hB6h+TUGS5m3pYLy4quo5FXGvl/ZOO6KpU ubVy9tDmilVAdMdOnKOyv3BS2TBKD16LtnYygJPRHc7jYWqwTgPzsLXAN+kAxXLhmlcI wI95ik1BpUT7s4lt8K6YxPXVwzyNpcEQWqlRoS0PAW7zduLoui5wIFZAGm1/j5eqMSXh fYdQ== X-Gm-Message-State: AAQBX9er3Q8V5pBGJUPLNxBiRl3wwqmM3PR+agK8ZXd/fywBrVbaAiBJ YaUOxG8HEbxTqgy9wqIlnH5cmuSfRxWvnGC2Ht1Bwg== X-Google-Smtp-Source: AKy350bLnjxha1LXPwbNYVL36LV9n6rf19hlX9kCA7qV7kBq5cILm3hkE/mpIeB0uQIMwTf0dz9PIg== X-Received: by 2002:a92:d3c6:0:b0:32a:9bb1:1f78 with SMTP id c6-20020a92d3c6000000b0032a9bb11f78mr6332504ilh.17.1682353347468; Mon, 24 Apr 2023 09:22:27 -0700 (PDT) Received: from localhost.localdomain (71-211-191-82.hlrn.qwest.net. [71.211.191.82]) by smtp.gmail.com with ESMTPSA id cx27-20020a056638491b00b0040fa19472bcsm3444049jab.92.2023.04.24.09.22.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Apr 2023 09:22:27 -0700 (PDT) To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [RFC 07/10] Use "unrelocated" terminology in linetable_entry Date: Mon, 24 Apr 2023 10:22:08 -0600 Message-Id: <20230424162211.682763-8-tromey@adacore.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230424162211.682763-1-tromey@adacore.com> References: <20230424162211.682763-1-tromey@adacore.com> MIME-Version: 1.0 X-Spam-Status: No, score=-11.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Tom Tromey via Gdb-patches From: Tom Tromey Reply-To: Tom Tromey Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Sender: "Gdb-patches" 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 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 <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 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 &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;