lipk / rust-gdb

A small Rust library for controlling GDB.
GNU General Public License v3.0
11 stars 3 forks source link

Description

rust-gdb is a WIP library for controlling GDB from Rust programs. At the moment, it can launch a GDB process, pass commands, and parse gdb's responses. rust-gdb uses GDB's Machine Interface.

Missing features:

Usage

Launching the debugger

use gdb;

let debugger = gdb::Debugger::start().unwrap();

The library will look for the gdb binary in your path.

Executing commands

use gdb;

let mut debugger = gdb::Debugger::start().unwrap();
let response = debugger.send_cmd_raw("your-command-here\n").unwrap();

send_cmd_raw currently blocks until it gets a result record from GDB, so don't use async commands :)

Response format

Currently only result records are returned by send_cmd_raw. GDB/MI output structure is described here, rust-gdb practically transforms this into a syntax tree, as described in msg.rs.