gdb/
authorPedro Alves <palves@redhat.com>
Wed, 20 Aug 2008 11:47:57 +0000 (11:47 +0000)
committerPedro Alves <palves@redhat.com>
Wed, 20 Aug 2008 11:47:57 +0000 (11:47 +0000)
* 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/ChangeLog
gdb/linespec.c
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.base/pending.exp

index 1d67ce8a731b087dace354e372cb3f9302fb5915..9194f04a0ab3feba28ee377dbebaa6d34f6ac407 100644 (file)
@@ -1,3 +1,9 @@
+2008-08-20  Pedro Alves  <pedro@codesourcery.com>
+
+       * 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.
+
 2008-08-20  Pedro Alves  <pedro@codesourcery.com>
 
        * objfiles.h (struct obj_section): Remove addr and endaddr fields.
index 953e726bed5eb2825dcc177dc267d91696b0b025..f83936c52237a6280866ca646724fda7125441f5 100644 (file)
@@ -1556,10 +1556,11 @@ symtab_from_filename (char **argptr, char *p, int is_quote_enclosed,
   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);
     }
 
@@ -1760,12 +1761,14 @@ decode_variable (char *copy, int funfirstline, char ***canonical,
   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 8d7b7ff767b67224af01d83bd93a0daaf962abd4..110832dfc41db8a9a116bdea1e25e5736e8a7883 100644 (file)
@@ -1,3 +1,8 @@
+2008-08-20  Pedro Alves  <pedro@codesourcery.com>
+
+       * gdb.base/pending.exp: Test pending breakpoints without symbols
+       loaded.
+
 2008-08-19  Vladimir Prus  <vladimir@codesourcery.com>
 
        * lib/mi-support.exp (mi_expect_stop): Produce
index bcca61e282402b038c2af1f90ef093d41ad7c242..48fe57f7c2d9655a1234fd550212875df542d1cd 100644 (file)
@@ -54,6 +54,32 @@ if { [gdb_compile_shlib $libsrc $lib_sl $lib_opts] != ""
 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