From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id GSAhFPjjnmDfJwAAWB0awg (envelope-from ) for ; Fri, 14 May 2021 16:56:24 -0400 Received: by simark.ca (Postfix, from userid 112) id 4600A1F11C; Fri, 14 May 2021 16:56:24 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-0.7 required=5.0 tests=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 92DC81E783 for ; Fri, 14 May 2021 16:56:23 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 2B559394482F; Fri, 14 May 2021 20:56:23 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2B559394482F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1621025783; bh=O9GkocvnDrH1buRsF8BM8f5PsNFoX5U0vD582KTX6Lo=; h=Subject:To:References:Date:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=x7TqPNjcqp9J1mQs/yn+1yp1gzv8fnNccQaoCEREx2khWNU6tEvmDvgL7Dpz9jlhp CeA0hZXobXK3RrXV4Zg4UIRWwJrzwBl5FS+w6rr+by+pSw4rMGknC5KRkN8mzAtG0h R9VBGb8DIQY89uv3X0whobYIU+O8Rq1DUtAq2BIk= Received: from smtp.polymtl.ca (smtp.polymtl.ca [132.207.4.11]) by sourceware.org (Postfix) with ESMTPS id DECA0385BF9D for ; Fri, 14 May 2021 20:56:20 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org DECA0385BF9D Received: from simark.ca (simark.ca [158.69.221.121]) (authenticated bits=0) by smtp.polymtl.ca (8.14.7/8.14.7) with ESMTP id 14EKuCIU032313 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 14 May 2021 16:56:17 -0400 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp.polymtl.ca 14EKuCIU032313 Received: from [10.0.0.11] (192-222-157-6.qc.cable.ebox.net [192.222.157.6]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id 9C5FF1E783; Fri, 14 May 2021 16:56:12 -0400 (EDT) Subject: Re: [PATCH] Fix macro info lookup for binaries containing DWARFv5 line table To: "Tomar, Sourabh Singh" , Keith Seitz , "gdb-patches@sourceware.org" References: <20210512171655.9463-1-SourabhSingh.Tomar@amd.com> <22ab603a-35e1-4048-3ccc-6738a13889df@redhat.com> <5ee2be96-e428-2c4d-2be1-8147922c85eb@polymtl.ca> Message-ID: <8035316c-5cc2-d650-ba89-05242f7e1f89@polymtl.ca> Date: Fri, 14 May 2021 16:56:12 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Fri, 14 May 2021 20:56:12 +0000 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@sourceware.org Sender: "Gdb-patches" > Thanks for sharing this, since both file0 and dir0 both are present, if possible, could you please share any behavior change or anything subtle you notice before/after > applying patch ? That gcc is in a container, so not to practical to test with. So I built various gcc versions from source to investigate this: - 10.2.0 (I did not actually build this one, it's the one from my distro) - 11.1.0 - 11 from today's git - master from today's git With gcc 10.2.0, as seen before, I don't get a DWARF 5 .debug_line section. With all three others, I get the same thing (modulo dir[2] which specific to the compiler version) that looks good: include_directories[ 0] = "/home/simark/build/binutils-gdb/gdb" include_directories[ 1] = "/usr/include" include_directories[ 2] = "/opt/gcc/git/lib/gcc/x86_64-pc-linux-gnu/12.0.0/include" include_directories[ 3] = "/usr/include/bits" include_directories[ 4] = "/usr/include/sys" include_directories[ 5] = "/usr/include/gnu" file_names[ 0]: name: "test.c" dir_index: 0 file_names[ 1]: name: "test.c" dir_index: 0 file_names[ 2]: name: "stdc-predef.h" dir_index: 1 file_names[ 3]: name: "stdint.h" dir_index: 2 file_names[ 4]: name: "stdint.h" dir_index: 1 I tested again using the gcc 11.1.0 from Ubuntu, that gave me a wrong dir[0] before. I replicated the same directory structure (/home/simark/build/binutils-gdb/gdb/...) in my Ubuntu container, and things look good actually: include_directories[ 0] = "/home/simark/build/binutils-gdb/gdb" include_directories[ 1] = "/usr/include" include_directories[ 2] = "/usr/lib/gcc/x86_64-linux-gnu/11/include" include_directories[ 3] = "/usr/include/x86_64-linux-gnu/bits" include_directories[ 4] = "/usr/include/x86_64-linux-gnu/sys" include_directories[ 5] = "/usr/include/x86_64-linux-gnu/gnu" file_names[ 0]: name: "test.c" dir_index: 0 file_names[ 1]: name: "test.c" dir_index: 0 file_names[ 2]: name: "stdc-predef.h" dir_index: 1 So I tried compiling a file in the root directory (/) on my (non-container) host, and I did see the weird output: include_directories[ 0] = "/usr/include" include_directories[ 1] = "/usr/include" include_directories[ 2] = "/usr/include/bits" include_directories[ 3] = "/usr/include/sys" include_directories[ 4] = "/usr/include/gnu" include_directories[ 5] = "/opt/gcc/11.1.0/lib/gcc/x86_64-pc-linux-gnu/11.1.0/include" include_directories[ 6] = "/usr/include/bits/types" file_names[ 0]: name: "test.c" dir_index: 0 file_names[ 1]: name: "test.c" dir_index: 0 file_names[ 2]: name: "stdc-predef.h" dir_index: 1 So that looks like a gcc bug that only happens when the compilation directory is the root. I'll go see if there's a gcc bug for this already and file one if there isn't. But other than that little corner case, the gcc 11+ -gdwarf-5 output looks good. I did a quick test loading the binary made using gcc master in GDB, and I wasn't able to print the macro - both without and with your patch. I didn't investigate further, I have to go now. Simon