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 D4C673858C2D for ; Fri, 25 Aug 2023 15:55:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D4C673858C2D 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 EFCAF1F897 for ; Fri, 25 Aug 2023 15:55:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1692978929; 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=MriZ/vpR9+vWjWR/ClGWZqyARDslUJUXZ2009uMT/Js=; b=xTnJL2RQfLiYO+ovPQz+LYDElGf2mWM6nxL3xYQyLdD52VAeSX2GSQk96VsS8W9QWJ7krH 1IEn14RA1ak25gDT5e820r6JAJLI2Nb+3MBBPNWBg7rWxuB5s3P3nv4pjAO4UdeFM1E+bp NecH73MQT9L/LNKxzf93F0ifDEFuMkI= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1692978929; 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=MriZ/vpR9+vWjWR/ClGWZqyARDslUJUXZ2009uMT/Js=; b=L/QrHJgomXbxHmcepMD/Wemv7cgZPPcUjlZ3n5oX1WuEFfobx1EaNHYZNwBgNRMvJ6yUvI PFurIK6/V1+Gy6Dg== 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 E01B3138F9 for ; Fri, 25 Aug 2023 15:55:29 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 2HGyNfHO6GT6PwAAMHmgww (envelope-from ) for ; Fri, 25 Aug 2023 15:55:29 +0000 From: Tom de Vries To: gdb-patches@sourceware.org Subject: [RFC 3/7] [gdb/symtab] Handle nullptr parent in parent_map::set_parent Date: Fri, 25 Aug 2023 17:55:42 +0200 Message-Id: <20230825155546.19617-4-tdevries@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20230825155546.19617-1-tdevries@suse.de> References: <20230825155546.19617-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, which doesn't allow parent_entry == nullptr. So it may be necessary to guard calls to set_parent with "if (parent_entry != nullptr)". Fix this by handling the parent_entry == nullptr case. Tested on x86_64-linux. --- gdb/dwarf2/cooked-index.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gdb/dwarf2/cooked-index.h b/gdb/dwarf2/cooked-index.h index a921f25ecf2..23db5918878 100644 --- a/gdb/dwarf2/cooked-index.h +++ b/gdb/dwarf2/cooked-index.h @@ -253,7 +253,10 @@ class parent_map void set_parent (CORE_ADDR start, CORE_ADDR end, const cooked_index_entry *parent_entry) { - m_parent_map.set_empty (start, end, (void *)parent_entry); + /* Calling set_empty with nullptr is currently not allowed. Note that we + still check the desired effect. */ + if (parent_entry != nullptr) + 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 -- 2.35.3