rsps

A command line tool to help find and debug Rust programs on your machine. Inspired by gops and a fit of boredom.

This only works if the binaries haven't be stripped beforehand.

Installation

bash $ cargo install rsps

Usage

List (default)

Lists all running Rust processes.

bash $ rsps # or rsps list PID Parent Name Path 58988 54401 rg /usr/local/bin/rg 58989 47182 rsps target/debug/rsps

Tree

Displays Rust processes in a tree-like format.

bash $ rsps tree @ ├── 59235 [treem] │ └── 59236 [branch] │ ├── 59238 [leaf] │ ├── 59237 [branch] │ │ ├── 59240 [branch] │ │ │ ├── 59244 [leaf] │ │ │ ├── 59242 [branch] │ │ │ │ └── 59245 [leaf] │ │ │ └── 59243 [branch] │ │ │ └── 59246 [leaf] │ │ └── 59241 [leaf] │ └── 59239 [leaf] └── 59262 [rsps]

Stack (Linux only)

Dumps the stack of a running Rust process, given the name or pid.

```bash $ rsps stack cargo # or rsps stack Thread ID: 279 Name: cargo Stack Dump: Frame #0: 7fe294f5e100 pthreadcondtimedwait Frame #1: 564691cee080 std::sys::unix::condvar::Condvar::waittimeout::h37a8048107691687 Frame #2: 5646915f9fd0 std::sync::condvar::Condvar::waittimeoutwhile::hbfb743bd05dd9fc0 Frame #3: 564691415440 cargo::util::queue::Queue::pop::h7fb70103b44dc37f Frame #4: 56469154fbd0 cargo::core::compiler::jobqueue::DrainState::drainthequeue::h5b61c7275f6c30ad Frame #5: 564691504160 std::panic::catchunwind::h7e0c92cfb502709b Frame #6: 5646914af4c0 crossbeamutils::thread::scope::haf6d0e4c1aacb903 Frame #7: 56469154ec30 cargo::core::compiler::jobqueue::JobQueue::execute::heaab11ff0a2fe80c Frame #8: 564691437360 cargo::core::compiler::context::Context::compile::h35d7a4cf82b1b826 Frame #9: 564691697d00 cargo::ops::cargocompile::compilews::hd140871262d59407 Frame #10: 56469147c350 cargo::ops::cargoinstall::installone::h63708159c342d27f Frame #11: 56469147af40 cargo::ops::cargoinstall::install::h101310e8cf160103 Frame #12: 564691365c20 cargo::commands::install::exec::h064cce367657894c Frame #13: 564691358d60 cargo::cli::main::h71faf507b10707d7 Frame #14: 5646913c11d0 cargo::main::h6746203463cb9d36 Frame #15: 5646913b29c0 std::syscommon::backtrace::rustbeginshortbacktrace::h715a397fa07175af Frame #16: 5646913b29e0 std::rt::langstart::{{closure}}::h3a8e3bf998c29384 Frame #17: 564691cebc10 std::rt::langstartinternal::hd5b67df56ca01dae Frame #18: 5646913c3580 main Frame #19: 7fe294c2afb0 _libcstartmain Frame #20:

Thread ID: 297 Name: cargo Stack Dump: Frame #0: 7fe294cf57d0 poll Frame #1: 564691cacb60 jobserver::imp::Client::acquireallowinterrupts::h4f87d446882f6e88 Frame #2: 564691cae370 jobserver::HelperState::foreachrequest::h80f41bf960986b48 Frame #3: 564691cae680 std::syscommon::backtrace::rustbeginshortbacktrace::hcb30739b281791a0 Frame #4: 564691caf0e0 core::ops::function::FnOnce::callonce{{vtable.shim}}::h6fcaf617e71843a9 Frame #5: 564691cf5210 std::sys::unix::thread::Thread::new::threadstart::hb5e40d3d934ebb7a Frame #6: 7fe294f57eb0 start_thread Frame #7:

[...] ```

Currently limited to Linux only due to rstack only building on Linux.

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.