-
Notifications
You must be signed in to change notification settings - Fork 111
Add an option to dump registers as JSON #128
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
Conversation
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.
Squash the commits and update README.md
.
@@ -1456,3 +1457,13 @@ void ecall_handler(riscv_t *rv) | |||
rv_except_ecall_M(rv, 0); | |||
syscall_handler(rv); | |||
} | |||
|
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 feel a little bit weird to dump the result at STDOUT and forcing to silence the output from syscall_handler
for this. Since these two features don't depend on each other. Will providing an extra argument for option --dump-registers
to specify where to output(it could be a file name or STDOUT, if we really need it) become better?
And if we would like to not output the message from syscall_handler
, we may introduce another command line option there.
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.
Rebase and resolve the conflicts.
@jserv Yes, sure. Also I will add a silence option respecting the following comment.
I will squash the commits. However how can I update |
You can add the description about the proposed option of this emulator. |
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.
Thank you! I have no problem now. Just remember to update the README.md
as @jserv required.
"dump-registers.\n"); | ||
return false; | ||
} | ||
registers_out_file = args[++i]; |
Check notice
Code scanning / CodeQL
For loop variable changed in body
@@ -237,6 +264,10 @@ | |||
run(rv); | |||
} | |||
|
|||
/* dump registers as JSON */ | |||
if (opt_dump_regs) | |||
dump_registers(rv, registers_out_file); |
Check failure
Code scanning / CodeQL
Uncontrolled data used in path expression
if (strncmp(out_file_path, "-", 1) == 0) { | ||
f = stdout; | ||
} else { | ||
f = fopen(out_file_path, "w"); |
Check failure
Code scanning / CodeQL
File created without restricting permissions
Thank @long-long-float for contributing! |
I added an option
--dump-registers
to dump registers as JSON.This is useful for automated testing RISC-V binaries.