-
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
target/riscv: hide_csrs configuration option #787
Conversation
I describe the motivation for this PR here: #785 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks alright. Can you document this new command in doc/openocd.texi?
src/target/riscv/riscv.h
Outdated
@@ -248,6 +248,10 @@ typedef struct { | |||
* from range 0xc000 ... 0xffff. */ | |||
struct list_head expose_custom; | |||
|
|||
/* The list of registers to mark as "hidden". Hidden registers are available | |||
* but do not appear in gdb targets description or reg command output. */ | |||
struct list_head hidden_csr; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
struct list_head hidden_csr; | |
struct list_head hide_csr; |
To keep naming consistent with expose_csr
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
addressed
src/target/riscv/riscv.c
Outdated
.help = "Configure a list of inclusive ranges for CSRs to mark them as " | ||
"hidden. Hidden registers are still available, but are not listed in " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.help = "Configure a list of inclusive ranges for CSRs to mark them as " | |
"hidden. Hidden registers are still available, but are not listed in " | |
.help = "Configure a list of inclusive ranges for CSRs to hide from gdb. " | |
"Hidden registers are still available, but are not listed in " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for suggestion, addressed
src/target/riscv/riscv.c
Outdated
range_list_t *entry; | ||
list_for_each_entry(entry, &info->hidden_csr, list) | ||
if ((entry->low <= csr_number) && (csr_number <= entry->high)) { | ||
LOG_DEBUG("Hiding CSR %d (name=%s)", csr_number, r->name); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LOG_DEBUG("Hiding CSR %d (name=%s)", csr_number, r->name); | |
LOG_TARGET_DEBUG(target, "Hiding CSR %d (name=%s)", csr_number, r->name); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
addressed
If it's going to be added then why not generalise it to allow ANY register to be hidden - integer, floating point, CSR - using any of the canonical name, the assembler mnemonic name, the ABI name(s?), any other relevant names (e.g. CSR alias names, deprecated/demoted CSR names)? |
@@ -3675,6 +3700,16 @@ static const struct command_registration riscv_exec_command_handlers[] = { | |||
"expose. custom0 is accessed as abstract register number 0xc000, " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why does it have to be executed before init
?
Might the GDB user want to do monitor ...
to change the register list?
Will the commands work via the OpenOCD telnet interface?
See here for my comment about identifying registers by name:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why does it have to be executed before init?
Because list of available registers is built/initialized during target examination procedure.
Might the GDB user want to do monitor ... to change the register list?
Will the commands work via the OpenOCD telnet interface?
This won't work. There are a couple of reasons for that.
- As is - the command can be run during the configuration stage only. That is before gdbserver client can connect.
- AFAIK the remote target configuration is requested by gdb only once upon connection. Maybe there are ways to re-request it, but I'm not aware of them currently (+ see the next item).
- The way registers are initialized in OpenOCD complicates things. These are initialized during the examine procedure. And making OpenOCD to re-examine target may imply way too many changes.
Regarding this one (from @TommyMurphyTM1234 ):
|
@timsifive, regarding this one:
Sure (I've completely forgotten about it). |
That sounds like a lot of work for registers that nobody might ever want to hide. As it is the CSR work is already done so easy to hook into for this feature. At a minimum the parser would get a lot more complex to support what you mentioned above. |
OK - fair enough. :-) |
4e0bf6f
to
6856cd4
Compare
I've added a short section. @TommyMurphyTM1234 and @timsifive
yep. I would prefer not to touch that code. It's messy even in GDB. |
This option allows users to mark certain CSRs as hidden so they could be expluded from *reg* output and target.xml Change-Id: Iddf8456cd3901f572f8590329ebba5229974d24a
6856cd4
to
57aacec
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks fine. I have noticed just two small typos.
Co-authored-by: Jan Matyas <50193733+JanMatCodasip@users.noreply.github.com> Signed-off-by: Anatoly Parshintsev <114445139+aap-sc@users.noreply.github.com>
Co-authored-by: Jan Matyas <50193733+JanMatCodasip@users.noreply.github.com> Signed-off-by: Anatoly Parshintsev <114445139+aap-sc@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's even better now. :-)
This option allows users to mark certain CSRs as hidden so they could be expluded from reg output and target.xml
Change-Id: Iddf8456cd3901f572f8590329ebba5229974d24a