From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id yLLoN2Tm82EjewAAWB0awg (envelope-from ) for ; Fri, 28 Jan 2022 07:49:40 -0500 Received: by simark.ca (Postfix, from userid 112) id E348C1F3B7; Fri, 28 Jan 2022 07:49:40 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RDNS_DYNAMIC,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (ip-8-43-85-97.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 478741EE18 for ; Fri, 28 Jan 2022 07:49:40 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id D58143947C3B for ; Fri, 28 Jan 2022 12:49:39 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D58143947C3B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1643374179; bh=tkJYZNa7HYc68vGJVzHQnJkcFoNcVkmvlOKPAB5g36Y=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=XvhGXNkMLoouGA5lAI3iXF1gm6KT5x9RVjbI6NKrG6uEC6Z0fRLm4ddog4cRzkJFY UfM/TwlvZ/lz+jhdaikGpHlFpDBGXQF6fbOyDFmREvDp5auQdWiZi+RG+5qryGwa6p Grgouk6gqgv2+R304DktMuyhmWdwoe7IhrHP24ms= Received: from barracuda.ebox.ca (barracuda.ebox.ca [96.127.255.19]) by sourceware.org (Postfix) with ESMTPS id EEEEA3947424 for ; Fri, 28 Jan 2022 12:47:33 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org EEEEA3947424 X-ASG-Debug-ID: 1643374052-0c856e06ab271c00001-fS2M51 Received: from smtp.ebox.ca (smtp.ebox.ca [96.127.255.82]) by barracuda.ebox.ca with ESMTP id qWB7EyBL8JDnh5cb (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 28 Jan 2022 07:47:32 -0500 (EST) X-Barracuda-Envelope-From: simon.marchi@polymtl.ca X-Barracuda-RBL-Trusted-Forwarder: 96.127.255.82 Received: from simark.localdomain (192-222-157-6.qc.cable.ebox.net [192.222.157.6]) by smtp.ebox.ca (Postfix) with ESMTP id 9085F441D67; Fri, 28 Jan 2022 07:47:32 -0500 (EST) X-Barracuda-RBL-IP: 192.222.157.6 X-Barracuda-Effective-Source-IP: 192-222-157-6.qc.cable.ebox.net[192.222.157.6] X-Barracuda-Apparent-Source-IP: 192.222.157.6 To: gdb-patches@sourceware.org Subject: [PATCH 12/33] gdb: remove COMPUNIT_BLOCK_LINE_SECTION macro, add getter/setter Date: Fri, 28 Jan 2022 07:45:10 -0500 X-ASG-Orig-Subj: [PATCH 12/33] gdb: remove COMPUNIT_BLOCK_LINE_SECTION macro, add getter/setter Message-Id: <20220128124531.2302941-13-simon.marchi@polymtl.ca> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220128124531.2302941-1-simon.marchi@polymtl.ca> References: <20220128124531.2302941-1-simon.marchi@polymtl.ca> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Barracuda-Connect: smtp.ebox.ca[96.127.255.82] X-Barracuda-Start-Time: 1643374052 X-Barracuda-Encrypted: DHE-RSA-AES256-SHA X-Barracuda-URL: https://96.127.255.19:443/cgi-mod/mark.cgi X-Barracuda-BRTS-Status: 1 X-Virus-Scanned: by bsmtpd at ebox.ca X-Barracuda-Scan-Msg-Size: 4686 X-Barracuda-Spam-Score: 0.00 X-Barracuda-Spam-Status: No, SCORE=0.00 using global scores of TAG_LEVEL=1000.0 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=8.0 tests= X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.3.95629 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- 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: , From: Simon Marchi via Gdb-patches Reply-To: Simon Marchi Cc: Simon Marchi Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" From: Simon Marchi Add a getter and a setter for a compunit_symtab's block line section. Remove the corresponding macro and adjust all callers. Change-Id: I3eb1a323388ad55eae8bfa45f5bc4a08dc3df455 --- gdb/buildsym.c | 2 +- gdb/dwarf2/loc.c | 2 +- gdb/gdbtypes.c | 2 +- gdb/objfiles.c | 4 ++-- gdb/symtab.c | 2 +- gdb/symtab.h | 13 +++++++++++-- 6 files changed, 17 insertions(+), 8 deletions(-) diff --git a/gdb/buildsym.c b/gdb/buildsym.c index 847414968af4..1b162dac9e07 100644 --- a/gdb/buildsym.c +++ b/gdb/buildsym.c @@ -1022,7 +1022,7 @@ buildsym_compunit::end_symtab_with_blockvector (struct block *static_block, set_block_compunit_symtab (b, cu); } - COMPUNIT_BLOCK_LINE_SECTION (cu) = section; + cu->set_block_line_section (section); COMPUNIT_MACRO_TABLE (cu) = release_macros (); diff --git a/gdb/dwarf2/loc.c b/gdb/dwarf2/loc.c index 69b480e6e869..bf3cadba87ee 100644 --- a/gdb/dwarf2/loc.c +++ b/gdb/dwarf2/loc.c @@ -717,7 +717,7 @@ call_site_to_target_addr (struct gdbarch *call_site_gdbarch, { dwarf2_per_objfile *per_objfile = call_site->per_objfile; compunit_symtab *cust = per_objfile->get_symtab (call_site->per_cu); - int sect_idx = COMPUNIT_BLOCK_LINE_SECTION (cust); + int sect_idx = cust->block_line_section (); CORE_ADDR delta = per_objfile->objfile->section_offsets[sect_idx]; return call_site->target.loc_physaddr () + delta; diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c index 8af96c79e6ca..795844733105 100644 --- a/gdb/gdbtypes.c +++ b/gdb/gdbtypes.c @@ -6285,7 +6285,7 @@ call_site::pc () const { compunit_symtab *cust = this->per_objfile->get_symtab (this->per_cu); CORE_ADDR delta - = this->per_objfile->objfile->section_offsets[COMPUNIT_BLOCK_LINE_SECTION (cust)]; + = this->per_objfile->objfile->section_offsets[cust->block_line_section ()]; return m_unrelocated_pc + delta; } diff --git a/gdb/objfiles.c b/gdb/objfiles.c index f363cb453f3a..7e1ec6ca92dd 100644 --- a/gdb/objfiles.c +++ b/gdb/objfiles.c @@ -660,7 +660,7 @@ objfile_relocate1 (struct objfile *objfile, if (l) { for (int i = 0; i < l->nitems; ++i) - l->item[i].pc += delta[COMPUNIT_BLOCK_LINE_SECTION (cust)]; + l->item[i].pc += delta[cust->block_line_section ()]; } } } @@ -668,7 +668,7 @@ objfile_relocate1 (struct objfile *objfile, for (compunit_symtab *cust : objfile->compunits ()) { const struct blockvector *bv = cust->blockvector (); - int block_line_section = COMPUNIT_BLOCK_LINE_SECTION (cust); + int block_line_section = cust->block_line_section (); if (BLOCKVECTOR_MAP (bv)) addrmap_relocate (BLOCKVECTOR_MAP (bv), delta[block_line_section]); diff --git a/gdb/symtab.c b/gdb/symtab.c index a0bc1dfea52e..70a9f10ea4b6 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -338,7 +338,7 @@ compunit_symtab::find_call_site (CORE_ADDR pc) const return nullptr; CORE_ADDR delta - = this->objfile ()->section_offsets[COMPUNIT_BLOCK_LINE_SECTION (this)]; + = this->objfile ()->section_offsets[this->block_line_section ()]; CORE_ADDR unrelocated_pc = pc - delta; struct call_site call_site_local (unrelocated_pc, nullptr, nullptr); diff --git a/gdb/symtab.h b/gdb/symtab.h index f9318ffdcb46..c59e3c3457c7 100644 --- a/gdb/symtab.h +++ b/gdb/symtab.h @@ -1521,6 +1521,16 @@ struct compunit_symtab m_blockvector = blockvector; } + int block_line_section () const + { + return m_block_line_section; + } + + void set_block_line_section (int block_line_section) + { + m_block_line_section = block_line_section; + } + /* Make PRIMARY_FILETAB the primary filetab of this compunit symtab. PRIMARY_FILETAB must already be a filetab of this compunit symtab. */ @@ -1578,7 +1588,7 @@ struct compunit_symtab /* Section in objfile->section_offsets for the blockvector and the linetable. Probably always SECT_OFF_TEXT. */ - int block_line_section; + int m_block_line_section; /* Symtab has been compiled with both optimizations and debug info so that GDB may stop skipping prologues as variables locations are valid already @@ -1616,7 +1626,6 @@ struct compunit_symtab using compunit_symtab_range = next_range; -#define COMPUNIT_BLOCK_LINE_SECTION(cust) ((cust)->block_line_section) #define COMPUNIT_LOCATIONS_VALID(cust) ((cust)->locations_valid) #define COMPUNIT_EPILOGUE_UNWIND_VALID(cust) ((cust)->epilogue_unwind_valid) #define COMPUNIT_MACRO_TABLE(cust) ((cust)->macro_table) -- 2.34.1