Artelia (cc'ing rust-dev)-

FYI: There is no '-g' flag, at least not in Rust 0.6. According to the #rust IRC channel, the correct flag is now "-Z debug-info"

From the #rust IRC channel: http://irclog.gr/#show/irc.mozilla.org/rust/444262

Cheers,
-Felix

On 08/04/2013 14:45, Tim Chevalier wrote:
On Mon, Apr 8, 2013 at 11:55 AM, Artella Coding
<[email protected]> 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




--
irc: pnkfelix on irc.mozilla.org
email: {fklock, pnkfelix}@mozilla.org

_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to