public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug cli/16265] New: difference between TAB completion and "complete" command
@ 2013-11-27 16:27 tromey at redhat dot com
  2014-02-20 10:13 ` [Bug cli/16265] " gbenson at redhat dot com
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: tromey at redhat dot com @ 2013-11-27 16:27 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=16265

            Bug ID: 16265
           Summary: difference between TAB completion and "complete"
                    command
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: cli
          Assignee: unassigned at sourceware dot org
          Reporter: tromey at redhat dot com

Make a unique directory, e.g.:

mkdir /tmp/zzzzzzzzzzzz

Now in gdb:

(gdb) cd /tmp/zz<TAB>

I see:

(gdb) cd /tmp/zzzzzzzzzzzz/

Note the trailing "/".

Now try the complete command:

(gdb) complete cd /tmp/zz
cd /tmp/zzzzzzzzzzzz

Note the lack of the trailing "/".

This difference makes completion in Emacs harder to use.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug cli/16265] difference between TAB completion and "complete" command
  2013-11-27 16:27 [Bug cli/16265] New: difference between TAB completion and "complete" command tromey at redhat dot com
@ 2014-02-20 10:13 ` gbenson at redhat dot com
  2014-02-26  2:48 ` sergiodj at redhat dot com
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: gbenson at redhat dot com @ 2014-02-20 10:13 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=16265

Gary Benson <gbenson at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |gbenson at redhat dot com

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug cli/16265] difference between TAB completion and "complete" command
  2013-11-27 16:27 [Bug cli/16265] New: difference between TAB completion and "complete" command tromey at redhat dot com
  2014-02-20 10:13 ` [Bug cli/16265] " gbenson at redhat dot com
@ 2014-02-26  2:48 ` sergiodj at redhat dot com
  2014-04-25  9:01 ` manu at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: sergiodj at redhat dot com @ 2014-02-26  2:48 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=16265

Sergio Durigan Junior <sergiodj at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |sergiodj at redhat dot com

--- Comment #1 from Sergio Durigan Junior <sergiodj at redhat dot com> ---
Somewhat related discussion:

https://sourceware.org/ml/gdb-patches/2013-05/msg00567.html

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug cli/16265] difference between TAB completion and "complete" command
  2013-11-27 16:27 [Bug cli/16265] New: difference between TAB completion and "complete" command tromey at redhat dot com
  2014-02-20 10:13 ` [Bug cli/16265] " gbenson at redhat dot com
  2014-02-26  2:48 ` sergiodj at redhat dot com
@ 2014-04-25  9:01 ` manu at gcc dot gnu.org
  2024-01-12 11:04 ` cvs-commit at gcc dot gnu.org
  2024-01-12 11:05 ` aburgess at redhat dot com
  4 siblings, 0 replies; 6+ messages in thread
From: manu at gcc dot gnu.org @ 2014-04-25  9:01 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=16265

Manuel López-Ibáñez <manu at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |manu at gcc dot gnu.org

--- Comment #2 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
http://stackoverflow.com/questions/12361142/emacs-gdb-tab-completes-directory-with-space-instead-of

Tom, any clue where I can look in the code for fixing this? The behavior is
annoying enough that I would consider fixing it myself.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
>From gdb-prs-return-15620-listarch-gdb-prs=sources.redhat.com@sourceware.org Fri Apr 25 09:06:22 2014
Return-Path: <gdb-prs-return-15620-listarch-gdb-prs=sources.redhat.com@sourceware.org>
Delivered-To: listarch-gdb-prs@sources.redhat.com
Received: (qmail 15743 invoked by alias); 25 Apr 2014 09:06:22 -0000
Mailing-List: contact gdb-prs-help@sourceware.org; run by ezmlm
Precedence: bulk
List-Id: <gdb-prs.sourceware.org>
List-Subscribe: <mailto:gdb-prs-subscribe@sourceware.org>
List-Archive: <http://sourceware.org/ml/gdb-prs/>
List-Post: <mailto:gdb-prs@sourceware.org>
List-Help: <mailto:gdb-prs-help@sourceware.org>, <http://sourceware.org/lists.html#faqs>
Sender: gdb-prs-owner@sourceware.org
Delivered-To: mailing list gdb-prs@sourceware.org
Received: (qmail 15711 invoked by uid 48); 25 Apr 2014 09:06:21 -0000
From: "rguenth at gcc dot gnu.org" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug c++/16874] Can't break on function in anonymous namespace
Date: Fri, 25 Apr 2014 09:06:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gdb
X-Bugzilla-Component: c++
X-Bugzilla-Version: 7.7
X-Bugzilla-Keywords:
X-Bugzilla-Severity: critical
X-Bugzilla-Who: rguenth at gcc dot gnu.org
X-Bugzilla-Status: NEW
X-Bugzilla-Priority: P2
X-Bugzilla-Assigned-To: unassigned at sourceware dot org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields:
Message-ID: <bug-16874-4717-mHuOAaj8Lu@http.sourceware.org/bugzilla/>
In-Reply-To: <bug-16874-4717@http.sourceware.org/bugzilla/>
References: <bug-16874-4717@http.sourceware.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://sourceware.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2014-q2/txt/msg00126.txt.bz2
Content-length: 470

https://sourceware.org/bugzilla/show_bug.cgi?id\x16874

--- Comment #1 from Richard Guenther <rguenth at gcc dot gnu.org> ---
Err.

(gdb) b '(anonymous namespace)::foo'
Breakpoint 1 at 0x4005e1: file t.C, line 1.

this can't be really the desired way to do this ...

There is a DW_TAG_imported_module of the anon namespace in the TU context
so at least there referencing 'foo' needs to work.

--
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug cli/16265] difference between TAB completion and "complete" command
  2013-11-27 16:27 [Bug cli/16265] New: difference between TAB completion and "complete" command tromey at redhat dot com
                   ` (2 preceding siblings ...)
  2014-04-25  9:01 ` manu at gcc dot gnu.org
@ 2024-01-12 11:04 ` cvs-commit at gcc dot gnu.org
  2024-01-12 11:05 ` aburgess at redhat dot com
  4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-01-12 11:04 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=16265

--- Comment #3 from Sourceware Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Andrew Burgess <aburgess@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=3b9ff5d9009d587aa76ec7bbaab4439e26a52c50

commit 3b9ff5d9009d587aa76ec7bbaab4439e26a52c50
Author: Andrew Burgess <aburgess@redhat.com>
Date:   Tue Jan 2 17:08:30 2024 +0000

    gdb: add trailing '/' when using 'complete' with directory names

    This patch contains work pulled from this previously proposed patch:

     
https://inbox.sourceware.org/gdb-patches/20210213220752.32581-2-lsix@lancelotsix.com/

    But has been modified by me.  Credit for the original idea and
    implementation goes to Lancelot, any bugs in this new iteration belong
    to me.

    Consider the executable `/tmp/foo/my_exec', and if we assume `/tmp' is
    empty other than the `foo' sub-directory, then currently within GDB,
    if I type:

      (gdb) file /tmp/f

    and then hit TAB, GDB completes this to:

      (gdb) file /tmp/foo/

    notice that not only did GDB fill in the whole of `foo', but GDB also
    added a trailing '/' character.  This is done within readline when the
    path that was just completed is a directory.  However, if I instead
    do:

      (gdb) complete file /tmp/f
      file /tmp/foo

    I now see the completed directory name, but the trailing '/' is
    missing.  The reason is that, in this case, the completions are not
    offered via readline, but are handled entirely within GDB, and so
    readline never gets the chance to add the trailing '/' character.

    The above patch added filename option support to GDB, which included
    completion of the filename options.  This initially suffered from the
    same problem that I've outlined above, but the above patch proposed a
    solution to this problem, but this solution only applied to filename
    options (which have still not been added to GDB), and was mixed in
    with the complete filename options support.

    This patch pulls out just the fix for the trailing "/" problem, and
    applies it to GDB's general filename completion.  This patch does not
    add filename options to GDB, that can always be done later, but I
    think this small part is itself a useful fix.

    One of the biggest changes I made in this version is that I got rid of
    the set_from_readline member function, instead, I now pass the value
    of m_from_readline into the completion_tracker constructor.

    I then moved the addition of the trailing '/' into filename_completer
    so that it is applied in the general filename completion case.  I also
    added a call to gdb_tilde_expand which was missing from the original
    patch, I haven't tested, but I suspect that this meant that the
    original patch would not add the trailing '/' if the user entered a
    path starting with a tilde character.

    When writing the test for this patch I ran into two problems.

    The first was that the procedures in lib/completion-support.exp relied
    on the command being completed for the test name.  This is fine for
    many commands, but not when completing a filename, if we use the
    command in this case the test name will (potentially) include the name
    of the directory in which the test is being run, which means we can't
    compare results between two runs of GDB from different directories.

    So in this commit I've gone through completion-support.exp and added a
    new (optional) testname argument to many of the procedures, this
    allows me to give a unique test name, that doesn't include the path
    for my new tests.

    The second issue was in the procedure make_tab_completion_list_re,
    this builds the completion list which is displayed after a double tab
    when there are multiple possible completions.

    The procedure added the regexp ' +' after each completion, and then
    added another ' +' at the very end of the expected output.  So, if we
    expected to match the name of two functions 'f1' and 'f2' the
    generated regexp would be: 'f1 +f2 + +'.  This would match just fine,
    the actual output would be: 'f1  f2  ', notice that we get two spaces
    after each function name.

    However, if we complete two directory names 'd1' and 'd2' then the
    output will be 'd1/ d2/ '.  Notice that now we only have a single
    space between each match, however, we do get the '/' added instead.

    What happens is that when presenting the matches, readline always adds
    the appropriate trailing character; if we performed tab completion of
    'break f1' then, as 'f1' is a unique match, we'd get 'break f1 ' with
    a trailing space added.  However, if we complete 'file d1' then we get
    'file d1/'.  Then readline is adding a single space after each
    possible match, including the last one, which accounts for the
    trailing space character.

    To resolve this I've simply remove the addition o the second ' +'
    within make_tab_completion_list_re, for the function completion
    example I gave above the expected pattern is now 'f1 +f2 +', which for
    the directory case we expect 'd1/ +d2/ +', both of which work just
    fine.

    Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=16265
    Co-Authored-By: Lancelot SIX <lsix@lancelotsix.com>
    Approved-By: Tom Tromey <tom@tromey.com>
    Reviewed-By: John Baldwin <jhb@FreeBSD.org>

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug cli/16265] difference between TAB completion and "complete" command
  2013-11-27 16:27 [Bug cli/16265] New: difference between TAB completion and "complete" command tromey at redhat dot com
                   ` (3 preceding siblings ...)
  2024-01-12 11:04 ` cvs-commit at gcc dot gnu.org
@ 2024-01-12 11:05 ` aburgess at redhat dot com
  4 siblings, 0 replies; 6+ messages in thread
From: aburgess at redhat dot com @ 2024-01-12 11:05 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=16265

Andrew Burgess <aburgess at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
                 CC|                            |aburgess at redhat dot com
             Status|NEW                         |RESOLVED

--- Comment #4 from Andrew Burgess <aburgess at redhat dot com> ---
Should now be fixed.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2024-01-12 11:05 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-11-27 16:27 [Bug cli/16265] New: difference between TAB completion and "complete" command tromey at redhat dot com
2014-02-20 10:13 ` [Bug cli/16265] " gbenson at redhat dot com
2014-02-26  2:48 ` sergiodj at redhat dot com
2014-04-25  9:01 ` manu at gcc dot gnu.org
2024-01-12 11:04 ` cvs-commit at gcc dot gnu.org
2024-01-12 11:05 ` aburgess at redhat dot com

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).