From patchwork Wed Apr 1 10:03:12 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre-Marie de Rodat X-Patchwork-Id: 5946 Received: (qmail 73699 invoked by alias); 1 Apr 2015 10:03:18 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 73152 invoked by uid 89); 1 Apr 2015 10:03:18 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.1 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 X-HELO: smtp.eu.adacore.com Received: from mel.act-europe.fr (HELO smtp.eu.adacore.com) (194.98.77.210) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Wed, 01 Apr 2015 10:03:16 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id BAA9F2D4900B; Wed, 1 Apr 2015 12:03:12 +0200 (CEST) Received: from smtp.eu.adacore.com ([127.0.0.1]) by localhost (smtp.eu.adacore.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 6N71T0yJBurC; Wed, 1 Apr 2015 12:03:12 +0200 (CEST) Received: from [10.10.1.112] (cacatoes.act-europe.fr [10.10.1.112]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.eu.adacore.com (Postfix) with ESMTPSA id A65A72D48FF5; Wed, 1 Apr 2015 12:03:12 +0200 (CEST) Message-ID: <551BC260.30308@adacore.com> Date: Wed, 01 Apr 2015 12:03:12 +0200 From: Pierre-Marie de Rodat User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 MIME-Version: 1.0 To: GDB Patches Subject: [PATCH] Fix a crash with maintenance print type for GNAT stuff X-IsSubscribed: yes Hello, The attached patch fixes a crash in GDB when running the "maintenance print type" command on a type tree that includes "GNAT stuff" (i.e. GNAT descriptive types). This occurs only with AdaCore's version of GDB because our dwarf2read.c:need_gnat_info's implementation sometimes returns true. As a consequence I cannot write a meaningful regression testcase for this. The patch does not trigger regressions on x86_64-linux, though. Ok for master? Thank you in advance! gdb/ChangeLog: 2015-04-01 Pierre-Marie de Rodat * gdbtypes.c (print_gnat_stuff): Do not recurse on the descriptive type when there is none. From 96121045f9c03f36893fde658136d840be22aa1b Mon Sep 17 00:00:00 2001 From: Pierre-Marie de Rodat Date: Tue, 10 Mar 2015 15:43:09 +0100 Subject: [PATCH] Fix printing for GNAT stuff for types that do not have descr. types gdb/ChangeLog: 2015-04-01 Pierre-Marie de Rodat * gdbtypes.c (print_gnat_stuff): Do not recurse on the descriptive type when there is none. --- gdb/gdbtypes.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c index 217ec70..103b4e2 100644 --- a/gdb/gdbtypes.c +++ b/gdb/gdbtypes.c @@ -3888,7 +3888,13 @@ print_gnat_stuff (struct type *type, int spaces) { struct type *descriptive_type = TYPE_DESCRIPTIVE_TYPE (type); - recursive_dump_type (descriptive_type, spaces + 2); + if (descriptive_type == NULL) + printfi_filtered (spaces + 2, "no descriptive type\n"); + else + { + printfi_filtered (spaces + 2, "descriptive type\n"); + recursive_dump_type (descriptive_type, spaces + 4); + } } static struct obstack dont_print_type_obstack; -- 2.3.4