-
Notifications
You must be signed in to change notification settings - Fork 675
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 step function to ptrace #852
Conversation
Added step function to ptrace, this follows the same form as the PTRACE_CONTINUE by advanced the tracee by a single step!
Once this has been approved I'll update the changelog with the PR number etc 😄 |
I'd love to get an example and a test in here. Specifically it'd be good to show the syntax for how the optional argument is called both with and without it. |
Will do, am I right in recalling there's an issue with using waitpid and signals in tests? |
Added doc test for sys::ptrace::step and also updated the changelog.
src/sys/ptrace.rs
Outdated
/// `ptrace(PTRACE_SINGLESTEP, ...)` | ||
/// | ||
/// Advances the execution of the process with PID `pid` by a single step optionally delivering a | ||
/// single specified by `sig`. |
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.
"signal"
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.
Fixed!
src/sys/ptrace.rs
Outdated
/// fn main() { | ||
/// let dummy_pid = Pid::from_raw(0); | ||
/// | ||
/// let _ = step(dummy_pid, Some(Signal::SIGSTOP)); |
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.
Shouldn't you not need that Some()
on this line?
Also, any way to make this a more realistic example? This looks more like a basic test than any realistic code that might help a user use this function.
Example now matches something more akin to an actual usecase.
Hi @Susurrus I've made the changes, just checking to see if this is ready to be merged yet? |
LGTM, thanks! bors r+ |
852: Add step function to ptrace r=Susurrus a=xd009642 Added step function to ptrace, this follows the same form as the PTRACE_CONTINUE by advanced the tracee by a single step! Found when I was updating to nix 0.10.0 that this function had been missed out. Minor addition as `SINGLESTEP` works the same as `CONTINUE`
Added step function to ptrace, this follows the same form as the PTRACE_CONTINUE by advanced the tracee by a single step!
Found when I was updating to nix 0.10.0 that this function had been missed out. Minor addition as
SINGLESTEP
works the same asCONTINUE