From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id QO4OLHMJfWLK3gUAWB0awg (envelope-from ) for ; Thu, 12 May 2022 09:19:47 -0400 Received: by simark.ca (Postfix, from userid 112) id AC4AB1E220; Thu, 12 May 2022 09:19:47 -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=o7VsqC9n; 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=-4.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,NICE_REPLY_A,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 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 4E4891E00D for ; Thu, 12 May 2022 09:19:47 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id E9DE73836436 for ; Thu, 12 May 2022 13:19:46 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E9DE73836436 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1652361587; bh=5musPcX+R3g2VzYY0e2hGQ45UBqGkNeBabxAGZ3+g3Y=; h=Date:Subject:To:References:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=o7VsqC9nSOax2vOEczNsFcEHWGqY8NwRGZYS1ENE+ygBX9fDO0NVUo0AaBxI8FtXx KzXztSoFkd4w+azhL+QlBt/W3+fOvXBeZ8n4s3IRpyeSMFlUQaA1N2hOba/1dM7AIi +VbU5iVFU4ecmRqTUL0tmD3k6GUzrKCUBLvAb+pk= Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 59A22384B12B for ; Thu, 12 May 2022 13:07:21 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 59A22384B12B Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-576-DvryaT35OACudKrWWZGayw-1; Thu, 12 May 2022 09:07:17 -0400 X-MC-Unique: DvryaT35OACudKrWWZGayw-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 3F4518038E3; Thu, 12 May 2022 13:07:17 +0000 (UTC) Received: from [10.97.116.28] (ovpn-116-28.gru2.redhat.com [10.97.116.28]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 04DD6112131E; Thu, 12 May 2022 13:07:15 +0000 (UTC) Message-ID: <6e9157d0-4f5d-82e9-3588-9e5318e9cdb7@redhat.com> Date: Thu, 12 May 2022 10:07:14 -0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.8.0 Subject: Re: [PATCH v3 6/7] gdb: remove code to prepend comp dir in buildsym_compunit::start_subfile To: Simon Marchi , gdb-patches@sourceware.org References: <20220428033542.1636284-1-simon.marchi@polymtl.ca> <20220428033542.1636284-7-simon.marchi@polymtl.ca> In-Reply-To: <20220428033542.1636284-7-simon.marchi@polymtl.ca> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit 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: Bruno Larsen via Gdb-patches Reply-To: Bruno Larsen Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" On 4/28/22 00:35, Simon Marchi via Gdb-patches wrote: > 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 Hello Simon, This change seems reasonable, and local testing found no regressions. In fact, because this prepending code was not always applied, it caused some problems when testing using clang, and removing it has fixed failures in gdb.base/maint.exp and gdb.base/jit-elf.exp! FWIW, I think you can approve your patch. Cheers! Bruno Larsen > --- > 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. */ >