Skip to content
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

Merged
merged 4 commits into from
Feb 7, 2018
Merged

Add step function to ptrace #852

merged 4 commits into from
Feb 7, 2018

Conversation

xd009642
Copy link
Contributor

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!
@xd009642
Copy link
Contributor Author

Once this has been approved I'll update the changelog with the PR number etc 😄

@Susurrus
Copy link
Contributor

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.

@xd009642
Copy link
Contributor Author

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.
/// `ptrace(PTRACE_SINGLESTEP, ...)`
///
/// Advances the execution of the process with PID `pid` by a single step optionally delivering a
/// single specified by `sig`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"signal"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed!

/// fn main() {
/// let dummy_pid = Pid::from_raw(0);
///
/// let _ = step(dummy_pid, Some(Signal::SIGSTOP));
Copy link
Contributor

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.
@xd009642
Copy link
Contributor Author

xd009642 commented Feb 5, 2018

Hi @Susurrus I've made the changes, just checking to see if this is ready to be merged yet?

@Susurrus
Copy link
Contributor

Susurrus commented Feb 7, 2018

LGTM, thanks!

bors r+

bors bot added a commit that referenced this pull request Feb 7, 2018
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`
@bors
Copy link
Contributor

bors bot commented Feb 7, 2018

@bors bors bot merged commit 445b488 into nix-rust:master Feb 7, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants