From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by sourceware.org (Postfix) with ESMTPS id 811E83858024 for ; Mon, 2 Oct 2023 12:50:47 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 811E83858024 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-out1.suse.de (Postfix) with ESMTPS id B07972185E 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=hXwpuNH0NpVQb/jVaC0D95JRieydW1t568sXd4f5o34=; b=lCh9QcE/uoVoLIX1vBWMec3+hzFKOMvoMNSeXLfpkfmUESGKew/okK9aVmH82nX2cK3ICM LGOUmNBdC79LHtQaHNmAySNjsyjRk9UXMU/lBsPWCtbgMAriJzWSi5muKjrj5/vzJhQd9S 7VIwuJ47B1je8EnApUyZypTAFJs/T/U= 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=hXwpuNH0NpVQb/jVaC0D95JRieydW1t568sXd4f5o34=; b=wa5M6nn8uFrT3OXQ+7lVM+kjGRh7kdJFb3YzxPGrsWB6tpReXKGw3SRahNpHbuf1IrGEf5 7/lTPQG73H+HqWCQ== 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 A04C113434 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 AJomJqa8GmVZMgAAMHmgww (envelope-from ) for ; Mon, 02 Oct 2023 12:50:46 +0000 From: Tom de Vries To: gdb-patches@sourceware.org Subject: [PATCH 03/13] [gdb/symtab] Handle nullptr parent in parent_map::set_parent Date: Mon, 2 Oct 2023 14:50:41 +0200 Message-Id: <20231002125051.29911-4-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=-12.3 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 9900dbb84a7..b51128d1f58 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