From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id WNQMJrnm82EjewAAWB0awg (envelope-from ) for ; Fri, 28 Jan 2022 07:51:05 -0500 Received: by simark.ca (Postfix, from userid 112) id 975E61F3B7; Fri, 28 Jan 2022 07:51:05 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (server2.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 130CD1EE18 for ; Fri, 28 Jan 2022 07:51:05 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 9A3E83947C32 for ; Fri, 28 Jan 2022 12:51:04 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9A3E83947C32 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1643374264; bh=VyplVk02Vj1rGV7c8R+8CjMP3OK+L5Dvu7iq2b1jxOA=; 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=rKvtm402wf29lRMWHIhrAtBcXs2eVkfmaI0zcjVYmZarTSh9K5/7NXUDyqpieuoPG diAkpUksSsU2PcKXs23Nn82XCvEMFV5HForeah89zYgHr0AklzcyBP+lMyXk4Et/SG QrRhjiEtNLlOtKUaJRxQl+eHXOUs+r6btvdnuVYs= Received: from barracuda.ebox.ca (barracuda.ebox.ca [96.127.255.19]) by sourceware.org (Postfix) with ESMTPS id E0FA53947C1E for ; Fri, 28 Jan 2022 12:47:37 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org E0FA53947C1E X-ASG-Debug-ID: 1643374052-0c856e06ad2719e0001-fS2M51 Received: from smtp.ebox.ca (smtp.ebox.ca [96.127.255.82]) by barracuda.ebox.ca with ESMTP id 7gWWJ8Edux1LuKNI (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 28 Jan 2022 07:47:33 -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 C0DFB441D6A; 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 15/33] gdb: remove COMPUNIT_MACRO_TABLE macro, add getter/setter Date: Fri, 28 Jan 2022 07:45:13 -0500 X-ASG-Orig-Subj: [PATCH 15/33] gdb: remove COMPUNIT_MACRO_TABLE macro, add getter/setter Message-Id: <20220128124531.2302941-16-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: 1643374053 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: 4066 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 macro table. Remove the corresponding macro and adjust all callers. Change-Id: I00615ea72d5ac43d9a865e941cb2de0a979c173a --- gdb/buildsym.c | 2 +- gdb/macroscope.c | 4 ++-- gdb/mi/mi-cmd-file.c | 2 +- gdb/source.c | 4 ++-- gdb/symtab.h | 14 +++++++++++--- 5 files changed, 17 insertions(+), 9 deletions(-) diff --git a/gdb/buildsym.c b/gdb/buildsym.c index 1b162dac9e07..b42c40830c90 100644 --- a/gdb/buildsym.c +++ b/gdb/buildsym.c @@ -1024,7 +1024,7 @@ buildsym_compunit::end_symtab_with_blockvector (struct block *static_block, cu->set_block_line_section (section); - COMPUNIT_MACRO_TABLE (cu) = release_macros (); + cu->set_macro_table (release_macros ()); /* Default any symbols without a specified symtab to the primary symtab. */ { diff --git a/gdb/macroscope.c b/gdb/macroscope.c index 02070967579f..c581c426eda0 100644 --- a/gdb/macroscope.c +++ b/gdb/macroscope.c @@ -44,12 +44,12 @@ sal_macro_scope (struct symtab_and_line sal) if (sal.symtab == NULL) return NULL; cust = SYMTAB_COMPUNIT (sal.symtab); - if (COMPUNIT_MACRO_TABLE (cust) == NULL) + if (cust->macro_table () == NULL) return NULL; gdb::unique_xmalloc_ptr ms (XNEW (struct macro_scope)); - main_file = macro_main (COMPUNIT_MACRO_TABLE (cust)); + main_file = macro_main (cust->macro_table ()); inclusion = macro_lookup_inclusion (main_file, sal.symtab->filename); if (inclusion) diff --git a/gdb/mi/mi-cmd-file.c b/gdb/mi/mi-cmd-file.c index 23c6d7021e2e..f4ee791f17b5 100644 --- a/gdb/mi/mi-cmd-file.c +++ b/gdb/mi/mi-cmd-file.c @@ -59,7 +59,7 @@ mi_cmd_file_list_exec_source_file (const char *command, char **argv, int argc) uiout->field_string ("fullname", symtab_to_fullname (st.symtab)); uiout->field_signed ("macro-info", - COMPUNIT_MACRO_TABLE (SYMTAB_COMPUNIT (st.symtab)) != NULL); + SYMTAB_COMPUNIT (st.symtab)->macro_table () != NULL); } /* Implement -file-list-exec-source-files command. */ diff --git a/gdb/source.c b/gdb/source.c index 07ea2af9fd85..e6ba44819413 100644 --- a/gdb/source.c +++ b/gdb/source.c @@ -729,8 +729,8 @@ info_source_command (const char *ignore, int from_tty) printf_filtered (_("Compiled with %s debugging format.\n"), cust->debugformat ()); printf_filtered (_("%s preprocessor macro info.\n"), - COMPUNIT_MACRO_TABLE (cust) != NULL - ? "Includes" : "Does not include"); + (cust->macro_table () != nullptr + ? "Includes" : "Does not include")); } diff --git a/gdb/symtab.h b/gdb/symtab.h index 5419e70ced6a..c319d51a2714 100644 --- a/gdb/symtab.h +++ b/gdb/symtab.h @@ -1551,6 +1551,16 @@ struct compunit_symtab m_epilogue_unwind_valid = epilogue_unwind_valid; } + struct macro_table *macro_table () const + { + return m_macro_table; + } + + void set_macro_table (struct macro_table *macro_table) + { + m_macro_table = macro_table; + } + /* Make PRIMARY_FILETAB the primary filetab of this compunit symtab. PRIMARY_FILETAB must already be a filetab of this compunit symtab. */ @@ -1626,7 +1636,7 @@ struct compunit_symtab is shared between different symtabs in a given compilation unit. It's debatable whether it *should* be shared among all the symtabs in the given compilation unit, but it currently is. */ - struct macro_table *macro_table; + struct macro_table *m_macro_table; /* If non-NULL, then this points to a NULL-terminated vector of included compunits. When searching the static or global @@ -1646,8 +1656,6 @@ struct compunit_symtab using compunit_symtab_range = next_range; -#define COMPUNIT_MACRO_TABLE(cust) ((cust)->macro_table) - /* Return the language of CUST. */ extern enum language compunit_language (const struct compunit_symtab *cust); -- 2.34.1