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

waitpid loses PTRACE_EVENT stop info from status #434

Closed
luser opened this issue Oct 7, 2016 · 3 comments
Closed

waitpid loses PTRACE_EVENT stop info from status #434

luser opened this issue Oct 7, 2016 · 3 comments

Comments

@luser
Copy link

luser commented Oct 7, 2016

The ptrace(2) docs say:

PTRACE_EVENT stops are observed by the tracer as waitpid(2) returning
with WIFSTOPPED(status), and WSTOPSIG(status) returns SIGTRAP. An
additional bit is set in the higher byte of the status word: the
value status>>8 will be
(SIGTRAP | PTRACE_EVENT_foo << 8).

Currently waitpid decodes the signal with status::stop_signal, but loses this info. Maybe WaitStatus::Stopped could have an extra Option<PtraceEvent> field, where PtraceEvent could be an enum for the PTRACE_EVENT_* values?

I did some cursory investigation on how ptrace works on non-Linux platforms and couldn't find any equivalent usage here, so I guess this wouldn't be relevant elsewhere. I don't know what the convention is for situations like this--would we just have a unit PtraceEvent struct there?

@luser
Copy link
Author

luser commented Oct 7, 2016

Apparently this PR implements support for this: #273

luser added a commit to luser/nix that referenced this issue Nov 4, 2016
TethysSvensson pushed a commit to TethysSvensson/nix that referenced this issue Jan 27, 2017
@Susurrus
Copy link
Contributor

Susurrus commented Jun 4, 2017

@luser Was this resolved to your satisfaction? I'd like to close this issue if it has.

@luser
Copy link
Author

luser commented Jun 5, 2017

Yes, #438 fixed this and solved my use case.

@Susurrus Susurrus closed this as completed Jun 5, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants