From: Tom Tromey Date: Thu, 17 Jan 2013 16:27:35 +0000 (+0000) Subject: * cp-abi.c (cp_abi_completer): New function. X-Git-Tag: sid-snapshot-20130201~167 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=db2b2972f1ecb46c80dffbcf4630b1027e5ba529;p=external%2Fbinutils.git * 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. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index a094aea..a98621c 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,10 @@ 2013-01-17 Tom Tromey + * cp-abi.c (cp_abi_completer): New function. + (_initialize_cp_abi): Set completer for "set cp-abi". + +2013-01-17 Tom Tromey + * mem-break.c: Remove obsolete comment. * bfin-tdep.c (bfin_breakpoint_from_pc): Fix comment. diff --git a/gdb/cp-abi.c b/gdb/cp-abi.c index f2a96de..f1fa901 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."), diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 7f5f0a4..7fb73a5 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2013-01-17 Tom Tromey + + * gdb.base/completion.exp: Add "set cp-abi" completion test. + 2013-01-17 Pedro Alves Merge dg-extract-results.sh from upstream (svn 195224). diff --git a/gdb/testsuite/gdb.base/completion.exp b/gdb/testsuite/gdb.base/completion.exp index 8163a86..fc90a20 100644 --- a/gdb/testsuite/gdb.base/completion.exp +++ b/gdb/testsuite/gdb.base/completion.exp @@ -710,6 +710,9 @@ gdb_test "complete ptype union some_" "ptype union some_union" gdb_test "complete set gnutarget aut" "set gnutarget auto" + +gdb_test "complete set cp-abi aut" "set cp-abi auto" + # Restore globals modified in this test... set timeout $oldtimeout1