On Mon, Apr 8, 2013 at 11:55 AM, Artella Coding
<artella.cod...@googlemail.com> wrote:
> Hi, I know that if I have the following basic program :
>
>
> ***********
> ///hello.rs
> fn main(){
>    io::println("Hello");
> }
> ***********
>
> then the command :
>
>>rustc hello.rs
>
> produces an executable called hello which I can then run in ubuntu,
>
> How would I compile it so that I can then use gdb to debug, for example to
> set a breakpoint on println? So far I have only found the following as an
> example of someone using GDB to debug Rust :
> https://github.com/mozilla/rust/issues/1174 . Thanks.

First, you need to run rustc -g hello.rs -- the -g flag tells rustc to
generate debuginfo.

After that, you can use gdb on the resulting executable and set
breakpoints, get a stack trace (with bt), and possibly some of the
other things you usually do with gdb. It's useful to know that if you
set a break on upcall_fail , then you'll break at any point where your
program calls the fail!() macro or has an assertion failure arising
from assert!().

Cheers,
Tim


-- 
Tim Chevalier * http://catamorphism.org/ * Often in error, never in doubt
"Too much to carry, too much to let go
Time goes fast, learning goes slow." -- Bruce Cockburn
_______________________________________________
Rust-dev mailing list
Rust-dev@mozilla.org
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to