2007-12-07 Pedro Alves * linespec.c (symtab_from_filename): Don't error out early if there are no symbols loaded. (decode_variable): Likewise. --- gdb/linespec.c | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) Index: src/gdb/linespec.c =================================================================== --- src.orig/gdb/linespec.c 2007-12-07 00:33:10.000000000 +0000 +++ src/gdb/linespec.c 2007-12-07 01:39:08.000000000 +0000 @@ -1534,11 +1534,16 @@ symtab_from_filename (char **argptr, cha file_symtab = lookup_symtab (copy); if (file_symtab == 0) { - if (!have_full_symbols () && !have_partial_symbols ()) - error (_("No symbol table is loaded. Use the \"file\" command.")); + int nosyms = !have_full_symbols () && !have_partial_symbols (); + if (not_found_ptr) *not_found_ptr = 1; - throw_error (NOT_FOUND_ERROR, _("No source file named %s."), copy); + + throw_error (NOT_FOUND_ERROR, _("\ +%s\ +No source file named %s."), + nosyms ? _("\ +No symbol table is loaded. Use the \"file\" command.\n") : "", copy); } /* Discard the file name from the arg. */ @@ -1727,6 +1732,7 @@ decode_variable (char *copy, int funfirs struct symtab *sym_symtab; struct minimal_symbol *msymbol; + int nosyms; sym = lookup_symbol (copy, (file_symtab @@ -1744,13 +1750,19 @@ decode_variable (char *copy, int funfirs if (msymbol != NULL) return minsym_found (funfirstline, msymbol); - if (!have_full_symbols () && - !have_partial_symbols () && !have_minimal_symbols ()) - error (_("No symbol table is loaded. Use the \"file\" command.")); - if (not_found_ptr) *not_found_ptr = 1; - throw_error (NOT_FOUND_ERROR, _("Function \"%s\" not defined."), copy); + + nosyms = (!have_full_symbols () + && !have_partial_symbols () + && !have_minimal_symbols ()); + + throw_error (NOT_FOUND_ERROR, + _("\ +%s\ +Function \"%s\" not defined."), + nosyms ? _("\ +No symbol table is loaded. Use the \"file\" command.\n") : "", copy); }