diff options
Diffstat (limited to 'gdb/completer.c')
-rw-r--r-- | gdb/completer.c | 32 |
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. */ |