From: Doug Evans <dje@google.com>
To: gdb-patches@sourceware.org
Subject: Re: [RFC] printing/setting flag register fields
Date: Sun, 20 Sep 2009 18:35:00 -0000 [thread overview]
Message-ID: <e394668d0909201135u8a28d42t995db6256d75f277@mail.gmail.com> (raw)
In-Reply-To: <20090920180036.GA19867@caradoc.them.org>
On Sun, Sep 20, 2009 at 11:00 AM, Daniel Jacobowitz <drow@false.org> wrote:
> Just my two cents - flag types were a workaround for GDB's lack of
> good pretty-printing facilities. They should be just structs
> containing bitfields, with a default pretty-printer. And/or a union
> with an accessible integer value. Anywhere that our handling of such
> constructs isn't good enough for eflags, it's not good enough for user
> code either, and I deal with a lot of code of this nature.
I read somewhere that one advantage of TYPE_CODE_FLAGS was that one
didn't have to deal with the vagaries of ABI-struct layout. Alas I
can't find it now. [And I'm not sure it's really relevant as the data
recorded in the underlying type doesn't have to follow ABI rules, so
maybe I've confused it with something else.]
Should TYPE_CODE_FLAGS be nuked? I'm happy to do that instead if
that's what folks want. I like it, but if we made eflags a union of a
struct and an int, then "set $eflags.ZF = 0" won't work. Are folks
happy with "set $eflags.bits.ZF = 0"? "works for me".
> As for bitfield numbering, I think we should use the corresponding
> architecture's conventions; I don't know what the m68k complication
> is, though.
"works for me".
My higher order question, though, is should the bitfield positions be
displayed in the output of ptype (for these objects, I wouldn't do it
by default in general of course).
I like it there so that one doesn't have to look in any manual to know
ZF, for example, is in bit 1 << 6 (gdb has so much information
internally, we should try to provide more of it to the user).
But it could be done differently. An off-the-cuff example is an
option to ptype to print field offsets for structs in general. [I'm
assuming such a facility doesn't already exist.] That would probably
be more useful than always printing the offsets anyway.
next prev parent reply other threads:[~2009-09-20 18:35 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-09-18 23:57 Doug Evans
2009-09-19 7:07 ` Mark Kettenis
2009-09-19 7:38 ` Andreas Schwab
2009-09-20 18:00 ` Daniel Jacobowitz
2009-09-20 18:35 ` Doug Evans [this message]
2009-09-20 20:27 ` Daniel Jacobowitz
2009-09-21 16:43 ` 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=e394668d0909201135u8a28d42t995db6256d75f277@mail.gmail.com \
--to=dje@google.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