Skip to content

Instantly share code, notes, and snippets.

@smvv
Last active December 31, 2015 22:59
Show Gist options
  • Save smvv/8056880 to your computer and use it in GitHub Desktop.
Save smvv/8056880 to your computer and use it in GitHub Desktop.
use std::run::{Process, ProcessOptions};
struct Gdb {
process: Process,
}
trait Debugger {
fn new(debuggee: ~str) -> Gdb;
fn send(&self, cmd: &str) -> int;
}
impl Debugger for Gdb {
fn new(debuggee: ~str) -> Gdb {
let args = [~"gdb", ~"--return-child-result", ~"--quiet", ~"--nx",
~"--interpreter=mi2", debuggee];
let options = ProcessOptions { env: None, dir: None, in_fd: None,
out_fd: None, err_fd: None };
let process = Process::new("gdb", args, options);
let gdb = Gdb { process: process };
gdb.send("");
return gdb;
}
fn send(&self, cmd: &str) -> int {
}
}
pub fn main() {
let gdb = Debugger::new(~"test/hello");
gdb.send("hi");
}
/*
:!make
rustpkg build rust-debugger
WARNING: The Rust package manager is experimental and may be unstable
/home/smvv/work/rust/rust-debugger/src/rust-debugger/main.rs:34:14: 34:27 error: cannot determine a type for this bounded type parameter: unconstrained type
/home/smvv/work/rust/rust-debugger/src/rust-debugger/main.rs:34 let gdb = Debugger::new(~"test/hello");
^~~~~~~~~~~~~
task '<unnamed>' failed at 'explicit failure', /home/smvv/work/rust/rust/src/libsyntax/diagnostic.rs:75
task '<unnamed>' failed at 'receiving on closed channel', /home/smvv/work/rust/rust/src/libstd/rt/comm.rs:198
make: *** [all] Error 65
rustc 0.9-pre (ea5d1df 2013-11-20 23:31:27 -0800)
host: x86_64-unknown-linux-gnu
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment