From: Pedro Alves <palves@redhat.com>
To: Antoine Tremblay <antoine.tremblay@ericsson.com>,
gdb-patches@sourceware.org
Subject: Re: [PATCH] Fix print of value type in a corner case of finish
Date: Thu, 26 Feb 2015 13:35:00 -0000 [thread overview]
Message-ID: <54EF212E.3020602@redhat.com> (raw)
In-Reply-To: <1424957146-25705-1-git-send-email-antoine.tremblay@ericsson.com>
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);
> }
> }
>
>
next prev parent reply other threads:[~2015-02-26 13:35 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-26 13:25 Antoine Tremblay
2015-02-26 13:35 ` Pedro Alves [this message]
2015-02-26 14:11 ` Antoine Tremblay
2015-02-26 15:18 ` Pedro Alves
2015-02-26 15:44 ` Antoine Tremblay
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=54EF212E.3020602@redhat.com \
--to=palves@redhat.com \
--cc=antoine.tremblay@ericsson.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).