public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: "Maciej W. Rozycki" <macro@embecosm.com>
To: gdb-patches@sourceware.org
Subject: [PATCH] GDB/doc: Remove extraneous spaces from completion examples
Date: Fri, 1 Jul 2022 16:13:05 +0100 (BST)	[thread overview]
Message-ID: <alpine.DEB.2.20.2206302006560.10833@tpp.orcam.me.uk> (raw)

Completion results are usually different when the operation is applied 
to a word that is or is not followed by a space.  In some cases they are 
equivalent, however a space would not be produced if completion was used 
earlier on in the word processed.

However in the manual we have completion examples given using a space 
that actually prevents the example from working.  E.g.:

(gdb) info bre <TAB>

(nothing) and:

(gdb) info bre <TAB><TAB>
Display all 200 possibilities? (y or n)

as it now goes on to propose the entire symbol table, while:

(gdb) info bre<TAB>
(gdb) info breakpoints

does the right thing, but is not what is shown in the manual.

In other cases an extraneous space is used that does not correspond to 
the actual completion pattern shown, which gives an impression of 
sloppiness.

Remove extraneous spaces then from completion examples as appropriate.
---
Hi,

 Noticed while making documentation updates for "NUMBER" completion.

 OK to apply?

 Additionally we do have an issue with completion here.  For example when 
debugging `cc1' from GCC 12, which has a huge number of template class 
function symbols, e.g.:

hash_table<action_record_hasher, false, xcallocator>::expand()
hash_table<action_record_hasher, false, xcallocator>::find_slot_with_hash(action_record* const&, unsigned int, insert_option)
hash_table<action_record_hasher, false, xcallocator>::~hash_table()
hash_table<addr_hasher, false, xcallocator>::expand()
[1100+ entries follow]

if you try to complete such a symbol correctly, it seems to work as 
expected:

(gdb) break hash_tab<Tab>
(gdb) break hash_table<

However if you do it with a space inserted, then you get:

(gdb) break hash_tab <Tab>
(gdb) break hash_tab le<

which is already wrong.  And on one but not all of my systems if you try 
to complete again at this point:

(gdb) break hash_tab le<<Tab>
(gdb) break hash_tab le<warning: could not convert 'hash_tab le<' from the host encoding (ANSI_X3.4-1968) to UTF-32.
This normally should not happen, please file a bug report.

and then it hangs for a couple of minutes before silently returning to the 
prompt (i.e. it's not shown unless e.g. ^U is entered).

 The message comes from gdb/ada-lang.c, and it's not clear to me offhand 
why it's produced given that `cc1' contains no Ada code:

(gdb) show language
The current source language is "auto; currently c++".
(gdb)

 I have filed PR cli/29314 and PR cli/29315 respectively to track these 
issues.

  Maciej
---
 gdb/doc/gdb.texinfo |   12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

gdb-doc-completion-space-fix.diff
Index: src/gdb/doc/gdb.texinfo
===================================================================
--- src.orig/gdb/doc/gdb.texinfo
+++ src/gdb/doc/gdb.texinfo
@@ -1915,7 +1915,7 @@ enter it).  For example, if you type
 @c If texinfo enhancements make it unnecessary, it would be nice to
 @c replace " @key" by "@key" in the following...
 @smallexample
-(@value{GDBP}) info bre @key{TAB}
+(@value{GDBP}) info bre@key{TAB}
 @end smallexample
 
 @noindent
@@ -1945,7 +1945,7 @@ function names in your program that begi
 example:
 
 @smallexample
-(@value{GDBP}) b make_ @key{TAB}
+(@value{GDBP}) b make_@key{TAB}
 @exdent @value{GDBN} sounds bell; press @key{TAB} again, to see:
 make_a_section_from_file     make_environ
 make_abs_section             make_function_type
@@ -2039,7 +2039,7 @@ the word-completion facilities in this s
 when you press @key{TAB} or @kbd{M-?} to request word completion:
 
 @smallexample
-(@value{GDBP}) p 'func< @kbd{M-?}
+(@value{GDBP}) p 'func<@kbd{M-?}
 func<int>()    func<float>()
 (@value{GDBP}) p 'func<
 @end smallexample
@@ -2050,7 +2050,7 @@ usually need to type a quote before the
 function:
 
 @smallexample
-(@value{GDBP}) b func< @kbd{M-?}
+(@value{GDBP}) b func<@kbd{M-?}
 func<int>()    func<float>()
 (@value{GDBP}) b func<
 @end smallexample
@@ -2063,9 +2063,9 @@ that takes an @code{int} parameter, @cod
 that takes a @code{float} parameter, @code{name(float)}.
 
 @smallexample
-(@value{GDBP}) b bubble( @kbd{M-?}
+(@value{GDBP}) b bubble(@kbd{M-?}
 bubble(int)    bubble(double)
-(@value{GDBP}) b bubble(dou @kbd{M-?}
+(@value{GDBP}) b bubble(dou@kbd{M-?}
 bubble(double)
 @end smallexample
 

             reply	other threads:[~2022-07-01 15:13 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-01 15:13 Maciej W. Rozycki [this message]
2022-07-01 15:46 ` Eli Zaretskii
2022-07-01 16:13   ` Maciej W. Rozycki

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=alpine.DEB.2.20.2206302006560.10833@tpp.orcam.me.uk \
    --to=macro@embecosm.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).