From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26481 invoked by alias); 15 Nov 2006 11:21:43 -0000 Received: (qmail 26472 invoked by uid 22791); 15 Nov 2006 11:21:43 -0000 X-Spam-Check-By: sourceware.org Received: from viper.snap.net.nz (HELO viper.snap.net.nz) (202.37.101.8) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 15 Nov 2006 11:21:37 +0000 Received: from kahikatea.snap.net.nz (p202-124-125-171.snap.net.nz [202.124.125.171]) by viper.snap.net.nz (Postfix) with ESMTP id 4EDF33D877B; Thu, 16 Nov 2006 00:21:54 +1300 (NZDT) Received: by kahikatea.snap.net.nz (Postfix, from userid 500) id C92ECBE43D; Thu, 16 Nov 2006 00:17:33 +1300 (NZDT) From: Nick Roberts MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <17754.63307.487745.34360@kahikatea.snap.net.nz> Date: Wed, 15 Nov 2006 11:21:00 -0000 To: Vladimir Prus Cc: gdb-patches@sources.redhat.com Subject: Re: MI: -var-list-children --simple-values In-Reply-To: <200611151250.11654.vladimir@codesourcery.com> References: <200611151250.11654.vladimir@codesourcery.com> X-Mailer: VM 7.19 under Emacs 22.0.90.14 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2006-11/txt/msg00120.txt.bz2 > -var-list-children --simple-values > > is broken on mainline. Printing children of any C++ structure results in > segfault. The problem is that C++ structures have "public" fake child > that has no type, so mi_print_value_p tries to access properties of a NULL > type. > > This is easy to fix, but given that printing C++ structures is a mainstream > use-case, and no IDE developer ever complained, this suggests that this > feature is not used. Rather than carry it along, how about just removing it? ISTR Daniel J wanted --simple-values for consistency with -stack-list-locals. As it's easy to fix, I suggest doing that. I also note a mistake in the error message. Both are fixed below. -- Nick http://www.inet.net.nz/~nickrob *** mi-cmd-var.c 24 Dec 2005 07:57:46 +1300 1.23 --- mi-cmd-var.c 16 Nov 2006 00:09:09 +1300 *************** *** 269,275 **** else error (_("Unknown value for PRINT_VALUES\n\ Must be: 0 or \"%s\", 1 or \"%s\", 2 or \"%s\""), ! mi_no_values, mi_simple_values, mi_all_values); } /* Return 1 if given the argument PRINT_VALUES we should display --- 269,275 ---- else error (_("Unknown value for PRINT_VALUES\n\ Must be: 0 or \"%s\", 1 or \"%s\", 2 or \"%s\""), ! mi_no_values, mi_all_values, mi_simple_values); } /* Return 1 if given the argument PRINT_VALUES we should display *************** *** 278,286 **** static int mi_print_value_p (struct type *type, enum print_values print_values) { - if (type != NULL) - type = check_typedef (type); - if (print_values == PRINT_NO_VALUES) return 0; --- 278,283 ---- *************** *** 290,295 **** --- 287,298 ---- /* For PRINT_SIMPLE_VALUES, only print the value if it has a type and that type is not a compound type. */ + if (type != NULL) + type = check_typedef (type); + else + /* For the "fake" variables. */ + return 0; + return (TYPE_CODE (type) != TYPE_CODE_ARRAY && TYPE_CODE (type) != TYPE_CODE_STRUCT && TYPE_CODE (type) != TYPE_CODE_UNION);