Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.
Sign upnix::sys::ptrace desperately needs documentation #649
Comments
Susurrus
added
the
A-docs
label
Jul 6, 2017
This comment has been minimized.
This comment has been minimized.
|
First of all, thanks for offering to contribute docs, unfortunately they're severely lacking for My first questions are what is your platform and what version of Looking at your examples, your code looks correct to me from what I understand about And your first issue, if we removed the external dependencies, would be a great match for our local test suite. I'd love to get this issue resolved to the point where we could get some |
This comment has been minimized.
This comment has been minimized.
|
Additionally, I'd also love to have safe functions for all the |
This comment has been minimized.
This comment has been minimized.
|
Yeah, I'll eagerly contribite the example to the testsuite. I'll try using the libc version tomorrow. To be sure - you mean this crate: https://github.com/rust-lang/libc Yeah, I wanted to say the same. I think I'd do them anyway, so why not contribute them here. But let's start small. I'll see if I can utilize libc::ptrace tomorrow |
This comment has been minimized.
This comment has been minimized.
|
@marmistrz Yes, that's the main |
This comment has been minimized.
This comment has been minimized.
|
What's the best way to add a git version as a dependency? cargo will only download from crates.io |
This comment has been minimized.
This comment has been minimized.
|
|
This comment has been minimized.
This comment has been minimized.
vincenthage
commented
Jul 6, 2017
|
Hi, |
This comment has been minimized.
This comment has been minimized.
|
Oh, so there was a mistake on my side, that I did not exit the loop after the process has exited :P So, Btw. what's the difference between Do we want to include something similar to EDIT: I've already created the register data for x64, would such a thing be ok to include into |
This comment has been minimized.
This comment has been minimized.
There isn't one. We just expose the version of
I don't know what it does, but probably not. We're trying to be a thin and safe wrapper over
Yes, but you shouldn't declare values directly in |
This comment has been minimized.
This comment has been minimized.
|
Oh, I didn't notice these types are exported vla the libc crate. But the approach that the end user (i.e. the programmer) only uses |
This comment has been minimized.
This comment has been minimized.
|
We shouldn't do any "translation", as the enum values should be the proper numeric values to start. So you'll want to write the enum like: pub enum Register {
R15 = libc::R15,
R14 = libc::R14,
R13 = libc::R13,
...
}But I searched through the |
This comment has been minimized.
This comment has been minimized.
|
Because they're here: https://doc.rust-lang.org/regex/libc/struct.user_regs_struct.html I didn't know Rust's enums are so clever. And is it possible to do something like this:
which would be equivalent to your snippet? I'll contribute that on Monday, besides I already have 3 clean wrappers around |
This comment has been minimized.
This comment has been minimized.
|
No that syntax won't work. But looking forward to a PR with your contributions! |
This comment has been minimized.
This comment has been minimized.
|
As for the registry of syscalls: raised that in |
marmistrz commentedJul 6, 2017
Hi!
First of all - I'm eager to contribute the documentation, once I've understood, how the module should be used.
I was quite new to
ptraceand I'm still learning, so I might have missed something obvious, keep this in mind please :)I had this small piece of code, which simply printed a message, whenever a syscall was entered or exited.
This worked very well. Now I translated this into Rust.
No good. Nothing displays, the process is stuck at the
wait()forever.I took a look at the
spawn-ptracecrate, which doesn't callwait()before, so next try:This displays all syscalls, compared to the C version, but panicks at the end, because the process is not in the stopped state.
Could anyone explain, how the
nix::sys::ptracemodule should be used? I'll be happy to contribute the documentation in return.