* [RFA] Completion of add-inferior
@ 2012-05-11 17:51 Eli Zaretskii
2012-05-11 20:21 ` Tom Tromey
0 siblings, 1 reply; 5+ messages in thread
From: Eli Zaretskii @ 2012-05-11 17:51 UTC (permalink / raw)
To: gdb-patches
I'm a completion junkie, so this pisses me off:
(gdb) add-inferior -exec oo/i TAB
Display all 355 possibilities? (y or n) n
(gdb) add-inferior -exec TAB
Display all 25806 possibilities? (y or n) n
(gdb) add-inferior -exec d:/gnu TAB TAB
gnutls_alert_description_t
gnutls_alloc_function
gnutls_anon_client_credentials_t
gnutls_certificate_client_credentials
...
(it completes on symbols).
OK to commit the following?
2012-05-11 Eli Zaretskii <eliz@gnu.org>
* inferior.c: Include completer.h
(initialize_inferiors): Set completer of add-inferior to
filename_completer.
--- gdb/inferior.c~0 2012-01-06 06:43:16.000000000 +0200
+++ gdb/inferior.c 2012-05-11 20:44:23.218048400 +0300
@@ -22,6 +22,7 @@
#include "inferior.h"
#include "target.h"
#include "command.h"
+#include "completer.h"
#include "gdbcmd.h"
#include "gdbthread.h"
#include "ui-out.h"
@@ -1065,6 +1066,8 @@ inferior_data (struct inferior *inf, con
void
initialize_inferiors (void)
{
+ struct cmd_list_element *c = NULL;
+
/* There's always one inferior. Note that this function isn't an
automatic _initialize_foo function, since other _initialize_foo
routines may need to install their per-inferior data keys. We
@@ -1078,12 +1081,13 @@ initialize_inferiors (void)
add_info ("inferiors", info_inferiors_command,
_("IDs of specified inferiors (all inferiors if no argument)."));
- add_com ("add-inferior", no_class, add_inferior_command, _("\
+ c = add_com ("add-inferior", no_class, add_inferior_command, _("\
Add a new inferior.\n\
Usage: add-inferior [-copies <N>] [-exec <FILENAME>]\n\
N is the optional number of inferiors to add, default is 1.\n\
FILENAME is the file name of the executable to use\n\
as main program."));
+ set_cmd_completer (c, filename_completer);
add_com ("remove-inferiors", no_class, remove_inferior_command, _("\
Remove inferior ID (or list of IDs).\n\
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [RFA] Completion of add-inferior
2012-05-11 17:51 [RFA] Completion of add-inferior Eli Zaretskii
@ 2012-05-11 20:21 ` Tom Tromey
2012-05-11 20:55 ` Eli Zaretskii
2012-05-12 6:36 ` Eli Zaretskii
0 siblings, 2 replies; 5+ messages in thread
From: Tom Tromey @ 2012-05-11 20:21 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: gdb-patches
>>>>> "Eli" == Eli Zaretskii <eliz@gnu.org> writes:
Eli> 2012-05-11 Eli Zaretskii <eliz@gnu.org>
Eli> * inferior.c: Include completer.h
Eli> (initialize_inferiors): Set completer of add-inferior to
Eli> filename_completer.
It isn't perhaps ideal, but it is better than the status quo, so ok.
Tom
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [RFA] Completion of add-inferior
2012-05-11 20:21 ` Tom Tromey
@ 2012-05-11 20:55 ` Eli Zaretskii
2012-05-11 20:58 ` Tom Tromey
2012-05-12 6:36 ` Eli Zaretskii
1 sibling, 1 reply; 5+ messages in thread
From: Eli Zaretskii @ 2012-05-11 20:55 UTC (permalink / raw)
To: Tom Tromey; +Cc: gdb-patches
> From: Tom Tromey <tromey@redhat.com>
> Cc: gdb-patches@sourceware.org
> Date: Fri, 11 May 2012 14:20:49 -0600
>
> >>>>> "Eli" == Eli Zaretskii <eliz@gnu.org> writes:
>
> Eli> 2012-05-11 Eli Zaretskii <eliz@gnu.org>
> Eli> * inferior.c: Include completer.h
> Eli> (initialize_inferiors): Set completer of add-inferior to
> Eli> filename_completer.
>
> It isn't perhaps ideal, but it is better than the status quo, so ok.
Thanks for the review.
In what way is it not ideal? Did you want to complete on file names
only when -exec was used? I thought about that, but then I realized
that any other way of invoking that command cannot benefit from any
completion at all.
Or did you have something else in mind?
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [RFA] Completion of add-inferior
2012-05-11 20:55 ` Eli Zaretskii
@ 2012-05-11 20:58 ` Tom Tromey
0 siblings, 0 replies; 5+ messages in thread
From: Tom Tromey @ 2012-05-11 20:58 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: gdb-patches
>>>>> "Eli" == Eli Zaretskii <eliz@gnu.org> writes:
Eli> In what way is it not ideal? Did you want to complete on file names
Eli> only when -exec was used? I thought about that, but then I realized
Eli> that any other way of invoking that command cannot benefit from any
Eli> completion at all.
Eli> Or did you have something else in mind?
Yeah, it could be context-sensitive; and also complete the options as
well.
I don't think it is very important.
In my mind I immediately went to having a gdb-specific getopt that also
had completion callbacks; funny overkill of the sort programmers are
susceptible to :)
Tom
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [RFA] Completion of add-inferior
2012-05-11 20:21 ` Tom Tromey
2012-05-11 20:55 ` Eli Zaretskii
@ 2012-05-12 6:36 ` Eli Zaretskii
1 sibling, 0 replies; 5+ messages in thread
From: Eli Zaretskii @ 2012-05-12 6:36 UTC (permalink / raw)
To: Tom Tromey; +Cc: gdb-patches
> From: Tom Tromey <tromey@redhat.com>
> Cc: gdb-patches@sourceware.org
> Date: Fri, 11 May 2012 14:20:49 -0600
>
> >>>>> "Eli" == Eli Zaretskii <eliz@gnu.org> writes:
>
> Eli> 2012-05-11 Eli Zaretskii <eliz@gnu.org>
> Eli> * inferior.c: Include completer.h
> Eli> (initialize_inferiors): Set completer of add-inferior to
> Eli> filename_completer.
>
> It isn't perhaps ideal, but it is better than the status quo, so ok.
Thanks, committed.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2012-05-12 6:36 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-05-11 17:51 [RFA] Completion of add-inferior Eli Zaretskii
2012-05-11 20:21 ` Tom Tromey
2012-05-11 20:55 ` Eli Zaretskii
2012-05-11 20:58 ` Tom Tromey
2012-05-12 6:36 ` Eli Zaretskii
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox