This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 4/5]: Enhancements to "flags": i386 cleanup


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]