This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[RFA] PR 11530: Fix and test case
- From: "Pierre Muller" <pierre dot muller at ics-cnrs dot unistra dot fr>
- To: <gdb-patches at sourceware dot org>
- Date: Thu, 29 Apr 2010 23:50:15 +0200
- Subject: [RFA] PR 11530: Fix and test case
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"
+