[rust-dev] Debugging (rust 0.9) in Ubuntu via GDB

Thad Guidry thadguidry at gmail.com
Mon Jan 13 09:30:20 PST 2014


Eclipse also has a GDB plugin to assist with debugging.

http://wiki.eclipse.org/Linux_Tools_Project/GDB/User_Guide


On Mon, Jan 13, 2014 at 5:52 AM, John Mija <jon.mb at proinbox.com> wrote:

> There is a web front-end for gdb to debug applications in Go, C and C++.
> I'm supposed that it also could be used to debug Rust apps.
>
> https://github.com/sirnewton01/godbg
>
> El 13/01/14 07:42, Michael Woerister escribió:
>
>> Hi,
>> the `break` command can be a bit particular where function names are
>> concerned, especially when namespaces and generics are involved. The
>> correct full name of the shuffle method would be something like
>> `std::rand::TaskRng::shuffle<int>` (there is a seperate function for
>> every set of concrete type parameters, so `shuffle<int>` would be
>> different from `shuffle<f32>`).
>>
>> My recommendation here is to either
>> * set the breakpoint using line numbers: break prog.rs:7
>> * or use the `rbreak` command which takes a regular expression as
>> argument, that is, `rbreak shuffle` will match any function containing
>> the string "shuffle" in its name.
>>
>> Don't be shy to ask further questions if you have any :)
>>
>> -Michael
>>
>> On 13.01.2014 00:13, Artella Coding wrote:
>>
>>> Suppose I have the following program :
>>>
>>> **********************************************
>>> //prog1.rs <http://prog1.rs>
>>>
>>> use std::rand::{task_rng, Rng};
>>> fn main() {
>>>     let names = ["Alice", "Bob", "Carol"];
>>>     for name in names.iter() {
>>>         let v = task_rng().shuffle(~[1,2,3]);
>>>         for num in v.iter() {
>>>             println!("{:s} says: {:d}", *name, *num);
>>>         }
>>>     }
>>> }
>>> **********************************************
>>>
>>> In previous versions of rust it was possible to put
>>> a breakpoint on "shuffle"  e.g.
>>>
>>> One would first compile via :
>>>
>>> rustc -Z debug-info prog1.rs <http://prog1.rs>
>>>
>>>
>>> and then one could proceed to put a breakpoint on "shuffle" :
>>>
>>> gdb ./prog1
>>> (gdb) break shuffle
>>> (gdb) run
>>>
>>> However now it doesn't seem possible to put a breakpoint on shuffle.
>>> Why is this? Thanks.
>>>
>>>
>>>
>>> _______________________________________________
>>> Rust-dev mailing list
>>> Rust-dev at mozilla.org
>>> https://mail.mozilla.org/listinfo/rust-dev
>>>
>>
>>
>>
>> _______________________________________________
>> Rust-dev mailing list
>> Rust-dev at mozilla.org
>> https://mail.mozilla.org/listinfo/rust-dev
>>
>>  _______________________________________________
> Rust-dev mailing list
> Rust-dev at mozilla.org
> https://mail.mozilla.org/listinfo/rust-dev
>



-- 
-Thad
+ThadGuidry <https://www.google.com/+ThadGuidry>
Thad on LinkedIn <http://www.linkedin.com/in/thadguidry/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/rust-dev/attachments/20140113/23111306/attachment.html>


More information about the Rust-dev mailing list