15.4.8 Rust ¶
ROCgdb supports the Rust
Programming Language. Type- and value-printing, and expression
parsing, are reasonably complete. However, there are a few
peculiarities and holes to be aware of.
- Linespecs (see Location Specifications) are never relative to the
current crate. Instead, they act as if there were a global namespace
of crates, somewhat similar to the way
extern crate behaves.
That is, if ROCgdb is stopped at a breakpoint in a function in
crate ‘A’, module ‘B’, then break B::f will attempt
to set a breakpoint in a function named ‘f’ in a crate named
‘B’.
As a consequence of this approach, linespecs also cannot refer to
items using ‘self::’ or ‘super::’.
- Because ROCgdb implements Rust name-lookup semantics in
expressions, it will sometimes prepend the current crate to a name.
For example, if ROCgdb is stopped at a breakpoint in the crate
‘K’, then
print ::x::y will try to find the symbol
‘K::x::y’.
However, since it is useful to be able to refer to other crates when
debugging, ROCgdb provides the extern extension to
circumvent this. To use the extension, just put extern before
a path expression to refer to the otherwise unavailable “global”
scope.
In the above example, if you wanted to refer to the symbol ‘y’ in
the crate ‘x’, you would use print extern x::y.
- The Rust expression evaluator does not support “statement-like”
expressions such as
if or match, or lambda expressions.
- Tuple expressions are not implemented.
- The Rust expression evaluator does not currently implement the
Drop trait. Objects that may be created by the evaluator will
never be destroyed.
- ROCgdb does not implement type inference for generics. In order
to call generic functions or otherwise refer to generic items, you
will have to specify the type parameters manually.
- In an expression context, completing a generic function name will give
syntactically invalid results. This happens because Rust requires the
‘::’ operator between the function name and its generic
arguments. For example, ROCgdb might provide a completion like
crate::f<u32>, where the parser would require
crate::f::<u32>.
- As of this writing, the Rust compiler (version 1.8) has a few holes in
the debugging information it generates. These holes prevent certain
features from being implemented by ROCgdb:
- Method calls cannot be made via traits.
- Operator overloading is not implemented.
- When debugging in a monomorphized function, you cannot use the generic
type names.
- The type
Self is not available.
use statements are not available, so some names may not be
available in the crate.