summaryrefslogtreecommitdiff
path: root/gdb/linespec.c
diff options
context:
space:
mode:
authorJoel Brobecker <brobecker@gnat.com>2008-04-03 21:39:16 +0000
committerJoel Brobecker <brobecker@gnat.com>2008-04-03 21:39:16 +0000
commiteb22f790cf814c37bbcd3ee9b4aec44e863112d7 (patch)
tree8bf6e85738cd4bb36ee9d1137358a53ed551f7c1 /gdb/linespec.c
parent0cc0925c3a22af4df51d47c48fd44699bdb20c1c (diff)
downloadgdb-eb22f790cf814c37bbcd3ee9b4aec44e863112d7.tar.gz
* symtab.c (multiple_symbols_ask, multiple_symbols_all)
(multiple_symbols_cancel): New constants. (multiple_symbols_modes, multiple_symbols_mode): New static globals. (multiple_symbols_select_mode): New function. (_initialize_symtab): Add new set/show multiple-symbols commands. * symtab.h (multiple_symbols_ask, multiple_symbols_all) (multiple_symbols_cancel, multiple_symbols_select_mode): Declare. * ada-lang.c (user_select_syms): Add handling of new multiple-symbols setting. * linespec.c (decode_line_2): Likewise.
Diffstat (limited to 'gdb/linespec.c')
-rw-r--r--gdb/linespec.c64
1 files changed, 42 insertions, 22 deletions
diff --git a/gdb/linespec.c b/gdb/linespec.c
index b3a46b46a23..f78a681406d 100644
--- a/gdb/linespec.c
+++ b/gdb/linespec.c
@@ -491,7 +491,13 @@ decode_line_2 (struct symbol *sym_arr[], int nelts, int funfirstline,
char *symname;
struct cleanup *old_chain;
char **canonical_arr = (char **) NULL;
+ const char *select_mode = multiple_symbols_select_mode ();
+ if (select_mode == multiple_symbols_cancel)
+ error (_("\
+canceled because the command is ambiguous\n\
+See set/show multiple-symbol."));
+
values.sals = (struct symtab_and_line *)
alloca (nelts * sizeof (struct symtab_and_line));
return_values.sals = (struct symtab_and_line *)
@@ -507,38 +513,52 @@ decode_line_2 (struct symbol *sym_arr[], int nelts, int funfirstline,
}
i = 0;
- printf_unfiltered (_("[0] cancel\n[1] all\n"));
while (i < nelts)
{
init_sal (&return_values.sals[i]); /* Initialize to zeroes. */
init_sal (&values.sals[i]);
if (sym_arr[i] && SYMBOL_CLASS (sym_arr[i]) == LOC_BLOCK)
- {
- values.sals[i] = find_function_start_sal (sym_arr[i], funfirstline);
- if (values.sals[i].symtab)
- printf_unfiltered ("[%d] %s at %s:%d\n",
- (i + 2),
- SYMBOL_PRINT_NAME (sym_arr[i]),
- values.sals[i].symtab->filename,
- values.sals[i].line);
- else
- printf_unfiltered (_("[%d] %s at ?FILE:%d [No symtab? Probably broken debug info...]\n"),
- (i + 2),
- SYMBOL_PRINT_NAME (sym_arr[i]),
- values.sals[i].line);
-
- }
- else
- printf_unfiltered (_("?HERE\n"));
+ values.sals[i] = find_function_start_sal (sym_arr[i], funfirstline);
i++;
}
- prompt = getenv ("PS2");
- if (prompt == NULL)
+ /* If select_mode is "all", then do not print the multiple-choice
+ menu and act as if the user had chosen choice "1" (all). */
+ if (select_mode == multiple_symbols_all)
+ args = "1";
+ else
{
- prompt = "> ";
+ i = 0;
+ printf_unfiltered (_("[0] cancel\n[1] all\n"));
+ while (i < nelts)
+ {
+ if (sym_arr[i] && SYMBOL_CLASS (sym_arr[i]) == LOC_BLOCK)
+ {
+ if (values.sals[i].symtab)
+ printf_unfiltered ("[%d] %s at %s:%d\n",
+ (i + 2),
+ SYMBOL_PRINT_NAME (sym_arr[i]),
+ values.sals[i].symtab->filename,
+ values.sals[i].line);
+ else
+ printf_unfiltered (_("[%d] %s at ?FILE:%d [No symtab? Probably broken debug info...]\n"),
+ (i + 2),
+ SYMBOL_PRINT_NAME (sym_arr[i]),
+ values.sals[i].line);
+
+ }
+ else
+ printf_unfiltered (_("?HERE\n"));
+ i++;
+ }
+
+ prompt = getenv ("PS2");
+ if (prompt == NULL)
+ {
+ prompt = "> ";
+ }
+ args = command_line_input (prompt, 0, "overload-choice");
}
- args = command_line_input (prompt, 0, "overload-choice");
if (args == 0 || *args == 0)
error_no_arg (_("one or more choice numbers"));