Skip to content

Instantly share code, notes, and snippets.

@spacejam
Created August 29, 2015 22:34
Show Gist options
  • Save spacejam/f4e638c1ca731e716467 to your computer and use it in GitHub Desktop.
Save spacejam/f4e638c1ca731e716467 to your computer and use it in GitHub Desktop.
debugging with rust

compile rust code with DWARF symbols

cargo -g ...

open in gdb

gdb target/debug/...

set a breakpoint at src/native/mod.rs line 57

(gdb) b src/native/mod.rs:57

run it with some command line arguments

(gdb) r <argv>
Breakpoint 1, mesos::native::delegate<closure,()> (
    raw_ptr_pair=0x7fffffffdf80, 
    lambda={void (struct (&mut Scheduler, &SchedulerDriver))} 0x7fffed3fd5b0) at src/native/mod.rs:58
58                   raw_ptr_pair);

explore state

(gdb) info locals
ptr_pair = 0x7fffffffdf80
scheduler = {<No data fields>}
scheduler_driver = 0x7fffffffe508
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment