-
-
Notifications
You must be signed in to change notification settings - Fork 51
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
Add support for QCatchSyscalls #57
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.
Thanks for yet another great PR!
As always, the core implementation looks great, and my comments are primarily nits.
I think the iterator approach is a fine way to pass syscall numbers to the Target. The alternative would be to break the API into multiple methods such as as catch_syscall(&mut self, syscall_no: Usize)
and clear_filter(&mut self, syscall_no: Usize)
, where you iterate over the list within gdbstub
and invoke catch_syscall
for each syscall. I'll leave it up to you to decide how you'd like the API to work, since you've got hands on experience actually implementing the underlying Target
functionality.
And thank you for taking the initiative to include the protocol output from your emulator! I'll update the PR template to include something along the lines of "if the feature isn't feasible to demo in armv4t
, please include output from your own gdbstub
integration".
- Refactor syscall number parsing code. - Add support returning error codes from catch syscall handlers
Updated with changes and rebased on top of the latest master. |
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've got one final nit, but aside from that, LGTM!
Just a heads up, but I'll be out from the 28th (tomorrow) to the 31st (monday). As such, while we could probably merge this into master
tonight, I don't think I'll have time to cut a 0.5.1
release until early next week.
Great, thanks. It's not an issue for me not being released -- I have many patched github dependencies already. |
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.
Sounds good 👍
I also realized that there were a couple minor things I missed that'll need to get fixed - sorry 😅
Once those are ironed out, we should be good to go.
Done. I've also updated the trace output in the PR description. |
Awesome. Thanks again! 🎉 |
Description
Implements
QCatchSyscalls
extension, see:QCatchSyscalls
.I needed this for finding a bug in my emulator.
Notes:
There is a minor issue where if GDB sends syscall numbers larger than
Arch::Usize
, it will result in an integer overflow and the current implementation will silently ignore them and they will not reach the target. This is because I reused the argument handling code fromvRun
to avoid allocations. This could probably be improved by writing a new handler, but I avoided doing for now, since I wasn't sure about using the iterator approach to pass the syscall numbers to the Target impl any way.API Stability
Checklist
cargo build
compiles withouterrors
orwarnings
cargo clippy
runs withouterrors
orwarnings
cargo fmt
was runexamples/armv4t
examples/armv4t
withRUST_LOG=trace
+ any relevant GDB output under the "Validation" section below./scripts/test_dead_code_elim.sh
and/or./example_no_std/check_size.sh
)Validation
GDB output
armv4t output
Since the example implementation never actually performs a syscall, I've also attached a trace of it running in my emulator (binary just prints
Hello World
using a singlewritev
syscall).GDB output
Protocol output