From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id bR9bKgtHv2ddmD4AWB0awg (envelope-from ) for ; Wed, 26 Feb 2025 11:53:31 -0500 Received: by simark.ca (Postfix, from userid 112) id A40681E105; Wed, 26 Feb 2025 11:53:31 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-5.3 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=unavailable autolearn_force=no version=4.0.0 Received: from server2.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 ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 5DCDC1E05C for ; Wed, 26 Feb 2025 11:53:31 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 0A3193858D33 for ; Wed, 26 Feb 2025 16:53:31 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0A3193858D33 Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id E623F3858CDA for ; Wed, 26 Feb 2025 16:52:59 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E623F3858CDA Authentication-Results: sourceware.org; dmarc=fail (p=none dis=none) header.from=efficios.com Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=efficios.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org E623F3858CDA Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=158.69.221.121 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1740588780; cv=none; b=bujDCooDLPvj/M/6UmAStun0PgSF+3af1FaeDhy08eGmu16tHz7HnlWQiN0fjSgHydFdAtDCeelGsti6+lsjyS4qk2W4+0+GnZAfYN/P4iGJHcfV+/31TbvYN9+NL+l7XdHaGU6yl73n1t87boc705BvAgXC2ea1ZznItT/R5mI= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1740588780; c=relaxed/simple; bh=epw2VTA946AVuvQC9onW/P5OtQWau/qhUc91w2W8eKg=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=eK3YWo2uZjyBccfB+/5Hm96pL4vaOAN/aQHzrk7FtvoyghwgcRT7oOgnu8OsOlkse4N288doPWlz5/Wv4ioisLc4QXG1Pvv4p2/UNuLDolFgI4Uy1/a2Y5MOYibCqSE3FuNzsQ3O2pejYxArD/mtBs9xkK+/q0I/kiu7L82HU7U= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E623F3858CDA Received: by simark.ca (Postfix, from userid 112) id 9B4E31E10A; Wed, 26 Feb 2025 11:52:59 -0500 (EST) Received: from smarchi-efficios.internal.efficios.com (96-127-217-162.qc.cable.ebox.net [96.127.217.162]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id 83C051E0BB; Wed, 26 Feb 2025 11:52:57 -0500 (EST) From: Simon Marchi To: gdb-patches@sourceware.org Cc: Simon Marchi Subject: [PATCH 2/2] gdb/dwarf: fix failed assertion in dwarf2_find_containing_comp_unit selftest Date: Wed, 26 Feb 2025 11:52:32 -0500 Message-ID: <20250226165255.25737-2-simon.marchi@efficios.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250226165255.25737-1-simon.marchi@efficios.com> References: <20250226165255.25737-1-simon.marchi@efficios.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~public-inbox=simark.ca@sourceware.org Commit 2f0521c0d6f6 ("gdb/dwarf: fix signature_type created with nullptr section") added some asserts in the dwarf2_per_cu_data constructor to verify that the passed dwarf2_per_bfd and dwarf2_section_info are not nullptr. However, the dummy dwarf2_per_cu_data objects create the in dwarf2_find_containing_comp_unit selftests are passed nullptr for those parameters. I prefer to keep the asserts in place, as protection for the non-test code and as self documentation, so fix this by passing some dummy pointers in the test. Change-Id: Ic7cdc1b976f7506041b651222234eefc998e473a --- gdb/dwarf2/read.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index 2b060959c36f..59d79af004ca 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -20946,9 +20946,16 @@ namespace find_containing_comp_unit { static void run_test () { - const auto create_dummy_per_cu = [] (sect_offset sect_off, unsigned int length) + char dummy_per_bfd; + char dummy_section; + + const auto create_dummy_per_cu = [&] (sect_offset sect_off, + unsigned int length) { - return dwarf2_per_cu_data_up (new dwarf2_per_cu_data (nullptr, nullptr, + auto per_bfd = reinterpret_cast (&dummy_per_bfd); + auto section = reinterpret_cast (&dummy_section); + + return dwarf2_per_cu_data_up (new dwarf2_per_cu_data (per_bfd, section, sect_off, length)); }; -- 2.48.1