From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id 75FAF3858D28 for ; Mon, 17 Oct 2022 13:22:37 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 75FAF3858D28 Received: from [10.0.0.11] (unknown [217.28.27.60]) (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 291AD1E0D3; Mon, 17 Oct 2022 09:22:37 -0400 (EDT) Message-ID: <7ed10ff3-234e-5b47-bce4-ad1376f46603@simark.ca> Date: Mon, 17 Oct 2022 09:22:36 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.3.1 Subject: Re: [PATCH v2] gdb: Fix issue with Clang CLI macros Content-Language: en-US To: Bruno Larsen , gdb-patches@sourceware.org References: <20221017102627.2540273-1-blarsen@redhat.com> From: Simon Marchi In-Reply-To: <20221017102627.2540273-1-blarsen@redhat.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-5.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, NICE_REPLY_A, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) 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: Mon, 17 Oct 2022 13:22:39 -0000 On 2022-10-17 06:26, Bruno Larsen via Gdb-patches wrote: > Clang up to the current version adds macros that were defined in the > command line or by "other means", according to the Dwarf specification, > after the last DW_MACRO_end_file, instead of before the first > DW_MACRO_start_file, as the specification dictates. When GDB reads the > macros after the last file is closed, the macros never end up "in scope" > and so we can't print them. This has been submitted as a bug to Clang > developers, and PR macros/29034 was opened for GDB to keep track of > this. > > Seeing as there is no expected date for it to be fixed, a workaround was > added for all current versions of Clang. The workaround detects when > the main file would be closed and if the producer is clang, and turns > that operation into a noop, so we keep a reference to the current_file > as those macros are read. > > A test case was added to confirm the functionality. > > Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29034 I forgot to mention, should this setup_kfail be removed? https://gitlab.com/gnutools/binutils-gdb/-/blob/e57f7fa070e16683c0e1ddd0d1307d243fad990d/gdb/testsuite/gdb.base/macro-source-path.exp#L68 Simon