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 DD13C385C40E for ; Fri, 28 Jan 2022 12:47:41 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org DD13C385C40E X-ASG-Debug-ID: 1643374052-0c856e06ab271bf0001-fS2M51 Received: from smtp.ebox.ca (smtp.ebox.ca [96.127.255.82]) by barracuda.ebox.ca with ESMTP id Fen3ArpgINHFHAsp (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 6BFDA441D65; Fri, 28 Jan 2022 07:47:32 -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 10/33] gdb: remove COMPUNIT_DIRNAME macro, add getter/setter Date: Fri, 28 Jan 2022 07:45:08 -0500 X-ASG-Orig-Subj: [PATCH 10/33] gdb: remove COMPUNIT_DIRNAME macro, add getter/setter Message-Id: <20220128124531.2302941-11-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-Virus-Scanned: by bsmtpd at ebox.ca X-Barracuda-Scan-Msg-Size: 5885 X-Barracuda-BRTS-Status: 1 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-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:47:43 -0000 From: Simon Marchi Add a getter and a setter for a compunit_symtab's dirname. Remove the corresponding macro and adjust all callers. Change-Id: If2f39b295fd26822586485e04a8b8b5aa5cc9b2e --- gdb/buildsym-legacy.c | 2 +- gdb/buildsym.c | 4 ++-- gdb/dwarf2/read.c | 4 ++-- gdb/jit.c | 2 +- gdb/macrotab.c | 2 +- gdb/symmisc.c | 5 ++--- gdb/symtab.h | 16 ++++++++++++---- 7 files changed, 21 insertions(+), 14 deletions(-) diff --git a/gdb/buildsym-legacy.c b/gdb/buildsym-legacy.c index aa7b8b56b89a..7659f53cbe09 100644 --- a/gdb/buildsym-legacy.c +++ b/gdb/buildsym-legacy.c @@ -303,7 +303,7 @@ restart_symtab (struct compunit_symtab *cust, buildsym_compunit = new struct buildsym_compunit (cust->objfile (), name, - COMPUNIT_DIRNAME (cust), + cust->dirname (), compunit_language (cust), start_addr, cust); diff --git a/gdb/buildsym.c b/gdb/buildsym.c index 227272776131..b96d154331a3 100644 --- a/gdb/buildsym.c +++ b/gdb/buildsym.c @@ -1005,8 +1005,8 @@ buildsym_compunit::end_symtab_with_blockvector (struct block *static_block, { /* Reallocate the dirname on the symbol obstack. */ const char *comp_dir = m_comp_dir.get (); - COMPUNIT_DIRNAME (cu) = obstack_strdup (&m_objfile->objfile_obstack, - comp_dir); + cu->set_dirname (obstack_strdup (&m_objfile->objfile_obstack, + comp_dir)); } /* Save the debug format string (if any) in the symtab. */ diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index 7e62d11aa2cc..cd3e6afbe87f 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -10723,7 +10723,7 @@ dwarf2_cu::setup_type_unit_groups (struct die_info *die) struct compunit_symtab *cust = tug_unshare->compunit_symtab; m_builder.reset (new struct buildsym_compunit (cust->objfile (), "", - COMPUNIT_DIRNAME (cust), + cust->dirname (), compunit_language (cust), 0, cust)); list_in_scope = get_builder ()->get_file_symbols (); @@ -10775,7 +10775,7 @@ dwarf2_cu::setup_type_unit_groups (struct die_info *die) struct compunit_symtab *cust = tug_unshare->compunit_symtab; m_builder.reset (new struct buildsym_compunit (cust->objfile (), "", - COMPUNIT_DIRNAME (cust), + cust->dirname (), compunit_language (cust), 0, cust)); list_in_scope = get_builder ()->get_file_symbols (); diff --git a/gdb/jit.c b/gdb/jit.c index 007313d3b800..2c33eb3c9332 100644 --- a/gdb/jit.c +++ b/gdb/jit.c @@ -504,7 +504,7 @@ finalize_symtab (struct gdb_symtab *stab, struct objfile *objfile) add_compunit_symtab_to_objfile (cust); /* JIT compilers compile in memory. */ - COMPUNIT_DIRNAME (cust) = NULL; + cust->set_dirname (nullptr); /* Copy over the linetable entry if one was provided. */ if (stab->linetable) diff --git a/gdb/macrotab.c b/gdb/macrotab.c index 92d68e78e71d..7ca3f312d330 100644 --- a/gdb/macrotab.c +++ b/gdb/macrotab.c @@ -1066,7 +1066,7 @@ macro_source_fullname (struct macro_source_file *file) const char *comp_dir = NULL; if (file->table->compunit_symtab != NULL) - comp_dir = COMPUNIT_DIRNAME (file->table->compunit_symtab); + comp_dir = file->table->compunit_symtab->dirname (); if (comp_dir == NULL || IS_ABSOLUTE_PATH (file->filename)) return file->filename; diff --git a/gdb/symmisc.c b/gdb/symmisc.c index b946fc8bde04..9c882a468b27 100644 --- a/gdb/symmisc.c +++ b/gdb/symmisc.c @@ -782,9 +782,8 @@ maintenance_info_symtabs (const char *regexp, int from_tty) (cust->producer () != nullptr ? cust->producer () : "(null)")); printf_filtered (" dirname %s\n", - COMPUNIT_DIRNAME (cust) != NULL - ? COMPUNIT_DIRNAME (cust) - : "(null)"); + (cust->dirname () != NULL + ? cust->dirname () : "(null)")); printf_filtered (" blockvector" " ((struct blockvector *) %s)\n", host_address_to_string diff --git a/gdb/symtab.h b/gdb/symtab.h index 1e3f95dc92fa..b72abab2ab5a 100644 --- a/gdb/symtab.h +++ b/gdb/symtab.h @@ -1413,8 +1413,7 @@ using symtab_range = next_range; #define SYMTAB_OBJFILE(symtab) \ (SYMTAB_COMPUNIT (symtab)->objfile ()) #define SYMTAB_PSPACE(symtab) (SYMTAB_OBJFILE (symtab)->pspace) -#define SYMTAB_DIRNAME(symtab) \ - COMPUNIT_DIRNAME (SYMTAB_COMPUNIT (symtab)) +#define SYMTAB_DIRNAME(symtab) (SYMTAB_COMPUNIT (symtab)->dirname ()) /* Compunit symtabs contain the actual "symbol table", aka blockvector, as well as the list of all source files (what gdb has historically associated with @@ -1502,6 +1501,16 @@ struct compunit_symtab m_producer = producer; } + const char *dirname () const + { + return m_dirname; + } + + void set_dirname (const char *dirname) + { + m_dirname = dirname; + } + /* Make PRIMARY_FILETAB the primary filetab of this compunit symtab. PRIMARY_FILETAB must already be a filetab of this compunit symtab. */ @@ -1551,7 +1560,7 @@ struct compunit_symtab const char *m_producer; /* Directory in which it was compiled, or NULL if we don't know. */ - const char *dirname; + const char *m_dirname; /* List of all symbol scope blocks for this symtab. It is shared among all symtabs in a given compilation unit. */ @@ -1597,7 +1606,6 @@ struct compunit_symtab using compunit_symtab_range = next_range; -#define COMPUNIT_DIRNAME(cust) ((cust)->dirname) #define COMPUNIT_BLOCKVECTOR(cust) ((cust)->blockvector) #define COMPUNIT_BLOCK_LINE_SECTION(cust) ((cust)->block_line_section) #define COMPUNIT_LOCATIONS_VALID(cust) ((cust)->locations_valid) -- 2.34.1