Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Doug Evans <dje@google.com>
To: Pedro Alves <palves@redhat.com>
Cc: Anton Kolesov <Anton.Kolesov@synopsys.com>,
	gdb-patches <gdb-patches@sourceware.org>,
		Wei-cheng Wang <cole945@gmail.com>
Subject: Re: [PATCH 4/5]: Enhancements to "flags": i386 cleanup
Date: Thu, 06 Oct 2016 18:43:00 -0000	[thread overview]
Message-ID: <CADPb22QRHmCKKQL3wiUKaku5sJPpJDQW73RGCCdPL66zFfqO5g@mail.gmail.com> (raw)
In-Reply-To: <63d3eb0a-f0c6-e85d-6889-ce2aae6d1054@redhat.com>

On Thu, Oct 6, 2016 at 7:44 AM, Pedro Alves <palves@redhat.com> wrote:
>
> On 10/06/2016 02:44 PM, Anton Kolesov wrote:
> > Hi Pedro,
> >
> >>
> >> Note how that left several flags with 2-bit and/or 4-bit
> >> long bitfields:
> >>
> >>    tdesc_add_bitfield (type, "E", 1, 2);
> >>    tdesc_add_bitfield (type, "A", 3, 4);
> >> ...
> >>    tdesc_add_bitfield (type, "E", 1, 4);
> >>
> >> which I understand means these two fields will
> >> be given uint32_t type instead of bool?  What does this
> >> mean in practice?  E.g,. for "A", what do we print when both
> >> bits 3 and 4 are clear?  What do we print if one
> >> of the bits is set and the other is clear?
> >
> > With regards of ARC flags, if field is longer than one bit, then it should be
> > treated as an uint. For example, in arc-v2.c field H means "halt bit", so
> > it is a single bit, but E is a "Interrupt priority level", so bits are not
> > independent in this field - it is a 4-bit integer number, there is no idea
> > of independent "first bit" or "second bit" inside this field. If there would,
> > then I'd split it into separate fields bits. So it should be printed something
> > like "[ H E=1 AE ]" - bits printed only when they are set, uint fields are
> > printed as "name=value", though I'm not sure if it should be printed if value
> > is 0.  At least that is what are my expectations of how "flags" register should
> > be presented.
>
> Thanks.  Looks like EL on aarch64 is similar.  It's an exception
> level, I believe.


Correct. This field is actually what prompted me to want to improve on
the status quo.


>
>
> To confirm what happens with uint bitfields within flags, I hacked
> my local x86-64 GDB with:
>
> --- c/gdb/features/i386/64bit-core.xml
> +++ w/gdb/features/i386/64bit-core.xml
> @@ -10,8 +10,7 @@
>    <flags id="i386_eflags" size="4">
>      <field name="CF" start="0" end="0"/>
>      <field name="" start="1" end="1"/>
> -    <field name="PF" start="2" end="2"/>
> -    <field name="AF" start="4" end="4"/>
> +    <field name="PF" start="2" end="4"/>
>      <field name="ZF" start="6" end="6"/>
>      <field name="SF" start="7" end="7"/>
>      <field name="TF" start="8" end="8"/>
>
> and (after regenerating the gdb/feature/ .c files.), I see:
>
> (gdb) p $eflags = 0
> $1 = [ PF=0 ]
> (gdb) p $eflags = 0xffffffff
> $2 = [ CF PF=7 ZF SF TF IF DF OF NT RF VM AC VIF VIP ID ]
>
> So =0 is always shown for these.  Debatable, but that seems
> like just a presentation thing.

It felt like if the value is a uint, then 0 should be treated no
differently so that's what I went with.

> Sorry for all my confusions.
> I'll go close the PR, and unblock 7.12!

Sorry for not getting the patch into master, and thanks for doing so.
Another consequence of a distracted summer.

Let me know if you need anything more from me.


  reply	other threads:[~2016-10-06 18:43 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-29 23:09 Doug Evans
2016-07-20 18:18 ` Pedro Alves
2016-07-22 19:16   ` Doug Evans
2016-08-08 15:06     ` Pedro Alves
2016-08-08 20:34       ` Doug Evans
2016-08-09 17:55         ` Pedro Alves
2016-08-11 18:10           ` Pedro Alves
2016-08-11 18:18             ` Doug Evans
2016-10-06 11:33               ` Pedro Alves
2016-10-06 13:44                 ` Anton Kolesov
2016-10-06 14:44                   ` Pedro Alves
2016-10-06 18:43                     ` Doug Evans [this message]
2016-08-15 19:28 Doug Evans

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=CADPb22QRHmCKKQL3wiUKaku5sJPpJDQW73RGCCdPL66zFfqO5g@mail.gmail.com \
    --to=dje@google.com \
    --cc=Anton.Kolesov@synopsys.com \
    --cc=cole945@gmail.com \
    --cc=gdb-patches@sourceware.org \
    --cc=palves@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