Index: ada-lang.c =================================================================== --- ada-lang.c (revision 32) +++ ada-lang.c (revision 33) @@ -293,6 +293,21 @@ static void ada_forward_operator_length /* Maximum-sized dynamic type. */ static unsigned int varsize_limit; +/* Allow the user to configure the debugger behavior with respect + to multiple-choice menus. */ + +static const char auto_select_off[] = "off"; +static const char auto_select_all[] = "all"; +static const char auto_select_cancel[] = "cancel"; +static const char *auto_select_choices[] = +{ + auto_select_off, + auto_select_all, + auto_select_cancel, + NULL +}; +static const char *auto_select_choice = auto_select_off; + /* FIXME: brobecker/2003-09-17: No longer a const because it is returned by a function that does not return a const char *. */ static char *ada_completer_word_break_characters = @@ -3341,6 +3356,15 @@ user_select_syms (struct ada_symbol_info if (nsyms <= 1) return nsyms; + if (auto_select_choice == auto_select_cancel + || (auto_select_choice == auto_select_all && max_results <= 1)) + error (_("\ +canceled because the command is ambiguous and the multiple-choice menu\n\ +has been deactivated. See set/show multiple-choice-auto-select.")); + + if (auto_select_choice == auto_select_all) + return nsyms; + printf_unfiltered (_("[0] cancel\n")); if (max_results > 1) printf_unfiltered (_("[1] all\n")); @@ -10993,6 +11017,15 @@ _initialize_ada_language (void) varsize_limit = 65536; + add_setshow_enum_cmd ("multiple-choice-auto-select", no_class, + auto_select_choices, &auto_select_choice, + _("\ +Set the debugger behavior when part of a command is ambiguous and\n\ +a multiple-choice menu would normally be printed."), _("\ +Show how the debugger handles ambiguities in commands."), _("\ +Valid values are \"off\", \"all\", \"cancel\", and the default is \"off\"."), + NULL, NULL, &setlist, &showlist); + obstack_init (&symbol_list_obstack); decoded_names_store = htab_create_alloc