public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug python/18494] New: Python gdb.Command#complete is provided with wrong parameters
@ 2015-06-05 14:30 arma2ff0 at gmail dot com
  2015-06-05 19:24 ` [Bug python/18494] " sergiodj at redhat dot com
  2015-06-06 12:41 ` arma2ff0 at gmail dot com
  0 siblings, 2 replies; 3+ messages in thread
From: arma2ff0 at gmail dot com @ 2015-06-05 14:30 UTC (permalink / raw)
  To: gdb-prs

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

            Bug ID: 18494
           Summary: Python gdb.Command#complete is provided with wrong
                    parameters
           Product: gdb
           Version: 7.9
            Status: NEW
          Severity: normal
          Priority: P2
         Component: python
          Assignee: unassigned at sourceware dot org
          Reporter: arma2ff0 at gmail dot com
  Target Milestone: ---

Created attachment 8344
  --> https://sourceware.org/bugzilla/attachment.cgi?id=8344&action=edit
Test to used to show the problem

While fixing my gdb-python scripts I noticed that the auto-completion I wrote
was not properly working anymore after the last system updates. After debugging
my code I noticed that the problem looks more like a bug.

Essentially, when extending gdb.Command one should be able to override
"complete" to provide custom completion. Based on documentation, "text holds
the complete command line up to the cursor's location, while word holds the
last word of the command line". In fact, previously "text" was holding the part
of the command that was defined as command in the constructor of the
self-defined constructor. Differently, "word" was holding the "parameters" of
the command. In gdb 7.9.1 this is reversed.

How to replicate the problem:
a) download "test.py" attached to this bug report
b) move test.py to /tmp
c) execute

   gdb -x /tmp/test.py
   (gdb) bug-test

d) start triggering auto completion by pressing tab

expected:
"text" should contain "bug-test", while "word" should contain an empty string
""

result:
the output is reversed compered to what expected.

I am not completely sure whether this is a bug, but since the behavior has
changed since 7.9 and the documentation has not changed, I am signaling it as a
bug.

Thanks && Cheers.
A.

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


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

* [Bug python/18494] Python gdb.Command#complete is provided with wrong parameters
  2015-06-05 14:30 [Bug python/18494] New: Python gdb.Command#complete is provided with wrong parameters arma2ff0 at gmail dot com
@ 2015-06-05 19:24 ` sergiodj at redhat dot com
  2015-06-06 12:41 ` arma2ff0 at gmail dot com
  1 sibling, 0 replies; 3+ messages in thread
From: sergiodj at redhat dot com @ 2015-06-05 19:24 UTC (permalink / raw)
  To: gdb-prs

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

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> ---
ISTR that this has always been the case, i.e., the parameters were reversed
since the beginning.  So you're saying that this *was* working before, then? 
Interesting.  This is indeed a bug that we were planning to fix eventually. 
Thanks for the report.

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


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

* [Bug python/18494] Python gdb.Command#complete is provided with wrong parameters
  2015-06-05 14:30 [Bug python/18494] New: Python gdb.Command#complete is provided with wrong parameters arma2ff0 at gmail dot com
  2015-06-05 19:24 ` [Bug python/18494] " sergiodj at redhat dot com
@ 2015-06-06 12:41 ` arma2ff0 at gmail dot com
  1 sibling, 0 replies; 3+ messages in thread
From: arma2ff0 at gmail dot com @ 2015-06-06 12:41 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #2 from Armando <arma2ff0 at gmail dot com> ---
Hi Sergio.

thank you for your reply.

After reading your reply I got doubts about whether I remembered the behavior
of the previous version of GDB correctly. However I was pretty sure that the
variable "word" was containing the content I was expecting.

Luckily, I did not clean pacman's cache so I was able to down-grade gdb to
7.8.2 to test the behavior of that version. To me, it looks that this version's
behavior is in-line with what is described in the documentation.

Test:

  $ gdb --version
  GNU gdb (GDB) 7.8.2
  [..]

  $ gdb -x /tmp/test.py
  (gdb) bug-test text: ''; word ''
  text: ''; word '' 
  text: ''; word ''

  (gdb) bug-test abc deftext: 'abc def'; word 'def'
  text: 'abc def'; word 'def'
  text: 'abc def'; word 'def'
  text: 'abc def'; word 'def'

as the cursor is at the end of "def" while the rest of the argument is in text,
this looks like the correct behavior.

Do you agree?

Still, my expectations were clearly wrong, as I was expecting text to contain
the whole command, while word to contain the arguments. Anyway, I currently not
100% sure what the correct behavior should be, but clearly it changed between
7.8 and 7.9 :)

Thanks.
A.

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


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

end of thread, other threads:[~2015-06-06 12:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-05 14:30 [Bug python/18494] New: Python gdb.Command#complete is provided with wrong parameters arma2ff0 at gmail dot com
2015-06-05 19:24 ` [Bug python/18494] " sergiodj at redhat dot com
2015-06-06 12:41 ` arma2ff0 at gmail 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).