Hi Ricardo,
lldb should work OK with Rust executables. The error you mention should be solved by also specifying the file containing the line you want to break in. So instead of writing just `b -l 5`, try `b -l 5 -f main.rs` instead (specifying the correct source filename, of course). The command `b main.rs:5` (i.e. like you would type it in GDB) should also work.

Cheers,
Michael

On 20/05/14 20:26, Ricardo Brandão wrote:
Eric,

I tried lldb with rust:

You can notice that it runs, but I could not set breakpoint,

Anyway is not a problem work with Ubuntu on my VirtualBox, but could be nice have another option. :)

Thanks

$ lldb ./h
Current executable set to './h' (x86_64).
(lldb) b -l 5
error: No selected frame to use to find the default file.
error: No file supplied and no default file available.
(lldb) run
Process 49619 launched: './h' (x86_64)
Hello Ricardo!
Process 49619 exited with status = 0 (0x00000000)
(lldb)

To be sure lldb was working, I tried with a hello world in c, and worked fine:

$ lldb a.out
Current executable set to 'a.out' (x86_64).
(lldb) break 5
invalid command 'breakpoint 5'
(lldb) b -l 5
Breakpoint 1: where = a.out`main + 22 at hello.c:5, address = 0x0000000100000f26
(lldb) run
Process 49605 launched: '/Users/rbrandao/Google Drive/PrgC/a.out' (x86_64)
Process 49605 stopped
* thread #1: tid = 0xd01f8, 0x0000000100000f26 a.out`main + 22 at hello.c:5, queue = 'com.apple.main-thread', stop reason = breakpoint 1.1
    frame #0: 0x0000000100000f26 a.out`main + 22 at hello.c:5
   2
   3       int main()
   4       {
-> 5       printf("Hello, world!\n");
   6       return 0;
   7       }
(lldb) step
Hello, world!
Process 49605 stopped
* thread #1: tid = 0xd01f8, 0x0000000100000f32 a.out`main + 34 at hello.c:6, queue = 'com.apple.main-thread', stop reason = step in
    frame #0: 0x0000000100000f32 a.out`main + 34 at hello.c:6
   3       int main()
   4       {
   5       printf("Hello, world!\n");
-> 6       return 0;
   7       }
(lldb) q


On Tue, May 20, 2014 at 2:04 PM, Eric Christopher <[email protected] <mailto:[email protected]>> wrote:

    > Type "apropos word" to search for commands related to "word"...
    > Reading symbols from h...
    > warning: `/Users/rbrandao/Google Drive/PrgRust/Tutorial/h.o':
    can't open to
    > read symbols: No such file or directory.
    >

    This seems bad. Does the file exist in that path?

    > warning: can't find symbol 'get_num_cpus' in minsymtab
    >
    > warning: can't find symbol 'je_chunk_alloc_dss' in minsymtab
    >
    > warning: can't find symbol 'je_chunk_dss_boot' in minsymtab
    >
    > warning: can't find symbol 'je_chunk_dss_postfork_child' in
    minsymtab
    >
    > warning: can't find symbol 'je_chunk_dss_postfork_parent' in
    minsymtab
    >
    > warning: can't find symbol 'je_extent_tree_ad_first' in minsymtab
    >
    > warning: can't find symbol 'je_rtree_delete' in minsymtab
    > done.
    > (gdb) break main
    > Breakpoint 1 at 0x1000015a0
    > (gdb) run
    > Starting program: /Users/rbrandao/PrgRust/Tutorial/h
    > Unable to find Mach task port for process-id 34102: (os/kern)
    failure (0x5).
    >  (please check gdb is codesigned - see taskgated(8))
    >

    This is your other real problem. You need to code sign your gdb in
    order for it to work. Can you try lldb and see how that works for you?
    Alternately you'll need to sign the gdb you built.

    -eric

     (gdb)
    >
    > Regards,
    >
    > Ricardo
    >
    >
    > On Mon, May 19, 2014 at 6:54 PM, Isaac Hollander McCreery
    > <[email protected] <mailto:[email protected]>> wrote:
    >>
    >> Hi Ricardo,
    >>
    >> Can you provide more information about how it fails?
    >>
    >> OS X 10.9 no longer ships with gdb, instead preferring lldb,
    (the whole
    >> system has shifted over to LLVM's ecosystem, e.g. clang instead
    of gcc).
    >> Have you tried lldb?
    >>
    >> Regards,
    >> Ike
    >>
    >>
    >> On Mon, May 19, 2014 at 5:43 PM, Ricardo Brandão
    <[email protected] <mailto:[email protected]>>
    >> wrote:
    >>>
    >>> Hi All,
    >>>
    >>> Today I've tried to use gdb to debug rust programs.
    >>>
    >>> I compiled with -g: rustc -g hello.rs <http://hello.rs>
    >>>
    >>> and ran gdb hello
    >>>
    >>> On Ubuntu it worked fine, but in Mac (OS 10.8) doesn't. Anyone
    already
    >>> faced this issue on Mac?
    >>>
    >>> Thanks in advance
    >>>
    >>> --
    >>> Ricardo Brandão
    >>> http://www.programonauta.com.br
    >>>
    >>> ........__@
    >>> ....._  \ >_
    >>> ....(_) /  (_)
    >>>
    >>> _______________________________________________
    >>> Rust-dev mailing list
    >>> [email protected] <mailto:[email protected]>
    >>> https://mail.mozilla.org/listinfo/rust-dev
    >>>
    >>
    >
    >
    >
    > --
    > Ricardo Brandão
    > http://www.programonauta.com.br
    >
    > ........__@
    > ....._  \ >_
    > ....(_) /  (_)
    >
    > _______________________________________________
    > Rust-dev mailing list
    > [email protected] <mailto:[email protected]>
    > https://mail.mozilla.org/listinfo/rust-dev
    >




--
Ricardo Brandão
http://www.programonauta.com.br

........__@
....._  \ >_
....(_) /  (_)


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

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

Reply via email to