From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.cyberthorstudios.com (cyberthorstudios.com [52.27.139.110]) by sourceware.org (Postfix) with ESMTPS id 807903858C50 for ; Tue, 5 Mar 2024 09:57:13 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 807903858C50 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=cyberthorstudios.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=cyberthorstudios.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 807903858C50 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=52.27.139.110 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1709632636; cv=none; b=md5qRfc+OUxFqqNSlt6l2s9Dxg2F1blkmzEI+8M+lqSM4A7ib5fE5xFOF3QVkTC7wtHggkgh2Py7n5W47S2yEm0v+Hl7RmSf8zN4IKEQz78JdmcflOw41SN4tkwdvstr+wxzb/9laVqX6MZULlitens78+Yg4j9wWPQfOBjPIvE= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1709632636; c=relaxed/simple; bh=+V/14Myofyguy4MQFtBo70K5tGh5Efs/zhTwloPjWjI=; h=MIME-Version:Date:From:To:Subject:Message-ID; b=Z7plLOkMJSoQCr/5Oo70CHp2EpGJTyto90mQruLGyHjRGLtCKf8qUnbbDGj+/eWFZg72DVXesXbbGzaaXaX3qNbVERNI/6M+PWtI3IiI4i6safu5CnbRPKZrOaLuOuvMfu5xmGmpMNhfCXsFPVUGw68tk/0wzx79rWOchd1YOV0= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from cyberthorstudios.com (cyberthorstudios.com [52.27.139.110]) by mail.cyberthorstudios.com (Postfix) with ESMTPSA id 929A062B54; Tue, 5 Mar 2024 09:57:12 +0000 (UTC) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Date: Tue, 05 Mar 2024 11:57:12 +0200 From: =?UTF-8?Q?Robert_P=C3=AErvu?= To: gdb@sourceware.org Cc: Guinevere Larsen Subject: Re: Register View bitfields support In-Reply-To: <3d5623f5-082b-4ee3-bdf1-0c2bf5f8b122@redhat.com> References: <3d5623f5-082b-4ee3-bdf1-0c2bf5f8b122@redhat.com> Message-ID: <203cc51df3a3c9f6e1c8860b7d33aba8@cyberthorstudios.com> X-Sender: robert.pirvu@cyberthorstudios.com User-Agent: Roundcube Webmail/1.1.4 X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,KAM_DMARC_STATUS,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On 2024-02-16 14:00, Guinevere Larsen wrote: > 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 > Hello Guinevere, thank you for the reply :) >> >> 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 > As far as I am aware, at the start of the debugging session, GDB already has data about the registers such as names, positions, and values. With the current format of the -data-list-register-values MI Command, bitfields are returned together with the register's value under the following format: value={Register Value In Specified Format,[List of Bitfields Names]}. >> >> 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. This is a good idea, I wasn't aware it was possible to change the output format in this way. > >> >> 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. You're right having empty lists makes more sense than not returning anything at all. And I don't think there will be any case in which a register would not be returned. > > 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. > Register View uses two MI Commands to populate the view with registers. One command which returns the names of the registers, and another one which returns the positions and values of the registers. I wanted to have a bit of consistency with the commands and that is why I proposed to have something similar, one command to return the names of bitfields and one for the values. And it will be a lot easier for this to work with the existing parsers used by the Register View. >> >> 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. Thank you again for your feedback. As you advised me I opened a Feature Request on the Bug Tracker: https://sourceware.org/bugzilla/show_bug.cgi?id=31448 including your suggestion with the --with-bitfields option for the -data-list-register-values MI Command.