From: "Pierre Muller" <pierre.muller@ics-cnrs.unistra.fr>
To: <gdb-patches@sourceware.org>
Subject: [RFA] PR 11530: Fix and test case
Date: Thu, 29 Apr 2010 21:50:00 -0000 [thread overview]
Message-ID: <001b01cae7e5$f46d47d0$dd47d770$@muller@ics-cnrs.unistra.fr> (raw)
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"
+
next reply other threads:[~2010-04-29 21:50 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-04-29 21:50 Pierre Muller [this message]
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
[not found] <36245.8778698512$1272577829@news.gmane.org>
2010-04-30 17:26 ` Tom Tromey
2010-05-05 22:11 ` Pierre Muller
[not found] ` <1723.54181199825$1273097500@news.gmane.org>
2010-05-07 17:45 ` Tom Tromey
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='001b01cae7e5$f46d47d0$dd47d770$@muller@ics-cnrs.unistra.fr' \
--to=pierre.muller@ics-cnrs.unistra.fr \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox