I'm working on a new functionality for Eclipse to allow Register View to display bitfields. For this, I propose two GDB MI Command changes: 1. A new command to return a list of bitfields' names, similar to -data-list-register-name. Command: -data-list-register-bitfield-name (regno) Response: ^done,register-bitfield-names=[{name="reg0", bitfields=["A","B","C"]},{name="reg1", bitfields=["D","E"]}] If regno(register's number) is specified then the response will contain only the specified register. 2. A new option "--with-bitfields" for -data-list-register-values to include a list of bitfields' values. This option was suggested by Guinevere Larsen to receive the necessary data and not change the default response of this command. A similar approach can be used for the bitfields' names MI Command as well if is a better implementation. Command: -data-list-register-values --with-bitfields Respone: ^done,register-values=[{number="0",value="0x0",bitfields=[0,0,0]},{number="1",value="0x1",bitfields=[0,0]}] Format of the response: [{number="regNo",value="regValue",bitfields=[bitVal1,bitVal2,bitVal3]}] Initial thread of this request:https://sourceware.org/pipermail/gdb/2024-February/051071.html Any feedback regarding this feature is greatly appreciated and we are open to contribute to its implementation.
FWIW I think this seems fine. For -data-list-register-values, I suppose when returning bitfields it could also include the field names (if they exist).
Register View uses two MI Commands to populate the view with registers. One command which returns the names of the registers, and another 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. Maybe instead of implementing a new command for getting the bitfield's names, we can use the same approach by adding a --with-bitfields option to the -data-list-register-name MI Command. It might be better than having to create a new MI Command which will be used only in this case. And I forgot to mention this, in case the register doesn't have bitfields, then the bitfields list will be empty.