From: Tom Tromey <tromey@redhat.com>
To: lin zuojian <manjian2006@gmail.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH] Adding bit position to ptype
Date: Wed, 18 Jun 2014 14:31:00 -0000 [thread overview]
Message-ID: <871tumffwz.fsf@fleche.redhat.com> (raw)
In-Reply-To: <20140618031308.GA7252@ubuntu> (lin zuojian's message of "Wed, 18 Jun 2014 11:13:08 +0800")
>>>>> ">" == lin zuojian <manjian2006@gmail.com> writes:
>> Hi, I am having trouble looking up field offsets when reading
>> disassembled text. So I add an extra field to ptype:
Nice.
You might be interested in pahole.py.
>> diff --git a/gdb/c-typeprint.c b/gdb/c-typeprint.c
>> index 4edc9ec..9fbbc36 100644
>> --- a/gdb/c-typeprint.c
>> +++ b/gdb/c-typeprint.c
>> @@ -1110,6 +1110,12 @@ c_type_print_base (struct type *type, struct ui_file *stream,
>> fprintf_filtered (stream, " : %d",
>> TYPE_FIELD_BITSIZE (type, i));
>> }
>> + else if (!field_is_static (&TYPE_FIELD (type, i)))
>> + {
>> + /* print the bit pos. */
>> + fprintf_filtered (stream, " bitpos: %d",
>> + TYPE_FIELD_BITPOS (type, i));
>> + }
>> fprintf_filtered (stream, ";\n");
To be considered for acceptance all patches require a ChangeLog entry
and must pass regression testing -- which this one probably does not, as
it changes gdb's output by default. Please see the contribution
instructions.
I think it would probably be better to add a flag to ptype to enable
this behavior. Integrating all of the pahole behavior into ptype would
be even better, though I understand if you don't want to go this far.
thanks,
Tom
next prev parent reply other threads:[~2014-06-18 14:31 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-18 3:13 lin zuojian
2014-06-18 14:31 ` Tom Tromey [this message]
2014-07-01 9:34 ` lin zuojian
2014-07-01 16:29 ` Tom Tromey
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=871tumffwz.fsf@fleche.redhat.com \
--to=tromey@redhat.com \
--cc=gdb-patches@sourceware.org \
--cc=manjian2006@gmail.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