]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Document linespec/explicit locations & completion improvements (manual + NEWS)
authorPedro Alves <palves@redhat.com>
Fri, 24 Nov 2017 15:21:16 +0000 (15:21 +0000)
committerPedro Alves <palves@redhat.com>
Fri, 24 Nov 2017 15:21:16 +0000 (15:21 +0000)
gdb/ChangeLog:
2017-11-24  Pedro Alves  <palves@redhat.com>

* NEWS: Mention linespecs and explicit locations, and completion
improvements.

gdb/doc/ChangeLog:
2017-11-24  Pedro Alves  <palves@redhat.com>

* gdb.texinfo (Completion): Update need-quoting examples.  Remove
false claim that GDB inserts quoting automatically.
(Symbols): Add anchor.

gdb/ChangeLog
gdb/NEWS
gdb/doc/ChangeLog
gdb/doc/gdb.texinfo

index bec84337099a2fe94cdd31699b48b795bed1b3fd..e6762bb92daec4dd3943260ae419315621c8791e 100644 (file)
@@ -1,3 +1,8 @@
+2017-11-24  Pedro Alves  <palves@redhat.com>
+
+       * NEWS: Mention linespecs and explicit locations, and completion
+       improvements.
+
 2017-11-24  Yao Qi  <yao.qi@linaro.org>
 
        * regcache.c (regcache::dump): Remove footnote_register_size.
index a239624b827fa7d3ef7fb992c72d88d89ba6237c..b2c96eef416dd415e0c5a5418fa5555d759a0f94 100644 (file)
--- a/gdb/NEWS
+++ b/gdb/NEWS
   the remote inferior is started by the GDBserver, use the "unset
   environment" command.
 
+* Completion improvements
+
+  ** GDB can now complete function parameters in linespecs and
+     explicit locations without quoting.  When setting breakpoints,
+     quoting around functions names to help with TAB-completion is
+     generally no longer necessary.  For example, this now completes
+     correctly:
+
+      (gdb) b function(in[TAB]
+      (gdb) b function(int)
+
+     Related, GDB is no longer confused with completing functions in
+     C++ anonymous namespaces:
+
+      (gdb) b (anon[TAB]
+      (gdb) b (anonymous namespace)::[TAB][TAB]
+      (anonymous namespace)::a_function()
+      (anonymous namespace)::b_function()
+
+  ** GDB now has much improved linespec and explicit locations TAB
+     completion support, that better understands what you're
+     completing and offers better suggestions.  For example, GDB no
+     longer offers data symbols as possible completions when you're
+     setting a breakpoint.
+
+  ** GDB now TAB-completes label symbol names.
+
+  ** The "complete" command now mimics TAB completion accurately.
+
 * Python Scripting
 
   ** New events gdb.new_inferior, gdb.inferior_deleted, and
index 81af3aa632fecb03022b8136d2da38443c8a8648..62c63f1785e0455b7f6097032e885dc118f3c0ce 100644 (file)
@@ -1,3 +1,9 @@
+2017-11-24  Pedro Alves  <palves@redhat.com>
+
+       * gdb.texinfo (Completion): Update need-quoting examples.  Remove
+       false claim that GDB inserts quoting automatically.
+       (Symbols): Add anchor.
+
 2017-11-22  Ulrich Weigand  <uweigand@de.ibm.com>
 
        * gdb.texinfo (Requirements): Document use of GNU MPFR.
index ab05a3718d6e3596f2844392f0eae0dc608ba4ab..afaafc0c49ff89b23c60fa568c632c15b48917e6 100644 (file)
@@ -1638,39 +1638,56 @@ its notion of a word.  To permit word completion to work in this
 situation, you may enclose words in @code{'} (single quote marks) in
 @value{GDBN} commands.
 
-The most likely situation where you might need this is in typing the
-name of a C@t{++} function.  This is because C@t{++} allows function
-overloading (multiple definitions of the same function, distinguished
-by argument type).  For example, when you want to set a breakpoint you
-may need to distinguish whether you mean the version of @code{name}
-that takes an @code{int} parameter, @code{name(int)}, or the version
-that takes a @code{float} parameter, @code{name(float)}.  To use the
-word-completion facilities in this situation, type a single quote
+A likely situation where you might need this is in typing an
+expression that involves a C@t{++} symbol name with template
+parameters.  This is because when completing expressions, GDB treats
+the @samp{<} character as word delimiter, assuming that it's the
+less-than comparison operator (@pxref{C Operators, , C and C@t{++}
+Operators}).
+
+For example, when you want to call a C@t{++} template function
+interactively using the @code{print} or @code{call} commands, you may
+need to distinguish whether you mean the version of @code{name} that
+was specialized for @code{int}, @code{name<int>()}, or the version
+that was specialized for @code{float}, @code{name<float>()}.  To use
+the word-completion facilities in this situation, type a single quote
 @code{'} at the beginning of the function name.  This alerts
 @value{GDBN} that it may need to consider more information than usual
 when you press @key{TAB} or @kbd{M-?} to request word completion:
 
 @smallexample
-(@value{GDBP}) b 'bubble( @kbd{M-?}
-bubble(double,double)    bubble(int,int)
-(@value{GDBP}) b 'bubble(
+(@value{GDBP}) p 'func< @kbd{M-?}
+func<int>()    func<float>()
+(@value{GDBP}) p 'func<
 @end smallexample
 
-In some cases, @value{GDBN} can tell that completing a name requires using
-quotes.  When this happens, @value{GDBN} inserts the quote for you (while
-completing as much as it can) if you do not type the quote in the first
-place:
+When setting breakpoints however (@pxref{Specify Location}), you don't
+usually need to type a quote before the function name, because
+@value{GDBN} understands that you want to set a breakpoint on a
+function:
 
 @smallexample
-(@value{GDBP}) b bub @key{TAB}
-@exdent @value{GDBN} alters your input line to the following, and rings a bell:
-(@value{GDBP}) b 'bubble(
+(@value{GDBP}) b func< @kbd{M-?}
+func<int>()    func<float>()
+(@value{GDBP}) b func<
 @end smallexample
 
-@noindent
-In general, @value{GDBN} can tell that a quote is needed (and inserts it) if
-you have not yet started typing the argument list when you ask for
-completion on an overloaded symbol.
+This is true even in the case of typing the name of C@t{++} overloaded
+functions (multiple definitions of the same function, distinguished by
+argument type).  For example, when you want to set a breakpoint you
+don't need to distinguish whether you mean the version of @code{name}
+that takes an @code{int} parameter, @code{name(int)}, or the version
+that takes a @code{float} parameter, @code{name(float)}.
+
+@smallexample
+(@value{GDBP}) b bubble( @kbd{M-?}
+bubble(int)    bubble(double)
+(@value{GDBP}) b bubble(dou @kbd{M-?}
+bubble(double)
+@end smallexample
+
+See @ref{quoting names} for a description of other scenarios that
+require quoting.
 
 For more information about overloaded functions, see @ref{C Plus Plus
 Expressions, ,C@t{++} Expressions}.  You can use the command @code{set
@@ -16890,6 +16907,7 @@ file-management commands (@pxref{Files, ,Commands to Specify Files}).
 @cindex symbol names
 @cindex names of symbols
 @cindex quoting names
+@anchor{quoting names}
 Occasionally, you may need to refer to symbols that contain unusual
 characters, which @value{GDBN} ordinarily treats as word delimiters.  The
 most frequent case is in referring to static variables in other