From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) by sourceware.org (Postfix) with ESMTPS id 2CAD93857019 for ; Mon, 2 Oct 2023 12:50:48 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 2CAD93857019 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.de Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 9B2D61F460 for ; Mon, 2 Oct 2023 12:50:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1696251046; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=iOBrvMqsuRk/xt8/HZy69n4ZabPB+vJ8cWA0EZpmzlQ=; b=T2MP0z6M/u9OuEN6m1ENrPkHB4poQXlkyg5cZwM/ilNVGiGIFsNdaV9CAXmWwsprWgZXA0 Wn18aQ1foqL8/JKs45/ZPkalHg9M+zLeBu+zaACUjfSa5uqL6TnzHiwPF2j3KqLROVshHy ustOnSzqheF0O5fv9ljLM5JYkL1pfq8= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1696251046; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=iOBrvMqsuRk/xt8/HZy69n4ZabPB+vJ8cWA0EZpmzlQ=; b=TzldO2R86AWBx6xgF622xiNvQ84Y6sK7D1qjtDmJSsU0EqX0A/MN2+Y8gOipavrAMQYfN1 E7+bD1jZ5fIqC1Ag== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 843AA13434 for ; Mon, 2 Oct 2023 12:50:46 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id kBdNH6a8GmVZMgAAMHmgww (envelope-from ) for ; Mon, 02 Oct 2023 12:50:46 +0000 From: Tom de Vries To: gdb-patches@sourceware.org Subject: [PATCH 02/13] [gdb/symtab] Check effect in parent_map::set_parent Date: Mon, 2 Oct 2023 14:50:40 +0200 Message-Id: <20231002125051.29911-3-tdevries@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20231002125051.29911-1-tdevries@suse.de> References: <20231002125051.29911-1-tdevries@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-11.9 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,SPF_HELO_NONE,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 List-Id: Set_parent uses m_die_range_map.set_empty to set the parent of a range. If part of the range is already set, it remains the same. If the entire range is already set, the set_empty has no effect, silently. Fix this by verifying that calling set_empty has the desired effect on the start and end points of the range. Tested on x86_64-linux. --- gdb/dwarf2/cooked-index.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/gdb/dwarf2/cooked-index.h b/gdb/dwarf2/cooked-index.h index a029fcf2cc9..9900dbb84a7 100644 --- a/gdb/dwarf2/cooked-index.h +++ b/gdb/dwarf2/cooked-index.h @@ -254,6 +254,13 @@ class parent_map const cooked_index_entry *parent_entry) { m_parent_map.set_empty (start, end, (void *)parent_entry); + + /* Assert that set_parent has the desired effect. This is not trivial due + to how set_empty works. If the range already has been set before, it + has no effect. */ + gdb_assert (m_parent_map.find (start) == parent_entry); + if (end != start) + gdb_assert (m_parent_map.find (end) == parent_entry); } private: -- 2.35.3