Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom Tromey <tom@tromey.com>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tom@tromey.com>
Subject: [PATCH 8/8] Add Rust documentation
Date: Wed, 27 Apr 2016 02:50:00 -0000	[thread overview]
Message-ID: <1461725371-17620-9-git-send-email-tom@tromey.com> (raw)
In-Reply-To: <1461725371-17620-1-git-send-email-tom@tromey.com>

This patch adds documentation for the new Rust support in gdb.

2016-04-26  Tom Tromey  <tom@tromey.com>

	* NEWS: Add Rust item.

2016-04-26  Tom Tromey  <tom@tromey.com>

	* gdb.texinfo (Supported Languages): Mention Rust.  Update menu.
	(Rust): New node.
---
 gdb/ChangeLog       |  4 +++
 gdb/NEWS            |  5 +++
 gdb/doc/ChangeLog   |  5 +++
 gdb/doc/gdb.texinfo | 96 ++++++++++++++++++++++++++++++++++++++++++++++++++++-
 4 files changed, 109 insertions(+), 1 deletion(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index bd19a64..3307b61 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,4 +1,8 @@
 2016-04-26  Tom Tromey  <tom@tromey.com>
+
+	* NEWS: Add Rust item.
+
+2016-04-26  Tom Tromey  <tom@tromey.com>
 	    Manish Goregaokar <manishsmail@gmail.com>
 
 	* symtab.c (symbol_find_demangled_name): Handle Rust.
diff --git a/gdb/NEWS b/gdb/NEWS
index 7bf1e1a..5d31378 100644
--- a/gdb/NEWS
+++ b/gdb/NEWS
@@ -27,6 +27,11 @@
    Bounds: [lower = 0x7fffffffc390, upper = 0x7fffffffc3a3]
    0x0000000000400d7c in upper () at i386-mpx-sigsegv.c:68
 
+* Rust language support.
+  GDB now supports debugging programs written in the Rust programming
+  language.  See https://www.rust-lang.org/ for more information about
+  Rust.
+
 * New commands
 
 skip -file file
diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog
index 748a8e2..1803d3e 100644
--- a/gdb/doc/ChangeLog
+++ b/gdb/doc/ChangeLog
@@ -1,5 +1,10 @@
 2016-04-26  Tom Tromey  <tom@tromey.com>
 
+	* gdb.texinfo (Supported Languages): Mention Rust.  Update menu.
+	(Rust): New node.
+
+2016-04-26  Tom Tromey  <tom@tromey.com>
+
 	* gdb.texinfo (Maintenance Commands): Document "maint selftest".
 
 2016-04-13  Antoine Tremblay  <antoine.tremblay@ericsson.com>
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index f42c5f0..8c31c43 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -14398,7 +14398,7 @@ being set automatically by @value{GDBN}.
 @section Supported Languages
 
 @value{GDBN} supports C, C@t{++}, D, Go, Objective-C, Fortran, Java,
-OpenCL C, Pascal, assembly, Modula-2, and Ada.
+OpenCL C, Pascal, Rust, assembly, Modula-2, and Ada.
 @c This is false ...
 Some @value{GDBN} features may be used in expressions regardless of the
 language you use: the @value{GDBN} @code{@@} and @code{::} operators,
@@ -14422,6 +14422,7 @@ language reference or tutorial.
 * OpenCL C::                    OpenCL C
 * Fortran::                     Fortran
 * Pascal::                      Pascal
+* Rust::                        Rust
 * Modula-2::                    Modula-2
 * Ada::                         Ada
 @end menu
@@ -15227,6 +15228,99 @@ The Pascal-specific command @code{set print pascal_static-members}
 controls whether static members of Pascal objects are displayed.
 @xref{Print Settings, pascal_static-members}.
 
+@node Rust
+@subsection Rust
+
+@value{GDBN} supports the @url{https://www.rust-lang.org/, 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.
+
+@itemize @bullet
+@item
+Linespecs 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} behaves.
+
+That is, if @value{GDBN} is stopped at a breakpoint in a function in
+crate @samp{A}, module @samp{B}, then @code{break B::f} will attempt
+to set a breakpoint in a function named @samp{f} in a crate named
+@samp{B}.
+
+As a consequence of this approach, linespecs also cannot refer to
+items using @samp{self::} or @samp{super::}.
+
+@item
+Because @value{GDBN} implements Rust name-lookup semantics in
+expressions, it will sometimes prepend the current crate to a name.
+For example, if @value{GDBN} is stopped at a breakpoint in the crate
+@samp{K}, then @code{print ::x::y} will try to find the symbol
+@samp{K::x::y}.
+
+However, since it is useful to be able to refer to other crates when
+debugging, @value{GDBN} provides the @code{extern} extension to
+circumvent this.  To use the extension, just put @code{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 @samp{y} in
+the crate @samp{x}, you would use @code{print extern x::y}.
+
+@item
+The Rust expression evaluator does not support ``statement-like''
+expressions such as @code{if} or @code{match}, or lambda expressions.
+
+@item
+Tuple expressions are not implemented.
+
+@item
+The Rust expression evaluator does not currently implement the
+@code{Drop} trait.  Objects that may be created by the evaluator will
+never be destroyed.
+
+@item
+@value{GDBN} does not implment 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.
+
+@item
+@value{GDBN} currently uses the C@t{++} 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{::}
+operator between the function name and its generic arguments.  For
+example, @value{GDBN} might provide a completion like
+@code{crate::f<u32>}, where the parser would require
+@code{crate::f::<u32>}.
+
+@item
+As of this writing, the Rust compiler has a few holes in the debugging
+information it generates.  These holes prevent certain features from
+being implemented by @value{GDBN}:
+@itemize @bullet
+
+@item
+Method calls cannot be made via traits.
+
+@item
+Trait objects cannot be created or inspected.
+
+@item
+Operator overloading is not implemented.
+
+@item
+When debugging in a monomorphized function, you cannot use the generic
+type names.
+
+@item
+The type @code{Self} is not available.
+
+@item
+@code{use} statements are not available, so some names may not be
+available in the crate.
+@end itemize
+@end itemize
+
 @node Modula-2
 @subsection Modula-2
 
-- 
2.5.5


  parent reply	other threads:[~2016-04-27  2:50 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-27  2:50 [PATCH 0/8] Add Rust language support Tom Tromey
2016-04-27  2:50 ` [PATCH 1/8] Add DW_LANG_Rust and DW_LANG_Rust_old Tom Tromey
2016-04-27 11:44   ` Pedro Alves
2016-04-27  2:50 ` [PATCH 7/8] Update gdb test suite for Rust Tom Tromey
2016-04-27 11:44   ` Pedro Alves
2016-04-27  2:50 ` [PATCH 4/8] Add self-test framework to gdb Tom Tromey
2016-04-27 11:40   ` Pedro Alves
2016-04-27 17:58     ` Tom Tromey
2016-04-27  2:50 ` [PATCH 5/8] Add array start and end strings to generic_val_print_decorations Tom Tromey
2016-04-27 11:40   ` Pedro Alves
2016-04-27  2:50 ` [PATCH 3/8] Make gdb expression debugging handle OP_F90_RANGE Tom Tromey
2016-04-27 11:38   ` Pedro Alves
2016-04-27  2:50 ` [PATCH 6/8] Add support for the Rust language Tom Tromey
2016-04-27 11:43   ` Pedro Alves
2016-04-27 11:49     ` Pedro Alves
2016-04-27 18:27     ` Tom Tromey
2016-04-27 18:36       ` Pedro Alves
2016-04-27 19:52       ` Tom Tromey
2016-04-27  2:50 ` [PATCH 2/8] Fix latent yacc-related bug in gdb/Makefile.in init.c rule Tom Tromey
2016-04-27 11:38   ` Pedro Alves
2016-04-27  2:50 ` Tom Tromey [this message]
2016-04-27  7:10   ` [PATCH 8/8] Add Rust documentation Eli Zaretskii
2016-04-27 11:47 ` [PATCH 0/8] Add Rust language support Pedro Alves
2016-04-27 16:22   ` Tom Tromey
2016-04-27 18:23     ` Pedro Alves
2016-04-27 21:56   ` Pedro Alves

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1461725371-17620-9-git-send-email-tom@tromey.com \
    --to=tom@tromey.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox