summaryrefslogtreecommitdiff
path: root/gdb/cp-abi.c
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2013-01-17 16:27:26 +0000
committerTom Tromey <tromey@redhat.com>2013-01-17 16:27:26 +0000
commit3174fd02b667571ba97f88f6d48705dc0b009a86 (patch)
treea713011a89f75fefcb45ecd957817a5b248f621d /gdb/cp-abi.c
parent401d69c72fcabc3f8127138ad039f25280bfaee0 (diff)
downloadgdb-3174fd02b667571ba97f88f6d48705dc0b009a86.tar.gz
* cp-abi.c (cp_abi_completer): New function.
(_initialize_cp_abi): Set completer for "set cp-abi". gdb/testsuite * gdb.base/completion.exp: Add "set cp-abi" completion test.
Diffstat (limited to 'gdb/cp-abi.c')
-rw-r--r--gdb/cp-abi.c28
1 files changed, 26 insertions, 2 deletions
diff --git a/gdb/cp-abi.c b/gdb/cp-abi.c
index f2a96deda64..f1fa9011e66 100644
--- a/gdb/cp-abi.c
+++ b/gdb/cp-abi.c
@@ -314,6 +314,27 @@ set_cp_abi_cmd (char *args, int from_tty)
error (_("Could not find \"%s\" in ABI list"), args);
}
+/* A completion function for "set cp-abi". */
+
+static VEC (char_ptr) *
+cp_abi_completer (struct cmd_list_element *ignore,
+ char *text, char *word)
+{
+ static const char **cp_abi_names;
+
+ if (cp_abi_names == NULL)
+ {
+ int i;
+
+ cp_abi_names = XNEWVEC (const char *, num_cp_abis + 1);
+ for (i = 0; i < num_cp_abis; ++i)
+ cp_abi_names[i] = cp_abis[i]->shortname;
+ cp_abis[i] = NULL;
+ }
+
+ return complete_on_enum (cp_abi_names, text, word);
+}
+
/* Show the currently selected C++ ABI. */
static void
@@ -334,13 +355,16 @@ extern initialize_file_ftype _initialize_cp_abi; /* -Wmissing-prototypes */
void
_initialize_cp_abi (void)
{
+ struct cmd_list_element *c;
+
register_cp_abi (&auto_cp_abi);
switch_to_cp_abi ("auto");
- add_cmd ("cp-abi", class_obscure, set_cp_abi_cmd, _("\
+ c = add_cmd ("cp-abi", class_obscure, set_cp_abi_cmd, _("\
Set the ABI used for inspecting C++ objects.\n\
\"set cp-abi\" with no arguments will list the available ABIs."),
- &setlist);
+ &setlist);
+ set_cmd_completer (c, cp_abi_completer);
add_cmd ("cp-abi", class_obscure, show_cp_abi_cmd,
_("Show the ABI used for inspecting C++ objects."),