From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id OK2AHFEMamL0AwMAWB0awg (envelope-from ) for ; Wed, 27 Apr 2022 23:38:57 -0400 Received: by simark.ca (Postfix, from userid 112) id 6EE971E058; Wed, 27 Apr 2022 23:38:57 -0400 (EDT) Authentication-Results: simark.ca; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=NhUecI1J; dkim-atps=neutral X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) 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=unavailable autolearn_force=no version=3.4.6 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 1B2AC1E00E for ; Wed, 27 Apr 2022 23:38:57 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id AED6F3858C2C for ; Thu, 28 Apr 2022 03:38:56 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org AED6F3858C2C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1651117136; bh=JTZ1aavC5aoMm6jxOFZ1JAK14QhQ0L0dFn5M4Gnk9XU=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=NhUecI1JxF4mbQankyPb25B2nSA9OzLGP1NIF3xT1iS+fFFKlUQxbk1dFXQmo85y8 9NrS2Sfdt8pUBMD5oMmz/biIF3b+ZcoyR5632ObJreMuYBldbaX9bKrDKKN7jkoLNZ KiwKUrP35VvkhUPrOPmnrfAw+62LL9UE6vZo6r3E= Received: from barracuda.ebox.ca (barracuda.ebox.ca [96.127.255.19]) by sourceware.org (Postfix) with ESMTPS id 4CD243857806 for ; Thu, 28 Apr 2022 03:35:56 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 4CD243857806 X-ASG-Debug-ID: 1651116944-0c856e06add0a480001-fS2M51 Received: from smtp.ebox.ca (smtp.ebox.ca [96.127.255.82]) by barracuda.ebox.ca with ESMTP id A04qiehQGCj4O7jz (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 27 Apr 2022 23:35:44 -0400 (EDT) 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 EB4A2441D65; Wed, 27 Apr 2022 23:35:43 -0400 (EDT) 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 v3 6/7] gdb: remove code to prepend comp dir in buildsym_compunit::start_subfile Date: Wed, 27 Apr 2022 23:35:41 -0400 X-ASG-Orig-Subj: [PATCH v3 6/7] gdb: remove code to prepend comp dir in buildsym_compunit::start_subfile Message-Id: <20220428033542.1636284-7-simon.marchi@polymtl.ca> X-Mailer: git-send-email 2.35.2 In-Reply-To: <20220428033542.1636284-1-simon.marchi@polymtl.ca> References: <20220428033542.1636284-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: 1651116944 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: 4014 X-Barracuda-BRTS-Status: 1 X-Barracuda-BRTS-Evidence: simark.ca X-Barracuda-Spam-Score: 0.90 X-Barracuda-Spam-Status: No, SCORE=0.90 using global scores of TAG_LEVEL=1000.0 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=8.0 tests=BSF_RULE7568M, BSF_SC0_SA085b X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.3.97646 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- 0.50 BSF_RULE7568M Custom Rule 7568M 0.40 BSF_SC0_SA085b Custom Rule SA085b 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 Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" The bit of code removed by this patch was introduced to fix the same kind of problem that the previous patch fixes. That is, to try to match existing subfiles when different name forms are used to refer to a same file. The thread for the patch that introduced this code is: https://pi.simark.ca/gdb-patches/45F8CBDF.9090501@hq.tensilica.com/ The important bits are that the compiler produced a compilation unit with: DW_AT_name : test.c DW_AT_comp_dir : /home/maxim/W/BadgerPass/PR_14999 and DWARF v2 line table with: The Directory Table: /home/maxim/W/BadgerPass/PR_14999 The File Name Table: Entry Dir Time Size Name 1 1 1173897037 152 test.c Because the main symtab was created with only DW_AT_name, it was named "test.c". And because the path built from the line header contained the "directory" part, it was "/home/maxim/W/BadgerPass/PR_14999/test.c". Because of this mismatch, thing didn't work, so they added this code to prepend the compilation directory to the existing subfile names, so that this specific case would work. With the changes done earlier in this series, where subfiles are identified using the "most complete path possible", this case would be handled. The main subfile's would be "/home/maxim/W/BadgerPass/PR_14999/test.c" from the start (DW_AT_comp_dir + DW_AT_name). It's not so different from some DWARF 5 cases actually, which make the compilation directory explicit in the line table header. I therefore think that this code is no longer needed. It does feel like a quick hack to make one specific case work, and we have a more general solution now. Also, this code was introduced to work around a problem in the DWARF debug info or the DWARF debug info reader. In general, I think it's preferable for these hacks to be located in the specific debug info reader code, rather than in the common code. Even though this code was added to work around a DWARF reader problem, it's possible that some other debug info reader has started taking advantage of this code in the mean time. It's very difficult to know or verify, but I think the likelyhood is quite small, so I'm proposing to get rid of it to simplify things a little bit. Change-Id: I710b8ec0d449d1b110d67ddf9fcbdb2b37108306 --- gdb/buildsym.c | 32 +++++++------------------------- 1 file changed, 7 insertions(+), 25 deletions(-) diff --git a/gdb/buildsym.c b/gdb/buildsym.c index bb258b983ca4..4672d937bd98 100644 --- a/gdb/buildsym.c +++ b/gdb/buildsym.c @@ -498,31 +498,13 @@ buildsym_compunit::start_subfile (const char *name, const char *name_for_id) symtab_create_debug_printf ("name = %s, name_for_id = %s", name, name_for_id); for (subfile *subfile = m_subfiles; subfile; subfile = subfile->next) - { - std::string subfile_name_holder; - const char *subfile_name_for_id; - - /* If NAME is an absolute path, and this subfile is not, then - attempt to create an absolute path to compare. */ - if (IS_ABSOLUTE_PATH (name_for_id) - && !IS_ABSOLUTE_PATH (subfile->name_for_id) - && !m_comp_dir.empty ()) - { - subfile_name_holder = path_join (m_comp_dir.c_str (), - subfile->name_for_id.c_str ()); - subfile_name_for_id = subfile_name_holder.c_str (); - } - else - subfile_name_for_id = subfile->name_for_id.c_str (); - - if (FILENAME_CMP (subfile_name_for_id, name_for_id) == 0) - { - symtab_create_debug_printf ("found existing symtab with name_for_id %s (%s)", - subfile->name_for_id.c_str (), subfile_name_for_id); - m_current_subfile = subfile; - return; - } - } + if (FILENAME_CMP (subfile->name_for_id.c_str (), name_for_id) == 0) + { + symtab_create_debug_printf ("found existing symtab with name_for_id %s", + subfile->name_for_id.c_str ()); + m_current_subfile = subfile; + return; + } /* This subfile is not known. Add an entry for it. */ -- 2.35.2