You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
155 lines
7.1 KiB
HTML
155 lines
7.1 KiB
HTML
4 years ago
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||
|
<html>
|
||
|
<!-- Copyright (C) 1988-2019 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 6.4, http://www.gnu.org/software/texinfo/ -->
|
||
|
<head>
|
||
|
<title>Rust (Debugging with GDB)</title>
|
||
|
|
||
|
<meta name="description" content="Rust (Debugging with GDB)">
|
||
|
<meta name="keywords" content="Rust (Debugging with GDB)">
|
||
|
<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="prev" title="Pascal">
|
||
|
<style type="text/css">
|
||
|
<!--
|
||
|
a.summary-letter {text-decoration: none}
|
||
|
blockquote.indentedblock {margin-right: 0em}
|
||
|
blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
|
||
|
blockquote.smallquotation {font-size: smaller}
|
||
|
div.display {margin-left: 3.2em}
|
||
|
div.example {margin-left: 3.2em}
|
||
|
div.lisp {margin-left: 3.2em}
|
||
|
div.smalldisplay {margin-left: 3.2em}
|
||
|
div.smallexample {margin-left: 3.2em}
|
||
|
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.nolinebreak {white-space: nowrap}
|
||
|
span.roman {font-family: initial; font-weight: normal}
|
||
|
span.sansserif {font-family: sans-serif; font-weight: normal}
|
||
|
ul.no-bullet {list-style: none}
|
||
|
-->
|
||
|
</style>
|
||
|
|
||
|
|
||
|
</head>
|
||
|
|
||
|
<body lang="en">
|
||
|
<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="prev">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="Specify-Location.html#Specify-Location">Specify Location</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="prev">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>
|