From: Pedro Alves <palves@redhat.com>
To: Doug Evans <dje@google.com>, Anton Kolesov <Anton.Kolesov@synopsys.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 11:33:00 -0000 [thread overview]
Message-ID: <e0fb0119-3163-70f6-fdb7-31bf2e2637b5@redhat.com> (raw)
In-Reply-To: <CADPb22SEg_GtRwsJPc9jKQv7OQ73ikwUnbqRBoR8fj1DZuaWdw@mail.gmail.com>
[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
next prev parent reply other threads:[~2016-10-06 11:33 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 [this message]
2016-10-06 13:44 ` Anton Kolesov
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=e0fb0119-3163-70f6-fdb7-31bf2e2637b5@redhat.com \
--to=palves@redhat.com \
--cc=Anton.Kolesov@synopsys.com \
--cc=cole945@gmail.com \
--cc=dje@google.com \
--cc=gdb-patches@sourceware.org \
/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