-
Notifications
You must be signed in to change notification settings - Fork 327
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: define register printers #892
Conversation
This commit fails
IMHO, this is an insignificant drawback, since there are other macro which also reuse their's arguments (e.g. If you have any suggestions on how to fix or disable (locally) this warning, I would be glad to hear them. |
The changes to |
0e4db6e
to
0dfacaa
Compare
The format is: e.g:
|
0dfacaa
to
4617c56
Compare
737127f
to
245aab6
Compare
e1105f4
to
154e7aa
Compare
The only warning from
I'm not shure what is the best approach. |
We can ignore that warning and merge it anyway when the time comes. |
5a16f4d
to
a81b702
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.
This code looks good. I'll head over to riscv/riscv-debug-spec#858 now.
a81b702
to
f826928
Compare
@timsifive, @JanMatCodasip, can this be merged (since riscv/riscv-debug-spec#858 is already merged), or should I make some adjustments? |
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.
Despite having somewhat different opinion on what the API of debug_defines.h could be, I like this change overall and it looks to me like a nice step forward in unification of the log prints. Thanks!
I believe there are few minor items to address prior to the merge.
src/target/riscv/debug_defines.c
Outdated
@@ -0,0 +1,4145 @@ | |||
/* | |||
* This file is auto-generated by running 'make debug_defines' in | |||
* https://github.com/riscv/riscv-debug-spec/ (d749752-dirty) |
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.
Please, can you re-generate these files from a non-dirty revision of the debug spec repo.
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 is intentional. I would like to avoid updating the version of the spec used to generate this file, since it would require a lot of changes in code (some constants were renamed and so on). The version is marked as dirty to indicate that the generators were cherry-picked on top of d749752
. If you insist, I will update debug_defines.h
to current version, though I'm not sure if it is the best time to do so.
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.
I would like to avoid updating the version of the spec used to generate this file, since it would require a lot of changes in code (some constants were renamed and so on).
Understood. In that case, it is my recommendation to leave this merge request as is, but please make a proper upgrade of the debug_defines (from a clean commit) in a subsequent merge request.
The version is marked as dirty to indicate that the generators were cherry-picked on top of d749752
This is exactly the reason why I suggest to use a clean commit -- we can't expect other developers to figure out what needs to be cherry-picked where (what mixture of commits to make) in order to replicate your work, e.g. during troubleshooting.
Thanks.
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.
I have re-checked and the changes to the code are limited (only one function), so I updated the version of debug_defines.h
in this MR.
f826928
to
aa5b2e6
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.
This looks fine to me.
I have only one remark #892 (comment) (which can be addressed as a separate merge request to keep the changes easier to review).
Thank you.
`riscv_debug_reg_to_s()` can be used to decode register value. If the pointer to buffer is `NULL` it does not print anything, just returns the length of the string. The format is: `<register_value> { <field_name>=<field_value_name or field_value>, ..., }` e.g: `0x400382 { version=2, ... ndmresetpending=false, }` `0x321009 { regno=0x1009, ... cmdtype=0, }` Change-Id: I63733d8d36385d89ca15de1a43139134bc488c4f Signed-off-by: Evgeniy Naydanov <[email protected]>
aa5b2e6
to
43ebdd4
Compare
@timsifive, @JanMatCodasip can this be merged or is there some action required to be done? |
This commit implements facilities to decode register fields for each register described in debug_defines.h.
Namely:
<REG_NAME>_FORMAT_STR
<REG_NAME>_FORMAT_ARGS(value)
The use case is demonstarted by changing debug message in
execute_abstract_command()
Change-Id: I63733d8d36385d89ca15de1a43139134bc488c4f