From: "Andrew Burgess" <aburgess@broadcom.com>
To: gdb-patches@sourceware.org
Subject: Re: [RFC] Change how value is shown for varobjs of type vector.
Date: Thu, 04 Oct 2012 10:57:00 -0000 [thread overview]
Message-ID: <506D6B7B.8070602@broadcom.com> (raw)
In-Reply-To: <50631DE7.7050702@broadcom.com>
*ping*
On 26/09/2012 4:23 PM, Andrew Burgess wrote:
> Consider:
>
>> cat vec.c
> char vector __attribute__ ((vector_size (8))) = { 0, 0, 0, 0, 0, 0, 0, 0 };
>
> int
> main ()
> {
> /* Nothing. */
> }
>> gcc -g -o vec.x vec.c
>> gdb vec.x
> (gdb) start
> (gdb) interpreter-exec mi2 "-var-create vector * vector"
> ^done,name="vector",numchild="8",value="[8]",type="char [8]",has_more="0"
>
> ## END ##
>
> I have a patch (below) that changes the value field from the current "[8]" to "{ 0, 0, 0, 0, 0, 0, 0, 0 }". The varobj still has 8 children, and the top level varobj is still not editable, you have to edit through the children.
>
> This better suits my local usage where vectors are generally used with just a small number of entries, each vector type has a total size of one 64-bit register, the frontend used to view this MI data is just passing the value field through, and my users wanted to visualise the set of values in a single field.
>
> I've not finished the patch yet with changelog or tests because I wasn't sure if this change was going to be acceptable, so I'm looking for some feedback please. One possibility would be to make this behaviour switchable, if it can't be the default.
>
> Thanks,
>
> Andrew
>
>
> diff --git a/gdb/varobj.c b/gdb/varobj.c
> index 6699699..c72716b 100644
> --- a/gdb/varobj.c
> +++ b/gdb/varobj.c
> @@ -3119,10 +3119,13 @@ default_value_is_changeable_p (struct varobj *var)
> {
> case TYPE_CODE_STRUCT:
> case TYPE_CODE_UNION:
> - case TYPE_CODE_ARRAY:
> r = 0;
> break;
>
> + case TYPE_CODE_ARRAY:
> + r = TYPE_VECTOR (type);
> + break;
> +
> default:
> r = 1;
> }
> @@ -3507,12 +3510,16 @@ c_value_of_variable (struct varobj *var, enum varobj_display_formats format)
>
> case TYPE_CODE_ARRAY:
> {
> - char *number;
> + if (!TYPE_VECTOR (type))
> + {
> + char *number;
>
> - number = xstrprintf ("[%d]", var->num_children);
> - return (number);
> + number = xstrprintf ("[%d]", var->num_children);
> + return (number);
> + /* break; */
> + }
> }
> - /* break; */
> + /* fall through */
>
> default:
> {
>
>
>
>
>
>
>
next prev parent reply other threads:[~2012-10-04 10:57 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-26 15:23 Andrew Burgess
2012-10-04 10:57 ` Andrew Burgess [this message]
2012-10-14 17:25 ` Joel Brobecker
2012-10-15 11:12 ` Marc Khouzam
2012-10-17 17:04 ` Tom Tromey
2012-10-18 9:23 ` Andrew Burgess
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=506D6B7B.8070602@broadcom.com \
--to=aburgess@broadcom.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