Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/anfedotoff/gdb-command
Library for manipulating gdb in batch mode
https://github.com/anfedotoff/gdb-command
gdb rust security testing
Last synced: about 2 months ago
JSON representation
Library for manipulating gdb in batch mode
- Host: GitHub
- URL: https://github.com/anfedotoff/gdb-command
- Owner: anfedotoff
- License: mit
- Created: 2021-05-04T17:28:34.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2024-03-10T18:10:02.000Z (10 months ago)
- Last Synced: 2024-10-31T11:59:12.242Z (3 months ago)
- Topics: gdb, rust, security, testing
- Language: Rust
- Homepage:
- Size: 559 KB
- Stars: 20
- Watchers: 3
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# gdb-command
[![CI](https://github.com/xcoldhandsx/gdb-command/actions/workflows/main.yml/badge.svg?branch=master)](https://github.com/xcoldhandsx/gdb-command/actions/workflows/main.yml)
[![Crates.io](https://img.shields.io/crates/v/gdb-command)](https://crates.io/crates/gdb-command)
[![Documentation](https://docs.rs/gdb-command/badge.svg)](https://docs.rs/gdb-command)`gdb-command` is a library providing API for manipulating gdb in batch mode. It supports:
* Execution of target program (Local type).
* Opening core of target program (Core type).
* Attaching to remote process (Remote type).# Example
```rust
use std::process::Command;
use std::thread;
use std::time::Duration;
use gdb_command::*;fn main () -> error::Result<()> {
// Get stack trace from running program (stopped at crash)
let result = GdbCommand::new(&ExecType::Local(&["tests/bins/test_abort", "A"])).r().bt().launch()?;// Get stack trace from core
let result = GdbCommand::new(
&ExecType::Core {target: "tests/bins/test_canary",
core: "tests/bins/core.test_canary"})
.bt().launch()?;// Get info from remote attach to process
let mut child = Command::new("tests/bins/test_callstack_remote")
.spawn()
.expect("failed to execute child");thread::sleep(Duration::from_millis(10));
// To run this test: echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope
let result = GdbCommand::new(&ExecType::Remote(&child.id().to_string()))
.bt()
.regs()
.disassembly()
.launch();
child.kill().unwrap();Ok(())
}```
## Installation```toml
[dependencies]
gdb-command = "0.7.8"
```## License
This crate is licensed under the [MIT license].
[MIT license]: LICENSE