From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from barracuda.ebox.ca (barracuda.ebox.ca [96.127.255.19]) by sourceware.org (Postfix) with ESMTPS id A6CF7385BF9C for ; Fri, 28 Jan 2022 12:45:41 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org A6CF7385BF9C X-ASG-Debug-ID: 1643373931-0c856e06ab271b00001-fS2M51 Received: from smtp.ebox.ca (smtp.ebox.ca [96.127.255.82]) by barracuda.ebox.ca with ESMTP id ruUfcKlB8DFBflod (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 28 Jan 2022 07:45:31 -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 B1DB8441D64; Fri, 28 Jan 2022 07:45:31 -0500 (EST) From: Simon Marchi 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 Cc: Simon Marchi Subject: [PATCH 01/33] gdb: add getter/setter for compunit_symtab::objfile Date: Fri, 28 Jan 2022 07:44:59 -0500 X-ASG-Orig-Subj: [PATCH 01/33] gdb: add getter/setter for compunit_symtab::objfile Message-Id: <20220128124531.2302941-2-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: 1643373931 X-Barracuda-Encrypted: DHE-RSA-AES256-SHA X-Barracuda-URL: https://96.127.255.19:443/cgi-mod/mark.cgi X-Virus-Scanned: by bsmtpd at ebox.ca X-Barracuda-Scan-Msg-Size: 3761 X-Barracuda-BRTS-Status: 1 X-Barracuda-Spam-Score: 0.50 X-Barracuda-Spam-Status: No, SCORE=0.50 using global scores of TAG_LEVEL=1000.0 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=8.0 tests=BSF_RULE7568M X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.3.95629 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- 0.50 BSF_RULE7568M Custom Rule 7568M X-Spam-Status: No, score=-3613.3 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_QUARANTINE, KAM_DMARC_STATUS, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_SOFTFAIL, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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-List-Received-Date: Fri, 28 Jan 2022 12:45:42 -0000 From: Simon Marchi Rename the field to m_objfile, and add a getter and a setter. Update all users. Change-Id: If7e2f763ee3e70570140d9af9261b1b056253317 --- gdb/symfile.c | 8 ++++---- gdb/symmisc.c | 2 +- gdb/symtab.c | 2 +- gdb/symtab.h | 14 ++++++++++++-- 4 files changed, 18 insertions(+), 8 deletions(-) diff --git a/gdb/symfile.c b/gdb/symfile.c index 9bd4f48d0b02..a660422b51e0 100644 --- a/gdb/symfile.c +++ b/gdb/symfile.c @@ -2774,7 +2774,7 @@ deduce_language_from_filename (const char *filename) struct symtab * allocate_symtab (struct compunit_symtab *cust, const char *filename) { - struct objfile *objfile = cust->objfile; + struct objfile *objfile = cust->objfile (); struct symtab *symtab = OBSTACK_ZALLOC (&objfile->objfile_obstack, struct symtab); @@ -2832,7 +2832,7 @@ allocate_compunit_symtab (struct objfile *objfile, const char *name) struct compunit_symtab); const char *saved_name; - cu->objfile = objfile; + cu->set_objfile (objfile); /* The name we record here is only for display/debugging purposes. Just save the basename to avoid path issues (too long for display, @@ -2858,8 +2858,8 @@ allocate_compunit_symtab (struct objfile *objfile, const char *name) void add_compunit_symtab_to_objfile (struct compunit_symtab *cu) { - cu->next = cu->objfile->compunit_symtabs; - cu->objfile->compunit_symtabs = cu; + cu->next = cu->objfile ()->compunit_symtabs; + cu->objfile ()->compunit_symtabs = cu; } diff --git a/gdb/symmisc.c b/gdb/symmisc.c index cd51f6645c56..19c387d852d7 100644 --- a/gdb/symmisc.c +++ b/gdb/symmisc.c @@ -957,7 +957,7 @@ maintenance_print_one_line_table (struct symtab *symtab, void *data) struct linetable *linetable; struct objfile *objfile; - objfile = symtab->compunit_symtab->objfile; + objfile = symtab->compunit_symtab->objfile (); printf_filtered (_("objfile: %ps ((struct objfile *) %s)\n"), styled_string (file_name_style.style (), objfile_name (objfile)), diff --git a/gdb/symtab.c b/gdb/symtab.c index a32e561ed774..44b5bfb43bbf 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[COMPUNIT_BLOCK_LINE_SECTION (this)]; 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 55d1b772c457..995026bbf82f 100644 --- a/gdb/symtab.h +++ b/gdb/symtab.h @@ -1449,6 +1449,16 @@ struct symtab struct compunit_symtab { + struct objfile *objfile () const + { + return m_objfile; + } + + void set_objfile (struct objfile *objfile) + { + m_objfile = objfile; + } + /* Set m_call_site_htab. */ void set_call_site_htab (htab_t call_site_htab); @@ -1459,7 +1469,7 @@ struct compunit_symtab struct compunit_symtab *next; /* Object file from which this symtab information was read. */ - struct objfile *objfile; + struct objfile *m_objfile; /* Name of the symtab. This is *not* intended to be a usable filename, and is @@ -1535,7 +1545,7 @@ struct compunit_symtab using compunit_symtab_range = next_range; -#define COMPUNIT_OBJFILE(cust) ((cust)->objfile) +#define COMPUNIT_OBJFILE(cust) ((cust)->objfile ()) #define COMPUNIT_FILETABS(cust) ((cust)->filetabs) #define COMPUNIT_DEBUGFORMAT(cust) ((cust)->debugformat) #define COMPUNIT_PRODUCER(cust) ((cust)->producer) -- 2.34.1