Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Anton Kolesov <Anton.Kolesov@synopsys.com>
To: Pedro Alves <palves@redhat.com>, Doug Evans <dje@google.com>
Cc: 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 13:44:00 -0000	[thread overview]
Message-ID: <39A54937CC95F24AA2F794E2D2B66B13581BF837@DE02WEMBXB.internal.synopsys.com> (raw)
In-Reply-To: <e0fb0119-3163-70f6-fdb7-31bf2e2637b5@redhat.com>

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


  reply	other threads:[~2016-10-06 13:44 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 [this message]
2016-10-06 14:44                   ` Pedro Alves
2016-10-06 18:43                     ` Doug Evans
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=39A54937CC95F24AA2F794E2D2B66B13581BF837@DE02WEMBXB.internal.synopsys.com \
    --to=anton.kolesov@synopsys.com \
    --cc=cole945@gmail.com \
    --cc=dje@google.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