]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
commit 2daaa790297294478cb724dbec677879580bb2cf
authorJan Kratochvil <jan.kratochvil@redhat.com>
Sat, 2 Jul 2011 20:07:59 +0000 (20:07 +0000)
committerJan Kratochvil <jan.kratochvil@redhat.com>
Sat, 2 Jul 2011 20:07:59 +0000 (20:07 +0000)
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date:   Fri Jul 1 20:16:38 2011 +0000

gdb/
Fall back linespec to minimal symbols.
* linespec.c (decode_line_1): New variable ex, saved_argptr.  Protect
decode_compound by TRY_CATCH, fall back on minsyms if it failed.
(find_method, symbol_found): Change error to cplusplus_error.

gdb/testsuite/
Fall back linespec to minimal symbols.
* gdb.base/psymtab.exp (Don't search past end of psymtab.): Update the
error message.
* gdb.cp/cplusfuncs.exp (list foo::operator int*): Likewise.
* gdb.cp/minsym-fallback-main.cc: New file.
* gdb.cp/minsym-fallback.cc: New file.
* gdb.cp/minsym-fallback.exp: New file.
* gdb.cp/minsym-fallback.h: New file.

gdb/ChangeLog
gdb/linespec.c
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.base/psymtab.exp
gdb/testsuite/gdb.cp/cplusfuncs.exp
gdb/testsuite/gdb.cp/minsym-fallback-main.cc
gdb/testsuite/gdb.cp/minsym-fallback.cc
gdb/testsuite/gdb.cp/minsym-fallback.exp
gdb/testsuite/gdb.cp/minsym-fallback.h

index e4be01ccf94d8e12f12d12b81f5d44ec537557e8..e33c77d12cdf0c0c5580af6e4d12905e76fce6ec 100644 (file)
@@ -1,3 +1,10 @@
+2011-07-02  Jan Kratochvil  <jan.kratochvil@redhat.com>
+
+       Fall back linespec to minimal symbols.
+       * linespec.c (decode_line_1): New variable ex, saved_argptr.  Protect
+       decode_compound by TRY_CATCH, fall back on minsyms if it failed.
+       (find_method, symbol_found): Change error to cplusplus_error.
+
 2011-07-02  Jan Kratochvil  <jan.kratochvil@redhat.com>
 
        * symtab.c (symbol_find_demangled_name): Remove DMGL_VERBOSE.
index 51e7bfa00152f9c872f349e2be24474e60aa5526..88e95af02c7715573b4ac34d9163dc65e5028856 100644 (file)
@@ -932,35 +932,51 @@ decode_line_1 (char **argptr, int funfirstline, struct symtab *default_symtab,
       if (p[0] == '.' || p[1] == ':')
        {
          struct symtabs_and_lines values;
+         volatile struct gdb_exception ex;
+         char *saved_argptr = *argptr;
 
          if (is_quote_enclosed)
            ++saved_arg;
-         values = decode_compound (argptr, funfirstline, canonical,
-                                   file_symtab, saved_arg, p);
+
+         TRY_CATCH (ex, RETURN_MASK_ERROR)
+           {
+             values = decode_compound (argptr, funfirstline, canonical,
+                                       file_symtab, saved_arg, p);
+           }
          if ((is_quoted || is_squote_enclosed) && **argptr == '\'')
            *argptr = *argptr + 1;
-         return values;
-       }
 
-      /* If there was an exception looking up a specified filename earlier,
-        then check whether we were really given `function:label'.   */
-      if (file_exception.reason < 0)
-       {
-         function_symbol = find_function_symbol (argptr, p, is_quote_enclosed);
-         /* If we did not find a function, re-throw the original
-            exception.  */
-         if (!function_symbol)
-           throw_exception (file_exception);
-       }
+         if (ex.reason >= 0)
+           return values;
 
-      /* Check for single quotes on the non-filename part.  */
-      if (!is_quoted)
+         if (ex.error != NOT_FOUND_ERROR)
+           throw_exception (ex);
+
+         *argptr = saved_argptr;
+       }
+      else
        {
-         is_quoted = (**argptr
-                      && strchr (get_gdb_completer_quote_characters (),
-                                 **argptr) != NULL);
-         if (is_quoted)
-           end_quote = skip_quoted (*argptr);
+         /* If there was an exception looking up a specified filename earlier,
+            then check whether we were really given `function:label'.   */
+         if (file_exception.reason < 0)
+           {
+             function_symbol = find_function_symbol (argptr, p,
+                                                     is_quote_enclosed);
+             /* If we did not find a function, re-throw the original
+                exception.  */
+             if (!function_symbol)
+               throw_exception (file_exception);
+           }
+
+         /* Check for single quotes on the non-filename part.  */
+         if (!is_quoted)
+           {
+             is_quoted = (**argptr
+                          && strchr (get_gdb_completer_quote_characters (),
+                                     **argptr) != NULL);
+             if (is_quoted)
+               end_quote = skip_quoted (*argptr);
+           }
        }
     }
 
@@ -1797,9 +1813,9 @@ find_method (int funfirstline, struct linespec_result *canonical,
                }
            }
 
-         error (_("the class `%s' does not have "
-                  "any method instance named %s"),
-                SYMBOL_PRINT_NAME (sym_class), copy);
+         cplusplus_error (saved_arg, _("the class `%s' does not have "
+                                       "any method instance named %s"),
+                                     SYMBOL_PRINT_NAME (sym_class), copy);
        }
 
       return decode_line_2 (sym_arr, i1, funfirstline, canonical);
@@ -2207,7 +2223,12 @@ symbol_found (int funfirstline, struct linespec_result *canonical, char *copy,
          return values;
        }
       else if (funfirstline)
-       error (_("\"%s\" is not a function"), copy);
+       {
+         /* NOT_FOUND_ERROR is not correct but it ensures COPY will be
+            searched also as a minimal symbol.  */
+
+         throw_error (NOT_FOUND_ERROR, _("\"%s\" is not a function"), copy);
+       }
       else if (SYMBOL_LINE (sym) != 0)
        {
          /* We know its line number.  */
index 89bdc85ea73b17893bfb290a128a863b837727b0..1a5832191b02a2ed5b9785c5a00320954497b19b 100644 (file)
@@ -1,3 +1,14 @@
+2011-07-02  Jan Kratochvil  <jan.kratochvil@redhat.com>
+
+       Fall back linespec to minimal symbols.
+       * gdb.base/psymtab.exp (Don't search past end of psymtab.): Update the
+       error message.
+       * gdb.cp/cplusfuncs.exp (list foo::operator int*): Likewise.
+       * gdb.cp/minsym-fallback-main.cc: New file.
+       * gdb.cp/minsym-fallback.cc: New file.
+       * gdb.cp/minsym-fallback.exp: New file.
+       * gdb.cp/minsym-fallback.h: New file.
+
 2011-07-02  Jan Kratochvil  <jan.kratochvil@redhat.com>
 
        * gdb.cp/no-dmgl-verbose.cc: New file.
index 903c286d76d3db1dd01623761668a37421009af9..a68513022d38dcdefa4c1f26cf0c56234f6dfb02 100644 (file)
@@ -71,4 +71,4 @@ gdb_test_no_output "set breakpoint pending off" "psymtab pending setup"
 # zzz::dummy currently causes a search for 'zzz' in STRUCT_NAMESPACE
 # without a preceding search for 'zzz' in VAR_NAMESPACE.
 
-gdb_test "break zzz::dummy" "Can't find member of namespace, class, struct, or union named \"zzz::dummy\"\r\n.*" "Don't search past end of psymtab."
+gdb_test "break zzz::dummy" {Function "zzz::dummy" not defined\.} "Don't search past end of psymtab."
index 10e4dac61acdfaab8704d5b660b78918f91e4415..f075352598529085f175b7b6dc44fc7bbc3a6d45 100644 (file)
@@ -616,7 +616,7 @@ proc do_tests {} {
 
     # A regression test on errors involving operators
     gdb_test "list foo::operator $dm_type_int_star" \
-       ".*the class foo does not have any method named operator $dm_type_int_star.*"
+       "Function \"foo::operator [string_to_regexp $dm_type_int_star]\" not defined\\."
 }
 
 do_tests
index d2a677ba222c7b5b93d023fb059ab6b1be802fd7..a82adefb623789d37fafa61f7a952427360554e4 100644 (file)
@@ -23,5 +23,4 @@ int
 main ()
 {
   c.f ();
-  c ();
 }
index 1231f7d98342c5a4dbd7d84d91fe2536578fb244..1ecd2892300cbce2503daa0707af8d522b153033 100644 (file)
@@ -21,8 +21,3 @@ void
 C::f ()
 {
 }
-
-void
-C::operator () ()
-{
-}
index 20065450e8f94afb8b964acb2a3e9f6a46a88a71..df95a2d6e3c0bacef7c2f482a5b24fd3ff0a9a56 100644 (file)
@@ -35,6 +35,4 @@ clean_restart ${executable}
 
 gdb_test_no_output "set breakpoint pending off"
 
-gdb_test "break C::f()" {Breakpoint [0-9]+ at 0x[0-9a-f]+}
-
-gdb_test "break C::operator()()" {Breakpoint [0-9]+ at 0x[0-9a-f]+}
+gdb_test "break 'C::f()'" {Breakpoint [0-9]+ at 0x[0-9a-f]+}
index 88bcb5cb58fbd1439b7fb045fa5d9ba9dd98d16e..db32e4571b006b9bc4118b9fe58dbefeefabeae1 100644 (file)
@@ -19,5 +19,4 @@ class C
 {
 public:
   static void f ();
-  void operator () ();
 };