Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [patch 1/2] physname reg.: linespec minsym fallback
@ 2011-06-05 20:27 Jan Kratochvil
  2011-06-07 20:56 ` Tom Tromey
  2011-07-01 20:21 ` [commit] " Jan Kratochvil
  0 siblings, 2 replies; 7+ messages in thread
From: Jan Kratochvil @ 2011-06-05 20:27 UTC (permalink / raw)
  To: gdb-patches

Hi,

decode_compound already contains some minsym fallback(s) but it still
sometimes errors inside find_method without such callback.

The decode_compound minsym fallback(s) could be even removed as a code cleanup
afterwards.

Do not execute it without [patch 2/2].


Thanks,
Jan


gdb/
2011-06-05  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.

gdb/testsuite/
2011-06-05  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.

--- a/gdb/linespec.c
+++ b/gdb/linespec.c
@@ -933,35 +933,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);
+	    }
 	}
     }
 
@@ -1798,9 +1814,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);
@@ -2208,7 +2224,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.  */
--- a/gdb/testsuite/gdb.base/psymtab.exp
+++ b/gdb/testsuite/gdb.base/psymtab.exp
@@ -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."
--- a/gdb/testsuite/gdb.cp/cplusfuncs.exp
+++ b/gdb/testsuite/gdb.cp/cplusfuncs.exp
@@ -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
--- /dev/null
+++ b/gdb/testsuite/gdb.cp/minsym-fallback-main.cc
@@ -0,0 +1,26 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+   Copyright 2011 Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+#include "minsym-fallback.h"
+
+C c;
+
+int
+main ()
+{
+  c.f ();
+}
--- /dev/null
+++ b/gdb/testsuite/gdb.cp/minsym-fallback.cc
@@ -0,0 +1,23 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+   Copyright 2011 Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+#include "minsym-fallback.h"
+
+void
+C::f ()
+{
+}
--- /dev/null
+++ b/gdb/testsuite/gdb.cp/minsym-fallback.exp
@@ -0,0 +1,38 @@
+# Copyright (C) 2011 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# The goal is to have class with full DWARF symbols present in one file having
+# only a declaration there for the method.  The method is then defined in
+# a different file providing only ELF symbols.
+
+set testfile minsym-fallback
+set srcfile ${testfile}.cc
+set srcmainfile ${testfile}-main.cc
+set executable $testfile
+set objfile $objdir/$subdir/${testfile}.o
+set objmainfile $objdir/$subdir/${testfile}-main.o
+set binfile $objdir/$subdir/$executable
+if {[gdb_compile $srcdir/$subdir/$srcfile $objfile object {}] != ""
+    || [gdb_compile $srcdir/$subdir/$srcmainfile $objmainfile object {debug}] != ""
+    || [gdb_compile "$objfile $objmainfile" $binfile executable {}] != ""} {
+    untested ${testfile}.exp
+    return -1
+}
+
+clean_restart ${executable}
+
+gdb_test_no_output "set breakpoint pending off"
+
+gdb_test "break 'C::f()'" {Breakpoint [0-9]+ at 0x[0-9a-f]+}
--- /dev/null
+++ b/gdb/testsuite/gdb.cp/minsym-fallback.h
@@ -0,0 +1,22 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+   Copyright 2011 Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+class C
+{
+public:
+  static void f ();
+};


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [patch 1/2] physname reg.: linespec minsym fallback
  2011-06-05 20:27 [patch 1/2] physname reg.: linespec minsym fallback Jan Kratochvil
@ 2011-06-07 20:56 ` Tom Tromey
  2011-06-08 15:04   ` Jan Kratochvil
  2011-07-01 20:21 ` [commit] " Jan Kratochvil
  1 sibling, 1 reply; 7+ messages in thread
From: Tom Tromey @ 2011-06-07 20:56 UTC (permalink / raw)
  To: Jan Kratochvil; +Cc: gdb-patches

>>>>> "Jan" == Jan Kratochvil <jan.kratochvil@redhat.com> writes:

Jan> 2011-06-05  Jan Kratochvil  <jan.kratochvil@redhat.com>
Jan> 	Fall back linespec to minimal symbols.
Jan> 	* linespec.c (decode_line_1): New variable ex, saved_argptr.  Protect
Jan> 	decode_compound by TRY_CATCH, fall back on minsyms if it failed.
Jan> 	(find_method, symbol_found): Change error to cplusplus_error.

This looks like it will conflict with one of Keith's patches, which
touches the same code.  I think we should review those first, just on
the grounds that they have been in development longer and were submitted
first.

Tom


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [patch 1/2] physname reg.: linespec minsym fallback
  2011-06-07 20:56 ` Tom Tromey
@ 2011-06-08 15:04   ` Jan Kratochvil
  0 siblings, 0 replies; 7+ messages in thread
From: Jan Kratochvil @ 2011-06-08 15:04 UTC (permalink / raw)
  To: Tom Tromey; +Cc: gdb-patches

On Tue, 07 Jun 2011 22:30:24 +0200, Tom Tromey wrote:
> This looks like it will conflict with one of Keith's patches, which
> touches the same code.

It does not, it merges cleanly.  I was touching code outside of
decode_compound while Keith the code of decode_compound.

(There is a very simple conflict with my patch "Follow DW_AT_linkage_name for
methods" but I do not think it is worth of any talk about it.)


Thanks,
Jan


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [commit] Re: [patch 1/2] physname reg.: linespec minsym fallback
  2011-06-05 20:27 [patch 1/2] physname reg.: linespec minsym fallback Jan Kratochvil
  2011-06-07 20:56 ` Tom Tromey
@ 2011-07-01 20:21 ` Jan Kratochvil
  2011-07-04 14:08   ` Ulrich Weigand
  1 sibling, 1 reply; 7+ messages in thread
From: Jan Kratochvil @ 2011-07-01 20:21 UTC (permalink / raw)
  To: gdb-patches

Hi,

checked in.


Thanks,
Jan


http://sourceware.org/ml/gdb-cvs/2011-07/msg00029.html

--- src/gdb/ChangeLog	2011/07/01 19:19:13	1.13151
+++ src/gdb/ChangeLog	2011/07/01 20:16:38	1.13152
@@ -1,5 +1,12 @@
 2011-07-01  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-01  Jan Kratochvil  <jan.kratochvil@redhat.com>
+
 	* symtab.c (symbol_find_demangled_name): Remove DMGL_VERBOSE.
 
 2011-07-01  Jan Kratochvil  <jan.kratochvil@redhat.com>
--- src/gdb/testsuite/ChangeLog	2011/07/01 19:18:36	1.2774
+++ src/gdb/testsuite/ChangeLog	2011/07/01 20:16:38	1.2775
@@ -1,5 +1,16 @@
 2011-07-01  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-01  Jan Kratochvil  <jan.kratochvil@redhat.com>
+
 	* gdb.cp/no-dmgl-verbose.cc: New file.
 	* gdb.cp/no-dmgl-verbose.exp: New file.
 
--- src/gdb/linespec.c	2011/05/31 22:13:51	1.122
+++ src/gdb/linespec.c	2011/07/01 20:16:38	1.123
@@ -933,35 +933,51 @@
       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 (ex.reason >= 0)
+	    return values;
+
+	  if (ex.error != NOT_FOUND_ERROR)
+	    throw_exception (ex);
+
+	  *argptr = saved_argptr;
 	}
+      else
+	{
+	  /* 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 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);
+	  /* 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);
+	    }
 	}
     }
 
@@ -1798,9 +1814,9 @@
 		}
 	    }
 
-	  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);
@@ -2208,7 +2224,12 @@
 	  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.  */
--- src/gdb/testsuite/gdb.base/psymtab.exp	2011/01/01 15:33:42	1.12
+++ src/gdb/testsuite/gdb.base/psymtab.exp	2011/07/01 20:16:38	1.13
@@ -71,4 +71,4 @@
 # 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."
--- src/gdb/testsuite/gdb.cp/minsym-fallback-main.cc
+++ src/gdb/testsuite/gdb.cp/minsym-fallback-main.cc	2011-07-01 20:19:16.961654000 +0000
@@ -0,0 +1,26 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+   Copyright 2011 Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+#include "minsym-fallback.h"
+
+C c;
+
+int
+main ()
+{
+  c.f ();
+}
--- src/gdb/testsuite/gdb.cp/minsym-fallback.cc
+++ src/gdb/testsuite/gdb.cp/minsym-fallback.cc	2011-07-01 20:19:17.298867000 +0000
@@ -0,0 +1,23 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+   Copyright 2011 Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+#include "minsym-fallback.h"
+
+void
+C::f ()
+{
+}
--- src/gdb/testsuite/gdb.cp/minsym-fallback.exp
+++ src/gdb/testsuite/gdb.cp/minsym-fallback.exp	2011-07-01 20:19:17.664768000 +0000
@@ -0,0 +1,38 @@
+# Copyright (C) 2011 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# The goal is to have class with full DWARF symbols present in one file having
+# only a declaration there for the method.  The method is then defined in
+# a different file providing only ELF symbols.
+
+set testfile minsym-fallback
+set srcfile ${testfile}.cc
+set srcmainfile ${testfile}-main.cc
+set executable $testfile
+set objfile $objdir/$subdir/${testfile}.o
+set objmainfile $objdir/$subdir/${testfile}-main.o
+set binfile $objdir/$subdir/$executable
+if {[gdb_compile $srcdir/$subdir/$srcfile $objfile object {}] != ""
+    || [gdb_compile $srcdir/$subdir/$srcmainfile $objmainfile object {debug}] != ""
+    || [gdb_compile "$objfile $objmainfile" $binfile executable {}] != ""} {
+    untested ${testfile}.exp
+    return -1
+}
+
+clean_restart ${executable}
+
+gdb_test_no_output "set breakpoint pending off"
+
+gdb_test "break 'C::f()'" {Breakpoint [0-9]+ at 0x[0-9a-f]+}
--- src/gdb/testsuite/gdb.cp/minsym-fallback.h
+++ src/gdb/testsuite/gdb.cp/minsym-fallback.h	2011-07-01 20:19:17.955661000 +0000
@@ -0,0 +1,22 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+   Copyright 2011 Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+class C
+{
+public:
+  static void f ();
+};
--- src/gdb/testsuite/gdb.cp/cplusfuncs.exp	2011/01/01 15:33:43	1.15
+++ src/gdb/testsuite/gdb.cp/cplusfuncs.exp	2011/07/01 20:16:39	1.16
@@ -616,7 +616,7 @@
 
     # 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


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [commit] Re: [patch 1/2] physname reg.: linespec minsym fallback
  2011-07-01 20:21 ` [commit] " Jan Kratochvil
@ 2011-07-04 14:08   ` Ulrich Weigand
  2011-07-04 16:22     ` [commit#2+7.3] " Jan Kratochvil
  0 siblings, 1 reply; 7+ messages in thread
From: Ulrich Weigand @ 2011-07-04 14:08 UTC (permalink / raw)
  To: Jan Kratochvil; +Cc: gdb-patches

Jan Kratochvil wrote:

>  2011-07-01  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.

On some machines (RHEL 5.6 with GCC 4.1.2 system compiler) I'm now seeing:

cc1: warnings being treated as errors
/home/kwerner/dailybuild/spu-tc-2011-07-04/gdb-head/src/gdb/linespec.c: In function 'decode_line_1':
/home/kwerner/dailybuild/spu-tc-2011-07-04/gdb-head/src/gdb/linespec.c:928: warning: 'values.nelts' may be used uninitialized in this function
/home/kwerner/dailybuild/spu-tc-2011-07-04/gdb-head/src/gdb/linespec.c:928: warning: 'values.sals' may be used uninitialized in this function

Should there be an initializer somewhere?

Bye,
Ulrich

-- 
  Dr. Ulrich Weigand
  GNU Toolchain for Linux on System z and Cell BE
  Ulrich.Weigand@de.ibm.com


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [commit#2+7.3] Re: [patch 1/2] physname reg.: linespec minsym fallback
  2011-07-04 14:08   ` Ulrich Weigand
@ 2011-07-04 16:22     ` Jan Kratochvil
  2011-07-04 16:35       ` Ulrich Weigand
  0 siblings, 1 reply; 7+ messages in thread
From: Jan Kratochvil @ 2011-07-04 16:22 UTC (permalink / raw)
  To: Ulrich Weigand; +Cc: gdb-patches

On Mon, 04 Jul 2011 15:13:57 +0200, Ulrich Weigand wrote:
> On some machines (RHEL 5.6 with GCC 4.1.2 system compiler) I'm now seeing:
> 
> cc1: warnings being treated as errors
> /home/kwerner/dailybuild/spu-tc-2011-07-04/gdb-head/src/gdb/linespec.c: In function 'decode_line_1':
> /home/kwerner/dailybuild/spu-tc-2011-07-04/gdb-head/src/gdb/linespec.c:928: warning: 'values.nelts' may be used uninitialized in this function
> /home/kwerner/dailybuild/spu-tc-2011-07-04/gdb-head/src/gdb/linespec.c:928: warning: 'values.sals' may be used uninitialized in this function
> 
> Should there be an initializer somewhere?

This false GCC warning I have seen when TRY_CATCH is in use like in this case.

Curiously I failed to reproduce this warning on gcc-4.1.2-50.el5.x86_64.

Anyway checked in HEAD (below) and in 7.3:
	http://sourceware.org/ml/gdb-cvs/2011-07/msg00055.html


Thanks,
Jan


http://sourceware.org/ml/gdb-cvs/2011-07/msg00054.html

--- src/gdb/ChangeLog	2011/07/01 20:27:58	1.13154
+++ src/gdb/ChangeLog	2011/07/04 14:16:13	1.13155
@@ -1,3 +1,8 @@
+2011-07-04  Jan Kratochvil  <jan.kratochvil@redhat.com>
+
+	Fix false GCC warning.
+	* linespec.c (decode_line_1): Initialize values.
+
 2011-07-01  Jan Kratochvil  <jan.kratochvil@redhat.com>
 
 	* linespec.c (find_method): Accept the function type automatically only
--- src/gdb/linespec.c	2011/07/01 20:27:58	1.125
+++ src/gdb/linespec.c	2011/07/04 14:16:14	1.126
@@ -932,6 +932,9 @@
 	  if (is_quote_enclosed)
 	    ++saved_arg;
 
+	  /* Initialize it just to avoid a GCC false warning.  */
+	  memset (&values, 0, sizeof (values));
+
 	  TRY_CATCH (ex, RETURN_MASK_ERROR)
 	    {
 	      values = decode_compound (argptr, funfirstline, canonical,


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [commit#2+7.3] Re: [patch 1/2] physname reg.: linespec minsym fallback
  2011-07-04 16:22     ` [commit#2+7.3] " Jan Kratochvil
@ 2011-07-04 16:35       ` Ulrich Weigand
  0 siblings, 0 replies; 7+ messages in thread
From: Ulrich Weigand @ 2011-07-04 16:35 UTC (permalink / raw)
  To: Jan Kratochvil; +Cc: gdb-patches

Jan Kratochvil wrote:
> On Mon, 04 Jul 2011 15:13:57 +0200, Ulrich Weigand wrote:
> > On some machines (RHEL 5.6 with GCC 4.1.2 system compiler) I'm now seeing:
> > 
> > cc1: warnings being treated as errors
> > /home/kwerner/dailybuild/spu-tc-2011-07-04/gdb-head/src/gdb/linespec.c: In function 'decode_line_1':
> > /home/kwerner/dailybuild/spu-tc-2011-07-04/gdb-head/src/gdb/linespec.c:928: warning: 'values.nelts' may be used uninitialized in this function
> > /home/kwerner/dailybuild/spu-tc-2011-07-04/gdb-head/src/gdb/linespec.c:928: warning: 'values.sals' may be used uninitialized in this function
> > 
> > Should there be an initializer somewhere?
> 
> This false GCC warning I have seen when TRY_CATCH is in use like in this case.
> 
> Curiously I failed to reproduce this warning on gcc-4.1.2-50.el5.x86_64.

Huh, that's strange.  I'm running on a ppc64 host if that makes
any difference ...

> Anyway checked in HEAD (below) and in 7.3:
> 	http://sourceware.org/ml/gdb-cvs/2011-07/msg00055.html

Great, thanks for the quick fix!

Bye,
Ulrich

-- 
  Dr. Ulrich Weigand
  GNU Toolchain for Linux on System z and Cell BE
  Ulrich.Weigand@de.ibm.com


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2011-07-04 16:22 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-06-05 20:27 [patch 1/2] physname reg.: linespec minsym fallback Jan Kratochvil
2011-06-07 20:56 ` Tom Tromey
2011-06-08 15:04   ` Jan Kratochvil
2011-07-01 20:21 ` [commit] " Jan Kratochvil
2011-07-04 14:08   ` Ulrich Weigand
2011-07-04 16:22     ` [commit#2+7.3] " Jan Kratochvil
2011-07-04 16:35       ` Ulrich Weigand

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox