From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 85591 invoked by alias); 26 Feb 2015 14:11:27 -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 85576 invoked by uid 89); 26 Feb 2015 14:11:26 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.0 required=5.0 tests=AWL,BAYES_00,SPF_PASS autolearn=ham version=3.3.2 X-HELO: usevmg21.ericsson.net Received: from usevmg21.ericsson.net (HELO usevmg21.ericsson.net) (198.24.6.65) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Thu, 26 Feb 2015 14:11:25 +0000 Received: from EUSAAHC002.ericsson.se (Unknown_Domain [147.117.188.78]) by usevmg21.ericsson.net (Symantec Mail Security) with SMTP id 74.16.25146.CF8CEE45; Thu, 26 Feb 2015 08:19:25 +0100 (CET) Received: from [142.133.111.161] (147.117.188.8) by smtp-am.internal.ericsson.com (147.117.188.80) with Microsoft SMTP Server id 14.3.210.2; Thu, 26 Feb 2015 09:11:23 -0500 Message-ID: <54EF298B.1010906@ericsson.com> Date: Thu, 26 Feb 2015 14:11:00 -0000 From: Antoine Tremblay User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 MIME-Version: 1.0 To: Pedro Alves , 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> <54EF212E.3020602@redhat.com> In-Reply-To: <54EF212E.3020602@redhat.com> Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2015-02/txt/msg00760.txt.bz2 On 02/26/2015 08:35 AM, Pedro Alves wrote: > It there a way to add a test? I would need to add a test that's specific to an architecture that does not support the struct return value... I'll see what I can figure out.. > Also please use "const char *" for type_name, so C++ > doesn't complain. :-) Humm not sure I understand here since type_to_string returns a char* that needs to be freed ? Converting to const char* would make make_cleanup complain... How is C++ complaining ? > 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); >> } >> } >> >>