From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id UMFpNNLn82EjewAAWB0awg (envelope-from ) for ; Fri, 28 Jan 2022 07:55:46 -0500 Received: by simark.ca (Postfix, from userid 112) id D45061F3B7; Fri, 28 Jan 2022 07:55:46 -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 40D0C1EE18 for ; Fri, 28 Jan 2022 07:55:46 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id D614B394742B for ; Fri, 28 Jan 2022 12:55:45 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D614B394742B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1643374545; bh=p1RW/YaYCcze1DTAqasb2Ra1XQ+4synfSM9MFPhsfZw=; 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=QD6QTW1t5qBPso+cczLEhYi7yEMhCHbCEYhXzcnc/liEQGid58gtu2Mzh+p0Ozss+ tIFNVN/ZczmgwZ15JPOrrn5UgydSS7z/dgg6Ndk4K/DMXacp8pEeYKvsYBgSC0LFNd kRbhzuyINl8Djmrj7LjXRmdUDPwmAEOEHr8hKR0g= Received: from barracuda.ebox.ca (barracuda.ebox.ca [96.127.255.19]) by sourceware.org (Postfix) with ESMTPS id 4C083385C407 for ; Fri, 28 Jan 2022 12:49:41 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 4C083385C407 X-ASG-Debug-ID: 1643374173-0c856e06ab271ca0001-fS2M51 Received: from smtp.ebox.ca (smtp.ebox.ca [96.127.255.82]) by barracuda.ebox.ca with ESMTP id aQFNzhgPZ3oguLcj (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 28 Jan 2022 07:49: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 519F2441B21; Fri, 28 Jan 2022 07:49:33 -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 22/33] gdb: remove SYMTAB_DIRNAME macro Date: Fri, 28 Jan 2022 07:45:20 -0500 X-ASG-Orig-Subj: [PATCH 22/33] gdb: remove SYMTAB_DIRNAME macro Message-Id: <20220128124531.2302941-23-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: 1643374173 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: 4668 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-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 Remove the macro, replace with an equivalent method. Change-Id: I46ec36b91bb734331138eb9cd086b2db01635aed --- gdb/cli/cli-cmds.c | 4 ++-- gdb/source.c | 14 +++++++------- gdb/symmisc.c | 4 ++-- gdb/symtab.h | 10 ++++++++-- 4 files changed, 19 insertions(+), 13 deletions(-) diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c index 67155daf5b02..eb14ee131a47 100644 --- a/gdb/cli/cli-cmds.c +++ b/gdb/cli/cli-cmds.c @@ -2033,8 +2033,8 @@ ambiguous_line_spec (gdb::array_view sals, static int cmp_symtabs (const symtab_and_line &sala, const symtab_and_line &salb) { - const char *dira = SYMTAB_DIRNAME (sala.symtab); - const char *dirb = SYMTAB_DIRNAME (salb.symtab); + const char *dira = sala.symtab->dirname (); + const char *dirb = salb.symtab->dirname (); int r; if (dira == NULL) diff --git a/gdb/source.c b/gdb/source.c index 1339c4a727f3..53854c02eac1 100644 --- a/gdb/source.c +++ b/gdb/source.c @@ -713,8 +713,8 @@ info_source_command (const char *ignore, int from_tty) cust = s->compunit (); printf_filtered (_("Current source file is %s\n"), s->filename); - if (SYMTAB_DIRNAME (s) != NULL) - printf_filtered (_("Compilation directory is %s\n"), SYMTAB_DIRNAME (s)); + if (s->dirname () != NULL) + printf_filtered (_("Compilation directory is %s\n"), s->dirname ()); if (s->fullname) printf_filtered (_("Located in %s\n"), s->fullname); const std::vector *offsets; @@ -1180,7 +1180,7 @@ open_source_file (struct symtab *s) gdb::unique_xmalloc_ptr fullname (s->fullname); s->fullname = NULL; - scoped_fd fd = find_and_open_source (s->filename, SYMTAB_DIRNAME (s), + scoped_fd fd = find_and_open_source (s->filename, s->dirname (), &fullname); if (fd.get () < 0) @@ -1192,9 +1192,9 @@ open_source_file (struct symtab *s) std::string srcpath; if (IS_ABSOLUTE_PATH (s->filename)) srcpath = s->filename; - else if (SYMTAB_DIRNAME (s) != nullptr) + else if (s->dirname () != nullptr) { - srcpath = SYMTAB_DIRNAME (s); + srcpath = s->dirname (); srcpath += SLASH_STRING; srcpath += s->filename; } @@ -1268,10 +1268,10 @@ symtab_to_fullname (struct symtab *s) /* rewrite_source_path would be applied by find_and_open_source, we should report the pathname where GDB tried to find the file. */ - if (SYMTAB_DIRNAME (s) == NULL || IS_ABSOLUTE_PATH (s->filename)) + if (s->dirname () == NULL || IS_ABSOLUTE_PATH (s->filename)) fullname.reset (xstrdup (s->filename)); else - fullname.reset (concat (SYMTAB_DIRNAME (s), SLASH_STRING, + fullname.reset (concat (s->dirname (), SLASH_STRING, s->filename, (char *) NULL)); s->fullname = rewrite_source_path (fullname.get ()).release (); diff --git a/gdb/symmisc.c b/gdb/symmisc.c index 62b584041def..179b83e416fe 100644 --- a/gdb/symmisc.c +++ b/gdb/symmisc.c @@ -249,9 +249,9 @@ dump_symtab_1 (struct symtab *symtab, struct ui_file *outfile) symtab_to_filename_for_display (symtab), host_address_to_string (symtab)); - if (SYMTAB_DIRNAME (symtab) != NULL) + if (symtab->dirname () != NULL) fprintf_filtered (outfile, "Compilation directory is %s\n", - SYMTAB_DIRNAME (symtab)); + symtab->dirname ()); fprintf_filtered (outfile, "Read from object file %s (%s)\n", objfile_name (objfile), host_address_to_string (objfile)); diff --git a/gdb/symtab.h b/gdb/symtab.h index 5ef4bdaa1109..88dab003c5c3 100644 --- a/gdb/symtab.h +++ b/gdb/symtab.h @@ -1409,6 +1409,8 @@ struct symtab program_space *pspace () const; + const char *dirname () const; + /* Unordered chain of all filetabs in the compunit, with the exception that the "main" source file is the first entry in the list. */ @@ -1441,8 +1443,6 @@ struct symtab using symtab_range = next_range; -#define SYMTAB_DIRNAME(symtab) ((symtab)->compunit ()->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 the term "symtab"). @@ -1696,6 +1696,12 @@ symtab::objfile () const return this->compunit ()->objfile (); } +inline const char * +symtab::dirname () const +{ + return this->compunit ()->dirname (); +} + /* Return the language of CUST. */ extern enum language compunit_language (const struct compunit_symtab *cust); -- 2.34.1