public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
From: Guinevere Larsen <blarsen@redhat.com>
To: "Robert Pîrvu" <robert.pirvu@cyberthorstudios.com>, gdb@sourceware.org
Cc: Sebastian Perta <sebastian.perta@bp.renesas.com>,
	Mark Goodchild <mark.goodchild@renesas.com>
Subject: Re: Register View bitfields support
Date: Fri, 16 Feb 2024 13:00:57 +0100	[thread overview]
Message-ID: <3d5623f5-082b-4ee3-bdf1-0c2bf5f8b122@redhat.com> (raw)
In-Reply-To: <c2a8a34b45c6599e30319335b3e28dcd@cyberthorstudios.com>

On 09/02/2024 13:56, Robert Pîrvu via Gdb wrote:
> Hello,
>
> I am a cdt developer and I'm working on a new functionality for 
> Eclipse's Register View.

Hi!

I'm replying to this mostly so you're not left out to dry, since I'm not 
too familiar with the MI interpreter and I never seen anything like this 
in the CLI interpreter. That said, I do have a few thoughts left inline

>
> The current implementation of the Register View does not allow the 
> display of individual fields of a register with bitfields. This 
> functionality is only available in the Expression view by creating a 
> new expression using the “$” and the name of the register.
> Register view has a grouping functionality that allows us to create 
> custom groups of registers, those groups can be expanded and collapsed 
> to show/hide the register in the said group. The same functionality of 
> expanding and collapsing can be added to a register with bitfield.

My first question is: Does GDB already know of these bitfields? I am not 
sure if it does or not from your description of using Expression View. 
If we already know, having a convenient way to access them sounds like a 
good idea.

If we don't, are they architecture specific? Is the expectation that 
we'd keep that information up to date? Or is this something that should 
(or could) be user-defined? If the latter, the implementation should 
probably come with a way to define them.

Sorry if these questions are very basic, this is pretty far from the 
bits I work on

>
> The implementation of this would require the modification of the 
> -data-list-register-values MI Command to include a list of registers’s 
> bitfields.
> And the introduction of a new MI Command 
> -data-list-register-bitfields-name, is also needed to retrieve the 
> names of the bitfields.
>
> The modified -data-list-register-values would have the following format:
>
> Command: -data-list-register-values [ --skip-unavailable ] fmt [ ( 
> regno )*]
> Respone: 
> ^done,register-values=[{number="0",value="0”,bitfields=“{value=0, 
> value=0}"}, {number="1",value="{0}”,bitfields=“{[]},...]
> Format of the response: [{number="0",value="0”,bitfields=“{[value=0], 
> [value=0]}"}]
>
> The --skip-unavailable option indicates that only the available 
> registers are to be returned.
> The regno option indicates that only the specified register needs to 
> be returned. If no register is specified then all registers will be 
> returned.
> The fmt indicates the format according to which the registers' 
> contents are to be returned. Allowed formats for fmt are:
>
> Hexadecimal - x
> Octal - o
> Binary - t
> Decimal - d
> Raw - r
> Natural - N
>
> If a register doesn't have bitfields, then the bitfields list will be 
> empty or it can be not included in the response.

I think this is a complicated change. I'm not sure how strict we are 
with output consistency, but I think we have to be pretty consistent to 
not break every user of the MI protocol, so adding a new field in this 
return doesn't sound like a great idea to me.

I would suggest adding a new option, --with-bitfields for example, which 
has this output, and leave the default response with the same format.

>
> The new MI Command will have the following format:
>
> Command: -data-list-register-bitfield-name [ ( regno )+ ]
> Response: ^done,register-bitfield-names=[{name="reg0", bitfields 
> =["C", "M"]},{name="reg1", bitfields =["A", "B"]}, ...]
>
> The regno option indicates that only the specified register needs to 
> be returned. If no register is specified then all registers will be 
> returned.
>
> If the register doesn't have bitfields, then the bitfields list will 
> be empty or not included in the response.

When would registers not be included? From the previous paragraph it 
sounds like they'd always be included, and having empty lists make sense.

I don't have any strong opinions on which option is better, just 
commenting on the current explanation. Either way, this can be worked 
out when the implementation itself is being discussed in the patches 
that add it.

>
> Any feedback regarding this feature is greatly appreciated and we are 
> open to contribute to its implementation.

I think this is a cool idea, regardless if these bitfields are 
arch-defined or user-defined. If you show up with patches with an 
implementation for this, I'll be happy to do my best in reviewing them 
(though I can't approve them for merging), otherwise I think the best 
way to go about it is opening a feature request (called Request For 
Enhancement, RFE) on our bug tracker (https://sourceware.org/bugzilla/). 
You can open the bug yourself or I can open for you if you have troubles 
with the account creation process.

-- 
Cheers,
Guinevere Larsen
She/Her/Hers

>
> Best Regards,
> Robert.
>
>


  reply	other threads:[~2024-02-16 12:01 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-09 12:56 Robert Pîrvu
2024-02-16 12:00 ` Guinevere Larsen [this message]
2024-03-05  9:57   ` Robert Pîrvu

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=3d5623f5-082b-4ee3-bdf1-0c2bf5f8b122@redhat.com \
    --to=blarsen@redhat.com \
    --cc=gdb@sourceware.org \
    --cc=mark.goodchild@renesas.com \
    --cc=robert.pirvu@cyberthorstudios.com \
    --cc=sebastian.perta@bp.renesas.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).