Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [RFA] PR 11530: Fix and test case
@ 2010-04-29 21:50 Pierre Muller
  2010-04-30  8:20 ` Jan Kratochvil
  0 siblings, 1 reply; 13+ messages in thread
From: Pierre Muller @ 2010-04-29 21:50 UTC (permalink / raw)
  To: gdb-patches

 This is a problem reported by Jan Kratochvil
http://sourceware.org/bugzilla/show_bug.cgi?id=11530

  After some debugging, I found this fix,
and wrote a test case.
  Tested on gcc16 2 FAIL within gdb11530.exp
with pristine disappear with patched versions.
  No other change (apart from the tests
that are unstable, like:
ext-run.exp (I often get an 'internal buffer is full' error
for that test)
attach-into-signal.exp
and watchthreads2.exp

Is this patch OK?

Pierre Muller
Pascal language support maintainer for GDB

 
2010-04-29  Pierre Muller  <muller@ics.u-strasbg.fr>

	PR exp/11530.
	* gdbtypes.c (lookup_struct_elt_type): Also lookup
	names of unnamed structures or unions.

testsuite ChangeLog entry:

2010-04-29  Pierre Muller  <muller@ics.u-strasbg.fr>

	PR exp/11530.
	* testsuite/gdb.base/gdb11530.c: New file.
	* testsuite/gdb.base/gdb11530.exp: New file.


Index: src/gdb/gdbtypes.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbtypes.c,v
retrieving revision 1.189
diff -u -p -r1.189 gdbtypes.c
--- src/gdb/gdbtypes.c	21 Apr 2010 23:21:03 -0000	1.189
+++ src/gdb/gdbtypes.c	29 Apr 2010 21:23:35 -0000
@@ -1246,6 +1246,13 @@ lookup_struct_elt_type (struct type *typ
 	{
 	  return TYPE_FIELD_TYPE (type, i);
 	}
+      else if (!t_field_name || *t_field_name == '\0')
+	{
+	  struct type *subtype = lookup_struct_elt_type (
+				   TYPE_FIELD_TYPE (type, i), name, 1);
+	  if (subtype != NULL)
+	    return subtype;
+	}
     }
 
   /* OK, it's not in this class.  Recursively check the baseclasses.  */
Index: src/gdb/testsuite/gdb.base/gdb11530.c
===================================================================
RCS file: testsuite/gdb.base/gdb11530.c
diff -N testsuite/gdb.base/gdb11530.c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ src/gdb/testsuite/gdb.base/gdb11530.c	29 Apr 2010 21:23:37 -0000
@@ -0,0 +1,35 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+   Copyright 2010 Free Software Foundation, Inc.
+
+   Contributed by Pierre Muller.
+
+   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/>.
+
+   Test for problem related to unnamed unions.  */
+
+struct a
+  {
+    union
+      {
+        int i;
+      };
+  } a;
+
+int
+main (void)
+{
+  return sizeof (a.i);
+}
+
Index: src/gdb/testsuite/gdb.base/gdb11530.exp
===================================================================
RCS file: testsuite/gdb.base/gdb11530.exp
diff -N testsuite/gdb.base/gdb11530.exp
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ src/gdb/testsuite/gdb.base/gdb11530.exp	29 Apr 2010 21:23:37 -0000
@@ -0,0 +1,44 @@
+# This testcase is part of GDB, the GNU debugger.
+
+# Copyright 2010 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/>.
+
+# Test GDB bug report 11531.
+# This is a problem related to CANNOT_STEP_HW_WATCHPOINTS macro.
+# It affects Solaris native targets.
+
+if $tracelevel then {
+	strace $tracelevel
+}
+
+set prms_id 0
+set bug_id 0
+
+set testfile "gdb11530"
+
+if { [prepare_for_testing $testfile.exp $testfile $testfile.c {debug}] } {
+    return -1;
+}
+
+
+if { ![runto main] } then {
+    fail "run to main"
+    return
+}
+
+gdb_test "print a.i" " = 0"
+gdb_test "print sizeof (a.i)" " = \[0-9\]+"
+gdb_test "print sizeof (a.i) == sizeof (int)" " = 1"
+


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

end of thread, other threads:[~2010-05-11 22:05 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <36245.8778698512$1272577829@news.gmane.org>
2010-04-30 17:26 ` [RFA] PR 11530: Fix and test case Tom Tromey
2010-05-05 22:11   ` Pierre Muller
     [not found]   ` <1723.54181199825$1273097500@news.gmane.org>
2010-05-07 17:45     ` Tom Tromey
2010-05-08 15:33       ` [RFA-v2] " Pierre Muller
2010-05-11 16:57         ` Tom Tromey
2010-05-11 22:05           ` Pierre Muller
2010-04-29 21:50 [RFA] " Pierre Muller
2010-04-30  8:20 ` Jan Kratochvil
2010-04-30 11:08   ` Joseph S. Myers
2010-04-30 13:12   ` Pierre Muller
     [not found]   ` <15700.946111656$1272633144@news.gmane.org>
2010-04-30 17:29     ` Tom Tromey
2010-05-05 21:44       ` Pierre Muller
     [not found]       ` <28104.8831450336$1273095904@news.gmane.org>
2010-05-07 17:45         ` Tom Tromey

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