aboutsummaryrefslogtreecommitdiff
path: root/gdb/completer.c
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2012-08-10 05:03:13 +0000
committerMike Frysinger <vapier@gentoo.org>2012-08-10 05:03:13 +0000
commitde0bea007c446f40ecec90a2672e0a806d397e1a (patch)
tree239ac66f780b5afdb4cdc3e2115100a096c7e9b4 /gdb/completer.c
parent44534af395e517016f70c2b0baee26f810391843 (diff)
downloadgdb-de0bea007c446f40ecec90a2672e0a806d397e1a.zip
gdb-de0bea007c446f40ecec90a2672e0a806d397e1a.tar.gz
gdb-de0bea007c446f40ecec90a2672e0a806d397e1a.tar.bz2
gdb: add completion handler for "handle" and "signal"
The command line completion has spoiled me. Thus the lack of completion with the "handle" command annoys me. Patch! This does a few things: - adds a VEC_merge helper - adds a generic signal completer - adds a completion handler for the "handle" command - sets the completion handler for the "signal" command URL: http://sourceware.org/bugzilla/show_bug.cgi?id=10436 Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Diffstat (limited to 'gdb/completer.c')
-rw-r--r--gdb/completer.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/gdb/completer.c b/gdb/completer.c
index b9f0699..2002578 100644
--- a/gdb/completer.c
+++ b/gdb/completer.c
@@ -24,6 +24,7 @@
#include "language.h"
#include "gdb_assert.h"
#include "exceptions.h"
+#include "gdb_signals.h"
#include "cli/cli-decode.h"
@@ -797,6 +798,37 @@ command_completer (struct cmd_list_element *ignore,
strlen (text), handle_help);
}
+/* Complete on signals. */
+
+VEC (char_ptr) *
+signal_completer (struct cmd_list_element *ignore,
+ char *text, char *word)
+{
+ int i;
+ VEC (char_ptr) *return_val = NULL;
+ size_t len = strlen (word);
+ enum gdb_signal signum;
+ const char *signame;
+
+ for (signum = GDB_SIGNAL_FIRST; signum != GDB_SIGNAL_LAST; ++signum)
+ {
+ /* Can't handle this, so skip it. */
+ if (signum == GDB_SIGNAL_0)
+ continue;
+
+ signame = gdb_signal_to_name (signum);
+
+ /* Ignore the unknown signal case. */
+ if (!signame || strcmp (signame, "?") == 0)
+ continue;
+
+ if (strncasecmp (signame, word, len) == 0)
+ VEC_safe_push (char_ptr, return_val, xstrdup (signame));
+ }
+
+ return return_val;
+}
+
/* Get the list of chars that are considered as word breaks
for the current command. */