-
Notifications
You must be signed in to change notification settings - Fork 335
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Discrepancy in register name info between OpenOCD and GDB-MI #500
Comments
I'm not really familiar with gdb-mi, but I believe that Eclipse uses it so it must at least be possible to make things work. I'm surprised that it finds the full list of registers that OpenOCD knows about internally. The XML is intentionally limited, because if I expose all the registers there then Eclipse crashes. Where does gdb-mi get its register list from? |
So far I've only found this piece of documentation, I will look into where it's getting that big list from: Source: https://ftp.gnu.org/old-gnu/Manuals/gdb/html_node/gdb_223.html For clarification: does OpenOCD reg interact with that intentionally smaller XML? At first, I thought it was getting some device-specific info regarding the register names. |
This naming issue may also be related to the reading problem, as seen in lowRISC/opentitan#3097 The failure happens both when calling GDB-MI's In both cases, they fail at register OpenOCD's log during that failiure:
|
Hi,
I am building a VSCode debugger for RISC-V cores, based on https://github.com/Marus/cortex-debug. I have managed to change its settings so that it uses riscv-gdb and riscv-openOCD. It is successfully connecting to my OpenTitan Verilator simulation.
The stack is VSCode -> cortex-debug ( which itself is a extension of VSCode's Native Debug extension) -> GDB- MI Interface -> OpenOCD -> Device. I am using this extension because of the flexibility it gives me in configuring gdb-openOCD connections.
I think the problems I am having stem from the fact that this cortex-debugger is using the GDB-MI interface, and the outputs of that interface do not always match what openOCD returns.
To display its registers, this debugger uses the GDB-MI command data-list-register-names, and the output I believe is the whole of possible 4162 registers a RISC-V processor could have. This is from the debug console:
Meanwhile, when I actually look into the log of what openOCD is doing, I see the following output. (I have run openOCD's reg command independently and verified that the outputs match). So the debugger is at some point calling openOCD's riscv_get_gdb_reg_list_internal() function, but this is being ignored for that previous list that GDB-MI returns instead. This output shows a much smaller set of registers.
The debugger tries to read all the values from the bigger list, and because some do not exist, it fails.
GDB-MI has other commands for reading the registers, and they don't cause problems. I have tested these and if a register exists in openOCD's reg output, and if it has a value, the read will work. In other words, GDB-MI and OpencOCD will act consistently when reading register values. It is getting the list of register names that is the problem.
Is this discrepancy expected because this debugger was built for ARM cores? Are there any plans or expectations that GDB-MI and openOCD should return consistent register names for a RISC-V chip?
The text was updated successfully, but these errors were encountered: