remoteprocess
This crate provides a cross platform way of querying information about other processes running on the system. This let's you build profiling and debugging tools.
Features:
- Suspending the execution of the process
- Getting the process executable name and current working directory
- Listing all the threads in the process
- Getting a stack trace for a thread in the target process
- Resolve symbols for an address in the other process
- Figure out if a thread is active or not
This crate provides implementations for Linux, OSX and Windows.
Usage
To show a stack trace from each thread in a program
A complete program with this code can be found in the examples folder.
Credits
This crate heavily relies on the gimli project. Gimli is an amazing tool for parsing DWARF debugging information, and we are using it here for getting stack traces and looking up filename and line numbers given an instruction pointeer.
This crate includes code that was originally written as part of backtrace-rs. In particular, we are using the OSX symbolication code from backtrace-rs, which was modified here to support working with remote processes. This also requires a utility module (dylib.rs) from backtrace-rs to dynamically load the core symbolication framework on OSX, and which is also being used on linux to load libunwind-ptrace if it is installed for a fallback stack unwinder. backtrace-rs is licensed under the MIT license, a copy of which is included in the relevant files here.