2008-04-03 Pedro Alves gdb/ * linespec.c (symtab_from_filename): Also throw NOT_FOUND_ERROR if there are no symbols loaded, instead of throwing a generic error. (decode_variable): Likewise. gdb/testsuite/ * gdb.base/pending.exp: Test pending breakpoints without symbols loaded. --- gdb/linespec.c | 15 +++++++++------ gdb/testsuite/gdb.base/pending.exp | 26 ++++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 6 deletions(-) Index: src/gdb/linespec.c =================================================================== --- src.orig/gdb/linespec.c 2008-04-02 20:39:34.000000000 +0100 +++ src/gdb/linespec.c 2008-04-03 19:14:17.000000000 +0100 @@ -1534,10 +1534,11 @@ 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.")); if (not_found_ptr) *not_found_ptr = 1; + if (!have_full_symbols () && !have_partial_symbols ()) + throw_error (NOT_FOUND_ERROR, + _("No symbol table is loaded. Use the \"file\" command.")); throw_error (NOT_FOUND_ERROR, _("No source file named %s."), copy); } @@ -1744,12 +1745,14 @@ 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; + + if (!have_full_symbols () + && !have_partial_symbols () + && !have_minimal_symbols ()) + throw_error (NOT_FOUND_ERROR, + _("No symbol table is loaded. Use the \"file\" command.")); throw_error (NOT_FOUND_ERROR, _("Function \"%s\" not defined."), copy); } Index: src/gdb/testsuite/gdb.base/pending.exp =================================================================== --- src.orig/gdb/testsuite/gdb.base/pending.exp 2008-04-03 19:15:11.000000000 +0100 +++ src/gdb/testsuite/gdb.base/pending.exp 2008-04-03 19:29:42.000000000 +0100 @@ -54,6 +54,32 @@ if { [gdb_compile_shlib $libsrc $lib_sl gdb_exit gdb_start gdb_reinitialize_dir $srcdir/$subdir + +gdb_test_multiple "break pendfunc1" "set pending breakpoint" { + -re ".*Make breakpoint pending.*y or \\\[n\\\]. $" { + gdb_test "y" "Breakpoint.*pendfunc1.*pending." "set pending breakpoint (without symbols)" + } +} + +gdb_test "info break" \ + "Num Type\[ \]+Disp Enb Address\[ \]+What.* +\[0-9\]+\[\t \]+breakpoint keep y.*PENDING.*pendfunc1.*" \ +"single pending breakpoint info (without symbols)" + +gdb_load ${binfile} +gdb_load_shlibs $lib_sl + +set pendfunc1_loc [gdb_get_line_number "y = x + 4" ${libfile}.c] +gdb_test "run" \ +".*Breakpoint.*pendfunc1.*at.*pendshr.c:$pendfunc1_loc.*y = x \\+ 4.*" \ +"run to resolved breakpoint 1 (without symbols)" + +# Restart with a fresh gdb. + +gdb_exit +gdb_start +gdb_reinitialize_dir $srcdir/$subdir + gdb_load ${binfile} gdb_load_shlibs $lib_sl