public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* Flags fields in register xml descriptions are suboptimal: What to do?
@ 2016-02-04  0:08 Doug Evans
  2016-02-04 14:41 ` Yao Qi
  0 siblings, 1 reply; 4+ messages in thread
From: Doug Evans @ 2016-02-04  0:08 UTC (permalink / raw)
  To: gdb-patches

Hi.

I'm thinking about making "cpsr" in the aarch64 port
pretty-print better, like how we print eflags for x86.

However, there is a problem (I think - maybe there's an alternative
I'm missing).

Some fields are more than one bit (e.g., EL), so what to do?

AFAICT "flags" fields in register xml descriptions have a pretty hardwired
assumption that every field is one bit. There is code that loops over the
fields assuming each field's number is also its bit position.
Bleah!

I could use a struct, but it won't, I think(!), give me a mechanism
to print the kind of output I want. E.g.,

(gdb) i r cpsr
cpsr 0xa0000020 123456 [ Z N EL=1 ]

[Obviously I just made integer values up.]

Question: What do people think of allowing the "flags" type in register xml
descriptions to support fields larger than one bit?
Such fields would print as NAME=value (or some such).

---

Also, I'd like to print flags even if they're zero. E.g.,

(gdb) i r cpsr
cpsr 0xa0000020 123456 [ Z !C N !V EL=1 ... ]

or some such.
IOW, instead of not printing fields that are zero/false/off,
print them as "!FIELD".
That'll change x86 eflags printing and maybe some won't like that.
I could make it some kind of option, but it feels like featuritis.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Flags fields in register xml descriptions are suboptimal: What to do?
  2016-02-04  0:08 Flags fields in register xml descriptions are suboptimal: What to do? Doug Evans
@ 2016-02-04 14:41 ` Yao Qi
  2016-02-04 15:11   ` Pedro Alves
  2016-02-04 15:19   ` Pedro Alves
  0 siblings, 2 replies; 4+ messages in thread
From: Yao Qi @ 2016-02-04 14:41 UTC (permalink / raw)
  To: Doug Evans; +Cc: gdb-patches

Doug Evans <dje@google.com> writes:

> Question: What do people think of allowing the "flags" type in register xml
> descriptions to support fields larger than one bit?
> Such fields would print as NAME=value (or some such).

That is useful, IMO.  Note that there was a patch about adding enum type
in the target description, https://sourceware.org/ml/gdb-patches/2013-12/msg00864.html
but it wasn't reviewed, as far as I can tell.

>
> ---
>
> Also, I'd like to print flags even if they're zero. E.g.,
>
> (gdb) i r cpsr
> cpsr 0xa0000020 123456 [ Z !C N !V EL=1 ... ]
>
> or some such.
> IOW, instead of not printing fields that are zero/false/off,
> print them as "!FIELD".

I am not sure of this one.

> That'll change x86 eflags printing and maybe some won't like that.
> I could make it some kind of option, but it feels like featuritis.

I don't feel the eflags printing change matters.

-- 
Yao (齐尧)

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Flags fields in register xml descriptions are suboptimal: What to do?
  2016-02-04 14:41 ` Yao Qi
@ 2016-02-04 15:11   ` Pedro Alves
  2016-02-04 15:19   ` Pedro Alves
  1 sibling, 0 replies; 4+ messages in thread
From: Pedro Alves @ 2016-02-04 15:11 UTC (permalink / raw)
  To: Yao Qi, Doug Evans; +Cc: gdb-patches

On 02/04/2016 02:40 PM, Yao Qi wrote:

>>
>> Also, I'd like to print flags even if they're zero. E.g.,
>>
>> (gdb) i r cpsr
>> cpsr 0xa0000020 123456 [ Z !C N !V EL=1 ... ]
>>
>> or some such.
>> IOW, instead of not printing fields that are zero/false/off,
>> print them as "!FIELD".
> 
> I am not sure of this one.

Me neither.  I don't think I'd like it, personally.  I find it easier to
spot the rogue TF or some such if only the set bits are displayed.
And I imagine that with a 64-bit flags register that would result in
a very long string hard to grok.

Thanks,
Pedro Alves

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Flags fields in register xml descriptions are suboptimal: What to do?
  2016-02-04 14:41 ` Yao Qi
  2016-02-04 15:11   ` Pedro Alves
@ 2016-02-04 15:19   ` Pedro Alves
  1 sibling, 0 replies; 4+ messages in thread
From: Pedro Alves @ 2016-02-04 15:19 UTC (permalink / raw)
  To: Yao Qi, Doug Evans; +Cc: gdb-patches

On 02/04/2016 02:40 PM, Yao Qi wrote:
> Doug Evans <dje@google.com> writes:
> 
>> > Question: What do people think of allowing the "flags" type in register xml
>> > descriptions to support fields larger than one bit?
>> > Such fields would print as NAME=value (or some such).
> That is useful, IMO.  Note that there was a patch about adding enum type
> in the target description, https://sourceware.org/ml/gdb-patches/2013-12/msg00864.html
> but it wasn't reviewed, as far as I can tell.
> 

BTW, I agree.

Thanks,
Pedro Alves

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-02-04 15:19 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-04  0:08 Flags fields in register xml descriptions are suboptimal: What to do? Doug Evans
2016-02-04 14:41 ` Yao Qi
2016-02-04 15:11   ` Pedro Alves
2016-02-04 15:19   ` Pedro Alves

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).