Crates.io | gdb-command |
lib.rs | gdb-command |
version | 0.7.8 |
source | src |
created_at | 2021-05-05 13:52:55.032875 |
updated_at | 2024-03-10 18:11:39.501405 |
description | Wrapper for gdb in batch mode. |
homepage | https://github.com/anfedotoff/gdb-command.git |
repository | https://github.com/anfedotoff/gdb-command.git |
max_upload_size | |
id | 393446 |
size | 35,107 |
gdb-command
is a library providing API for manipulating gdb in batch mode. It supports:
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(())
}
[dependencies]
gdb-command = "0.7.8"
This crate is licensed under the MIT license.