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


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.

Anton

> 
> 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


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