From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id WPgFO0/ldF91dgAAWB0awg (envelope-from ) for ; Wed, 30 Sep 2020 16:06:39 -0400 Received: by simark.ca (Postfix, from userid 112) id EFC6A1EDF4; Wed, 30 Sep 2020 16:06:39 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=MAILING_LIST_MULTI, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from 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 RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id BC6BA1E99A for ; Wed, 30 Sep 2020 16:06:37 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 12278397203D; Wed, 30 Sep 2020 20:06:37 +0000 (GMT) Received: from rock.gnat.com (rock.gnat.com [205.232.38.15]) by sourceware.org (Postfix) with ESMTP id 7E4953971C34 for ; Wed, 30 Sep 2020 20:06:35 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 7E4953971C34 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=tromey@adacore.com Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 5705F117485; Wed, 30 Sep 2020 16:06:05 -0400 (EDT) X-Virus-Scanned: Debian amavisd-new at gnat.com Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id yEABiQMW01vz; Wed, 30 Sep 2020 16:06:05 -0400 (EDT) Received: from murgatroyd.Home (97-118-100-18.hlrn.qwest.net [97.118.100.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by rock.gnat.com (Postfix) with ESMTPSA id 12825116F1D; Wed, 30 Sep 2020 16:06:05 -0400 (EDT) From: Tom Tromey To: gdb-patches@sourceware.org Subject: [PATCH 1/9] Avoid crash in ada-lang.c:to_fixed_array_type Date: Wed, 30 Sep 2020 14:05:52 -0600 Message-Id: <20200930200600.1207702-2-tromey@adacore.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200930200600.1207702-1-tromey@adacore.com> References: <20200930200600.1207702-1-tromey@adacore.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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: , Cc: Tom Tromey Errors-To: gdb-patches-bounces@sourceware.org Sender: "Gdb-patches" When debugging Ada programs compiled by certain versions of GNAT with -fgnat-encodings=minimal, gdb can crash. These crashes occur when running the gdb test suite, once some of the later patches in this series have been applied. This patch works around the bug by throwing an exception in the failing case. I did not implement a full fix because GNAT has been changed to emit better DWARF, and so in the near future this will stop being a problem. (Currently, users don't generally use -fgnat-encodings=minimal, and the GNAT default will only be changed in a fully-patched compiler.) gdb/ChangeLog 2020-09-30 Tom Tromey * ada-lang.c (to_fixed_array_type): Error if decode_constrained_packed_array_type returns NULL. --- gdb/ChangeLog | 5 +++++ gdb/ada-lang.c | 6 +++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index 0df406bff48..b4b7e838114 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -8368,7 +8368,11 @@ to_fixed_array_type (struct type *type0, struct value *dval, constrained_packed_array_p = ada_is_constrained_packed_array_type (type0); if (constrained_packed_array_p) - type0 = decode_constrained_packed_array_type (type0); + { + type0 = decode_constrained_packed_array_type (type0); + if (type0 == nullptr) + error (_("could not decode constrained packed array type")); + } index_type_desc = ada_find_parallel_type (type0, xa_suffix); -- 2.26.2