public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "sergiodj at redhat dot com" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug python/16699] New: GDB Python command completion with overriden complete vs. completer class
Date: Wed, 12 Mar 2014 19:52:00 -0000	[thread overview]
Message-ID: <bug-16699-4717@http.sourceware.org/bugzilla/> (raw)

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

            Bug ID: 16699
           Summary: GDB Python command completion with overriden complete
                    vs. completer class
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: python
          Assignee: sergiodj at redhat dot com
          Reporter: sergiodj at redhat dot com

This bug is a clone of a Red Hat bug.

create a file completion.py and add the below lines:

---------------------------------------
class MyFirstCommand(gdb.Command):
    def __init__(self):
       
gdb.Command.__init__(self,'myfirstcommand',gdb.COMMAND_USER,gdb.COMPLETE_FILENAME)

    def invoke(self,argument,from_tty):
        raise gdb.GdbError('not implemented')

class MySecondCommand(gdb.Command):
    def __init__(self):
        gdb.Command.__init__(self,'mysecondcommand',gdb.COMMAND_USER)

    def invoke(self,argument,from_tty):
        raise gdb.GdbError('not implemented')

    def complete(self,text,word):
        return gdb.COMPLETE_FILENAME

MyFirstCommand ()
MySecondCommand ()
--------------------------------------------------
>gdb

(gdb) source completion.py 
(gdb) mysecondcommand /home      <- that is the issue  
(gdb) myfirstcommand /home/
fotis/      lost+found/ 


Actual results:

(gdb) myfirstcommand /h<TAB>
it completes to /home/ and offers files within that directory

However for:
(gdb) mysecondcommand /h<TAB>
it completes to /home<SPACE> 

My command doesn't take directories, so I really want completion to work as for
the first command.

Is this expected GDB behavior? How do I make it work?

Expected results:

(gdb) mysecondcommand /home/
fotis       lost+found

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


             reply	other threads:[~2014-03-12 19:52 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-12 19:52 sergiodj at redhat dot com [this message]
2014-03-12 19:53 ` [Bug python/16699] " sergiodj at redhat dot com
2014-03-13  2:10 ` sergiodj at redhat dot com
2014-05-05 20:09 ` jan.kratochvil at redhat dot com
2014-09-03 20:35 ` cvs-commit at gcc dot gnu.org
2014-09-03 20:37 ` sergiodj at redhat dot com
2015-04-08 22:29 ` cvs-commit at gcc dot gnu.org

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=bug-16699-4717@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=gdb-prs@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).