From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 122826 invoked by alias); 26 Feb 2015 13:35:50 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 122817 invoked by uid 89); 26 Feb 2015 13:35:49 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Thu, 26 Feb 2015 13:35:49 +0000 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id t1QDZiij021570 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 26 Feb 2015 08:35:44 -0500 Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t1QDZgrk010010; Thu, 26 Feb 2015 08:35:43 -0500 Message-ID: <54EF212E.3020602@redhat.com> Date: Thu, 26 Feb 2015 13:35:00 -0000 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.3.0 MIME-Version: 1.0 To: Antoine Tremblay , gdb-patches@sourceware.org Subject: Re: [PATCH] Fix print of value type in a corner case of finish References: <1424957146-25705-1-git-send-email-antoine.tremblay@ericsson.com> In-Reply-To: <1424957146-25705-1-git-send-email-antoine.tremblay@ericsson.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-SW-Source: 2015-02/txt/msg00757.txt.bz2 It there a way to add a test? Also please use "const char *" for type_name, so C++ doesn't complain. :-) Thanks, Pedro Alves On 02/26/2015 01:25 PM, Antoine Tremblay wrote: > When doing finish in a function, if gdb fails to return a value, gdb > also fails at printing the value type if this type is a struct. > > For example : > > (gdb) fin > .... > Value returned has type: . Cannot determine contents > > This patch fixes this by calling type_to_string to print the type > so that we can support these types. > > This patch returns the following example output : > > (gdb) fin > .... > Value returned has type: struct test. Cannot determine contents > > gdb/ChangeLog: > * gdb/infcmd.c (print_return_value): use type_to_string to print type. > --- > gdb/infcmd.c | 8 +++++++- > 1 file changed, 7 insertions(+), 1 deletion(-) > > diff --git a/gdb/infcmd.c b/gdb/infcmd.c > index 9a1fb8d..3737b8f 100644 > --- a/gdb/infcmd.c > +++ b/gdb/infcmd.c > @@ -1607,10 +1607,16 @@ print_return_value (struct value *function, struct type *value_type) > } > else > { > + struct cleanup *oldchain; > + char *type_name; > + > + type_name = type_to_string (value_type); > + oldchain = make_cleanup (xfree, type_name); > ui_out_text (uiout, "Value returned has type: "); > - ui_out_field_string (uiout, "return-type", TYPE_NAME (value_type)); > + ui_out_field_string (uiout, "return-type", type_name); > ui_out_text (uiout, "."); > ui_out_text (uiout, " Cannot determine contents\n"); > + do_cleanups (oldchain); > } > } > >