This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH 4/5]: Enhancements to "flags": i386 cleanup
- From: Pedro Alves <palves at redhat dot com>
- To: Anton Kolesov <Anton dot Kolesov at synopsys dot com>, Doug Evans <dje at google dot com>
- Cc: gdb-patches <gdb-patches at sourceware dot org>, Wei-cheng Wang <cole945 at gmail dot com>
- Date: Thu, 6 Oct 2016 15:44:52 +0100
- Subject: Re: [PATCH 4/5]: Enhancements to "flags": i386 cleanup
- Authentication-results: sourceware.org; auth=none
- References: <047d7b5dbb865204bd052cf0bc2b@google.com> <2026a39c-0b53-9142-74ce-091bc73832d8@redhat.com> <CADPb22QR8HyCAXxqLWvO7MLUVb7AfG6RarrcFSU3Go32SZgjSw@mail.gmail.com> <7635a6d6-4059-6b23-952c-a88dbfef3b18@redhat.com> <CADPb22SZSoubV_uHkfQa48+Q7Gwu7dncUf_z15jAc-GJceKOsA@mail.gmail.com> <187cd5cc-be8d-3a61-66cd-338ea68a72f8@redhat.com> <ff50e351-0c6c-4ffd-cb47-53eef410e860@redhat.com> <CADPb22SEg_GtRwsJPc9jKQv7OQ73ikwUnbqRBoR8fj1DZuaWdw@mail.gmail.com> <e0fb0119-3163-70f6-fdb7-31bf2e2637b5@redhat.com> <39A54937CC95F24AA2F794E2D2B66B13581BF837@DE02WEMBXB.internal.synopsys.com>
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.
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. Sorry for all my confusions.
I'll go close the PR, and unblock 7.12!
Thanks,
Pedro Alves