[PATCH 4/5]: Enhancements to "flags": i386 cleanup
Pedro Alves
palves@redhat.com
Thu Oct 6 11:33:00 GMT 2016
[Adding Anton, this affects ARC]
On 08/11/2016 07:18 PM, Doug Evans wrote:
> On Thu, Aug 11, 2016 at 11:10 AM, Pedro Alves <palves@redhat.com> wrote:
>> Is the "type" attribute used for anything in <flags> elements?
>> Does changing the type of a flag bitfield have any user-visible
>> effect at all? I.e., does a 1-bit uint32_t bitfield flag
>> print differently from a bool bitfield flag?
>
> There may be some simplification possible, but note that bools do
> print differently: if false we don't print the field at all.
>
> [digression: I'm not sure it's possible today, but while I understand
> the desire to avoid the extra verbosity if we always printed false
> fields, there are times when I *do* want the field printed even if
> false]
>
So <https://sourceware.org/ml/gdb-patches/2016-10/msg00113.html> resulted
in this change:
diff --git a/gdb/features/arc-arcompact.c b/gdb/features/arc-arcompact.c
index d1fa4fe..a527cc2 100644
--- a/gdb/features/arc-arcompact.c
+++ b/gdb/features/arc-arcompact.c
@@ -54,19 +54,19 @@ initialize_tdesc_arc_arcompact (void)
feature = tdesc_create_feature (result, "org.gnu.gdb.arc.aux-minimal");
type = tdesc_create_flags (feature, "status32_type", 4);
- tdesc_add_bitfield (type, "H", 0, 0);
+ tdesc_add_flag (type, 0, "H");
tdesc_add_bitfield (type, "E", 1, 2);
tdesc_add_bitfield (type, "A", 3, 4);
- tdesc_add_bitfield (type, "AE", 5, 5);
- tdesc_add_bitfield (type, "DE", 6, 6);
- tdesc_add_bitfield (type, "U", 7, 7);
- tdesc_add_bitfield (type, "V", 8, 8);
- tdesc_add_bitfield (type, "C", 9, 9);
- tdesc_add_bitfield (type, "N", 10, 10);
- tdesc_add_bitfield (type, "Z", 11, 11);
- tdesc_add_bitfield (type, "L", 12, 12);
- tdesc_add_bitfield (type, "R", 13, 13);
- tdesc_add_bitfield (type, "SE", 14, 14);
+ tdesc_add_flag (type, 5, "AE");
+ tdesc_add_flag (type, 6, "DE");
+ tdesc_add_flag (type, 7, "U");
+ tdesc_add_flag (type, 8, "V");
+ tdesc_add_flag (type, 9, "C");
+ tdesc_add_flag (type, 10, "N");
+ tdesc_add_flag (type, 11, "Z");
+ tdesc_add_flag (type, 12, "L");
+ tdesc_add_flag (type, 13, "R");
+ tdesc_add_flag (type, 14, "SE");
diff --git a/gdb/features/arc-v2.c b/gdb/features/arc-v2.c
index c963410..b2bdfb5 100644
--- a/gdb/features/arc-v2.c
+++ b/gdb/features/arc-v2.c
@@ -54,23 +54,23 @@ initialize_tdesc_arc_v2 (void)
feature = tdesc_create_feature (result, "org.gnu.gdb.arc.aux-minimal");
type = tdesc_create_flags (feature, "status32_type", 4);
- tdesc_add_bitfield (type, "H", 0, 0);
+ tdesc_add_flag (type, 0, "H");
tdesc_add_bitfield (type, "E", 1, 4);
- tdesc_add_bitfield (type, "AE", 5, 5);
- tdesc_add_bitfield (type, "DE", 6, 6);
- tdesc_add_bitfield (type, "U", 7, 7);
- tdesc_add_bitfield (type, "V", 8, 8);
- tdesc_add_bitfield (type, "C", 9, 9);
- tdesc_add_bitfield (type, "N", 10, 10);
- tdesc_add_bitfield (type, "Z", 11, 11);
- tdesc_add_bitfield (type, "L", 12, 12);
- tdesc_add_bitfield (type, "DZ", 13, 13);
- tdesc_add_bitfield (type, "SC", 14, 14);
- tdesc_add_bitfield (type, "ES", 15, 15);
+ tdesc_add_flag (type, 5, "AE");
+ tdesc_add_flag (type, 6, "DE");
+ tdesc_add_flag (type, 7, "U");
+ tdesc_add_flag (type, 8, "V");
+ tdesc_add_flag (type, 9, "C");
+ tdesc_add_flag (type, 10, "N");
+ tdesc_add_flag (type, 11, "Z");
+ tdesc_add_flag (type, 12, "L");
+ tdesc_add_flag (type, 13, "DZ");
+ tdesc_add_flag (type, 14, "SC");
+ tdesc_add_flag (type, 15, "ES");
tdesc_add_bitfield (type, "RB", 16, 18);
- tdesc_add_bitfield (type, "AD", 19, 19);
- tdesc_add_bitfield (type, "US", 20, 20);
- tdesc_add_bitfield (type, "IE", 31, 31);
+ tdesc_add_flag (type, 19, "AD");
+ tdesc_add_flag (type, 20, "US");
+ tdesc_add_flag (type, 31, "IE");
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?
I see similar things on other archs though, it's
not just ARC. E.g., the patch resulted in:
--- a/gdb/features/aarch64.c
+++ b/gdb/features/aarch64.c
@@ -19,10 +19,10 @@ initialize_tdesc_aarch64 (void)
feature = tdesc_create_feature (result, "org.gnu.gdb.aarch64.core");
type = tdesc_create_flags (feature, "cpsr_flags", 4);
tdesc_add_flag (type, 0, "SP");
- tdesc_add_bitfield (type, "", 1, 1);
+ tdesc_add_flag (type, 1, "");
tdesc_add_bitfield (type, "EL", 2, 3);
tdesc_add_flag (type, 4, "nRW");
- tdesc_add_bitfield (type, "", 5, 5);
+ tdesc_add_flag (type, 5, "");
tdesc_add_flag (type, 6, "F");
tdesc_add_flag (type, 7, "I");
tdesc_add_flag (type, 8, "A");
Which leaves "EL" as a 2-bit bitfield.
I'm still terribly confused. :-/
Thanks,
Pedro Alves
More information about the Gdb-patches
mailing list