diff options
Diffstat (limited to 'share/doc/gdb/Rust.html')
-rw-r--r-- | share/doc/gdb/Rust.html | 155 |
1 files changed, 155 insertions, 0 deletions
diff --git a/share/doc/gdb/Rust.html b/share/doc/gdb/Rust.html new file mode 100644 index 0000000..070e976 --- /dev/null +++ b/share/doc/gdb/Rust.html @@ -0,0 +1,155 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> +<html> +<!-- Copyright (C) 1988-2023 Free Software Foundation, Inc. + +Permission is granted to copy, distribute and/or modify this document +under the terms of the GNU Free Documentation License, Version 1.3 or +any later version published by the Free Software Foundation; with the +Invariant Sections being "Free Software" and "Free Software Needs +Free Documentation", with the Front-Cover Texts being "A GNU Manual," +and with the Back-Cover Texts as in (a) below. + +(a) The FSF's Back-Cover Text is: "You are free to copy and modify +this GNU Manual. Buying copies from GNU Press supports the FSF in +developing GNU and promoting software freedom." --> +<!-- Created by GNU Texinfo 5.1, http://www.gnu.org/software/texinfo/ --> +<head> +<title>Debugging with GDB: Rust</title> + +<meta name="description" content="Debugging with GDB: Rust"> +<meta name="keywords" content="Debugging with GDB: Rust"> +<meta name="resource-type" content="document"> +<meta name="distribution" content="global"> +<meta name="Generator" content="makeinfo"> +<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> +<link href="index.html#Top" rel="start" title="Top"> +<link href="Concept-Index.html#Concept-Index" rel="index" title="Concept Index"> +<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents"> +<link href="Supported-Languages.html#Supported-Languages" rel="up" title="Supported Languages"> +<link href="Modula_002d2.html#Modula_002d2" rel="next" title="Modula-2"> +<link href="Pascal.html#Pascal" rel="previous" title="Pascal"> +<style type="text/css"> +<!-- +a.summary-letter {text-decoration: none} +blockquote.smallquotation {font-size: smaller} +div.display {margin-left: 3.2em} +div.example {margin-left: 3.2em} +div.indentedblock {margin-left: 3.2em} +div.lisp {margin-left: 3.2em} +div.smalldisplay {margin-left: 3.2em} +div.smallexample {margin-left: 3.2em} +div.smallindentedblock {margin-left: 3.2em; font-size: smaller} +div.smalllisp {margin-left: 3.2em} +kbd {font-style:oblique} +pre.display {font-family: inherit} +pre.format {font-family: inherit} +pre.menu-comment {font-family: serif} +pre.menu-preformatted {font-family: serif} +pre.smalldisplay {font-family: inherit; font-size: smaller} +pre.smallexample {font-size: smaller} +pre.smallformat {font-family: inherit; font-size: smaller} +pre.smalllisp {font-size: smaller} +span.nocodebreak {white-space:nowrap} +span.nolinebreak {white-space:nowrap} +span.roman {font-family:serif; font-weight:normal} +span.sansserif {font-family:sans-serif; font-weight:normal} +ul.no-bullet {list-style: none} +--> +</style> + + +</head> + +<body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000"> +<a name="Rust"></a> +<div class="header"> +<p> +Next: <a href="Modula_002d2.html#Modula_002d2" accesskey="n" rel="next">Modula-2</a>, Previous: <a href="Pascal.html#Pascal" accesskey="p" rel="previous">Pascal</a>, Up: <a href="Supported-Languages.html#Supported-Languages" accesskey="u" rel="up">Supported Languages</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html#Concept-Index" title="Index" rel="index">Index</a>]</p> +</div> +<hr> +<a name="Rust-1"></a> +<h4 class="subsection">15.4.8 Rust</h4> + +<p><small>GDB</small> supports the <a href="https://www.rust-lang.org/">Rust +Programming Language</a>. Type- and value-printing, and expression +parsing, are reasonably complete. However, there are a few +peculiarities and holes to be aware of. +</p> +<ul> +<li> Linespecs (see <a href="Location-Specifications.html#Location-Specifications">Location Specifications</a>) are never relative to the +current crate. Instead, they act as if there were a global namespace +of crates, somewhat similar to the way <code>extern crate</code> behaves. + +<p>That is, if <small>GDB</small> is stopped at a breakpoint in a function in +crate ‘<samp>A</samp>’, module ‘<samp>B</samp>’, then <code>break B::f</code> will attempt +to set a breakpoint in a function named ‘<samp>f</samp>’ in a crate named +‘<samp>B</samp>’. +</p> +<p>As a consequence of this approach, linespecs also cannot refer to +items using ‘<samp>self::</samp>’ or ‘<samp>super::</samp>’. +</p> +</li><li> Because <small>GDB</small> implements Rust name-lookup semantics in +expressions, it will sometimes prepend the current crate to a name. +For example, if <small>GDB</small> is stopped at a breakpoint in the crate +‘<samp>K</samp>’, then <code>print ::x::y</code> will try to find the symbol +‘<samp>K::x::y</samp>’. + +<p>However, since it is useful to be able to refer to other crates when +debugging, <small>GDB</small> provides the <code>extern</code> extension to +circumvent this. To use the extension, just put <code>extern</code> before +a path expression to refer to the otherwise unavailable “global” +scope. +</p> +<p>In the above example, if you wanted to refer to the symbol ‘<samp>y</samp>’ in +the crate ‘<samp>x</samp>’, you would use <code>print extern x::y</code>. +</p> +</li><li> The Rust expression evaluator does not support “statement-like” +expressions such as <code>if</code> or <code>match</code>, or lambda expressions. + +</li><li> Tuple expressions are not implemented. + +</li><li> The Rust expression evaluator does not currently implement the +<code>Drop</code> trait. Objects that may be created by the evaluator will +never be destroyed. + +</li><li> <small>GDB</small> 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. + +</li><li> <small>GDB</small> currently uses the C<tt>++</tt> demangler for Rust. In most +cases this does not cause any problems. However, in an expression +context, completing a generic function name will give syntactically +invalid results. This happens because Rust requires the ‘<samp>::</samp>’ +operator between the function name and its generic arguments. For +example, <small>GDB</small> might provide a completion like +<code>crate::f<u32></code>, where the parser would require +<code>crate::f::<u32></code>. + +</li><li> 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 <small>GDB</small>: +<ul> +<li> Method calls cannot be made via traits. + +</li><li> Operator overloading is not implemented. + +</li><li> When debugging in a monomorphized function, you cannot use the generic +type names. + +</li><li> The type <code>Self</code> is not available. + +</li><li> <code>use</code> statements are not available, so some names may not be +available in the crate. +</li></ul> +</li></ul> + +<hr> +<div class="header"> +<p> +Next: <a href="Modula_002d2.html#Modula_002d2" accesskey="n" rel="next">Modula-2</a>, Previous: <a href="Pascal.html#Pascal" accesskey="p" rel="previous">Pascal</a>, Up: <a href="Supported-Languages.html#Supported-Languages" accesskey="u" rel="up">Supported Languages</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html#Concept-Index" title="Index" rel="index">Index</a>]</p> +</div> + + + +</body> +</html> |