diff -urpN src/gdb/linespec.c dev/gdb/linespec.c --- src/gdb/linespec.c 2008-01-01 23:53:11.000000000 +0100 +++ dev/gdb/linespec.c 2008-01-17 07:19:54.000000000 +0100 @@ -1725,8 +1725,36 @@ decode_variable (char *copy, int funfirs struct symbol *sym; /* The symtab that SYM was found in. */ struct symtab *sym_symtab; - struct minimal_symbol *msymbol; + const char *auto_select = multiple_choice_auto_select_mode (); + + + if (auto_select == auto_select_all && !file_symtab) + { + int nelts; + struct symbol_search *symbols, *p; + struct cleanup *chain; + struct symbol **sym_arr; + + search_symbols (copy, FUNCTIONS_DOMAIN, 0, (char **) NULL, &symbols); + chain = make_cleanup_free_search_symbols (symbols); + + nelts = count_symbols (symbols); + if (nelts > 1) + { + int idx = 0; + sym_arr = xmalloc ((nelts) * sizeof (struct symbol *)); + make_cleanup (xfree, sym_arr); + + for (p = symbols; p != NULL; p = p->next) + if (p->symbol) + sym_arr[idx++] = p->symbol; + + return decode_line_2 (sym_arr, idx, funfirstline, + canonical); + } + } + sym = lookup_symbol (copy, (file_symtab diff -urpN src/gdb/symtab.c dev/gdb/symtab.c --- src/gdb/symtab.c 2008-01-03 22:30:13.000000000 +0100 +++ dev/gdb/symtab.c 2008-01-17 07:22:07.000000000 +0100 @@ -2778,6 +2802,22 @@ file_matches (char *file, char *files[], return 0; } + +/* Returns number of elements in search reusult SYMBOLS. */ + +int +count_symbols (struct symbol_search *symbols) +{ + struct symbol_search *p; + int nr = 0; + + for (p = symbols; p != NULL; p = p->next) + nr++; + + return nr; +} + + /* Free any memory associated with a search. */ void free_search_symbols (struct symbol_search *symbols) diff -urpN src/gdb/symtab.h dev/gdb/symtab.h --- src/gdb/symtab.h 2008-01-01 23:53:13.000000000 +0100 +++ dev/gdb/symtab.h 2008-01-17 07:22:45.000000000 +0100 @@ -1385,6 +1391,7 @@ struct symbol_search extern void search_symbols (char *, domain_enum, int, char **, struct symbol_search **); +extern int count_symbols (struct symbol_search *); extern void free_search_symbols (struct symbol_search *); extern struct cleanup *make_cleanup_free_search_symbols (struct symbol_search *);