From: Li Yu <raise.sail@gmail.com>
To: gdb-patches@sourceware.org
Cc: Paul Koning <paulkoning@comcast.net>, Tom Tromey <tromey@redhat.com>
Subject: Re: [PATCH v4] gdb/python: add missing handling for anonymous members of struct and union
Date: Tue, 18 Oct 2011 01:48:00 -0000 [thread overview]
Message-ID: <4E9CD9C3.4080602@gmail.com> (raw)
In-Reply-To: <CA+WLrf-MM2WPr6r8DLKcZP5-A6qmZst8Sxzy4u5OvrxFET5sEQ@mail.gmail.com>
Is this ready for merge into upsteam ?
thanks
Yu
äº 2011å¹´10æ08æ¥ 13:35, Li Yu åé:
> gdb.Type.fields() missed handling for anonymous members.
>
> This patch fix it, below are details:
>
> Assume that we have a c source as below:
>
> /////////////////////////////
> struct A
> {
> int a;
> union {
> int b0;
> int b1;
> union {
> int bb0;
> int bb1;
> union {
> int bbb0;
> int bbb1;
> };
> };
> };
> int c;
> union {
> union {
> int dd0;
> int dd1;
> };
> int d2;
> int d3;
> };
> };
>
> int main()
> {
> struct A a;
> }
> ////////////////////////////
>
> And have a python gdb script as below:
>
> ##########################
> v = gdb.parse_and_eval("a")
> t = v.type
> fields = t.fields()
> for f in fields:
> print "[%s]" % f.name, v[f.name]
> ##########################
>
> Without this patch, above script will print:
>
> [a] -7616
> [] {{dd0 = 0, dd1 = 0}, d2 = 0, d3 = 0}
> [c] 0
> [] {{dd0 = 0, dd1 = 0}, d2 = 0, d3 = 0}
>
> With this patch, above script will print rightly:
>
> [a] -7616
> [b0] 32767
> [b1] 32767
> [bb0] 32767
> [bb1] 32767
> [bbb0] 32767
> [bbb1] 32767
> [c] 0
> [dd0] 0
> [dd1] 0
> [d2] 0
> [d3] 0
>
> Thanks for Paul and Tom's feedback of this patch.
>
> This version uses recursion implementation, as we discussed, this
> patch is passed by "make check" without regression :)
>
> Signed-off-by: Li Yu <raise.sail@gmail.com>
>
> gdb/python/:
> 2011-10-8 Li Yu <raise.sail@gmail.com>
>
> * py-type.c: Add process for anonymous members of struct and union
>
> py-type.c | 41 ++++++++++++++++++++++++++++++++++-------
> 1 file changed, 34 insertions(+), 7 deletions(-)
next prev parent reply other threads:[~2011-10-18 1:44 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-08 5:35 Li Yu
2011-10-18 1:48 ` Li Yu [this message]
2011-10-18 2:46 ` Yao Qi
2011-10-18 14:03 ` Phil Muldoon
[not found] ` <09787EF419216C41A903FD14EE5506DD030CB90864@AUSX7MCPC103.AMER.DELL.COM>
2011-10-18 19:31 ` Paul Koning
2011-10-19 8:28 ` Li Yu
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=4E9CD9C3.4080602@gmail.com \
--to=raise.sail@gmail.com \
--cc=gdb-patches@sourceware.org \
--cc=paulkoning@comcast.net \
--cc=tromey@redhat.com \
/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