* Re: [RFA] PR 11530: Fix and test case
[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>
0 siblings, 2 replies; 6+ messages in thread
From: Tom Tromey @ 2010-04-30 17:26 UTC (permalink / raw)
To: Pierre Muller; +Cc: gdb-patches
>>>>> "Pierre" == Pierre Muller <pierre.muller@ics-cnrs.unistra.fr> writes:
Pierre> This is a problem reported by Jan Kratochvil
Pierre> http://sourceware.org/bugzilla/show_bug.cgi?id=11530
Thanks for working on this.
Pierre> +struct a
Pierre> + {
Pierre> + union
Pierre> + {
Pierre> + int i;
Pierre> + };
Pierre> + } a;
Since this is a C extension, I think that the test cases should probably
be dependent on using GCC.
Tom
^ permalink raw reply [flat|nested] 6+ messages in thread
* RE: [RFA] PR 11530: Fix and test case
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>
1 sibling, 0 replies; 6+ messages in thread
From: Pierre Muller @ 2010-05-05 22:11 UTC (permalink / raw)
To: tromey; +Cc: gdb-patches
> Pierre> +struct a
> Pierre> + {
> Pierre> + union
> Pierre> + {
> Pierre> + int i;
> Pierre> + };
> Pierre> + } a;
>
> Since this is a C extension, I think that the test cases should
> probably
> be dependent on using GCC.
I have no idea how to do this....
After lokking into several testsuite exp files:
If the compiler is not gcc we should skip the test,
is that what you want?
if {![test_compiler_info gcc-*]} {
return 0
}
Would this fit?
Pierre
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [RFA] PR 11530: Fix and test case
[not found] ` <1723.54181199825$1273097500@news.gmane.org>
@ 2010-05-07 17:45 ` Tom Tromey
2010-05-08 15:33 ` [RFA-v2] " Pierre Muller
0 siblings, 1 reply; 6+ messages in thread
From: Tom Tromey @ 2010-05-07 17:45 UTC (permalink / raw)
To: Pierre Muller; +Cc: gdb-patches
>>>>> "Pierre" == Pierre Muller <pierre.muller@ics-cnrs.unistra.fr> writes:
Pierre> If the compiler is not gcc we should skip the test,
Pierre> is that what you want?
Pierre> if {![test_compiler_info gcc-*]} {
Pierre> return 0
Pierre> }
Pierre> Would this fit?
Yes, thanks.
Tom
^ permalink raw reply [flat|nested] 6+ messages in thread
* [RFA-v2] PR 11530: Fix and test case
2010-05-07 17:45 ` Tom Tromey
@ 2010-05-08 15:33 ` Pierre Muller
2010-05-11 16:57 ` Tom Tromey
0 siblings, 1 reply; 6+ messages in thread
From: Pierre Muller @ 2010-05-08 15:33 UTC (permalink / raw)
To: tromey; +Cc: gdb-patches
> -----Message d'origine-----
> De : gdb-patches-owner@sourceware.org [mailto:gdb-patches-
> owner@sourceware.org] De la part de Tom Tromey
> Envoyé : Friday, May 07, 2010 7:46 PM
> À : Pierre Muller
> Cc : gdb-patches@sourceware.org
> Objet : Re: [RFA] PR 11530: Fix and test case
>
> >>>>> "Pierre" == Pierre Muller <pierre.muller@ics-cnrs.unistra.fr>
> writes:
>
> Pierre> If the compiler is not gcc we should skip the test,
> Pierre> is that what you want?
>
> Pierre> if {![test_compiler_info gcc-*]} {
> Pierre> return 0
> Pierre> }
>
> Pierre> Would this fit?
>
> Yes, thanks.
It turned out that test_compiler_info needs
a call to get_compiler_info before otherwise
it returns unknown...
Here is a new version of the patch.
Tested on gcc16, adds 3 PASS (while current CVS
gives two failures on gdb11530.exp test).
Pierre
2010-05-08 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-05-08 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: gdbtypes.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbtypes.c,v
retrieving revision 1.190
diff -u -p -r1.190 gdbtypes.c
--- gdbtypes.c 6 May 2010 19:41:12 -0000 1.190
+++ gdbtypes.c 8 May 2010 14:01:26 -0000
@@ -1244,6 +1244,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: 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
+++ testsuite/gdb.base/gdb11530.c 8 May 2010 14:01:26 -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: 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
+++ testsuite/gdb.base/gdb11530.exp 8 May 2010 14:01:26 -0000
@@ -0,0 +1,55 @@
+# 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 11530.
+# This is a problem related unnamed unions.
+
+if $tracelevel then {
+ strace $tracelevel
+}
+
+set prms_id 0
+set bug_id 0
+
+set testfile "gdb11530"
+set binfile ${testfile}${EXEEXT}
+
+# Unnamed union is a GNU extension, thus we restrict the test
+# to gcc compiler.
+
+if [get_compiler_info ${binfile}] {
+ return -1;
+}
+
+if { ![test_compiler_info gcc*] } {
+ return 0;
+}
+
+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] 6+ messages in thread
* Re: [RFA-v2] PR 11530: Fix and test case
2010-05-08 15:33 ` [RFA-v2] " Pierre Muller
@ 2010-05-11 16:57 ` Tom Tromey
2010-05-11 22:05 ` Pierre Muller
0 siblings, 1 reply; 6+ messages in thread
From: Tom Tromey @ 2010-05-11 16:57 UTC (permalink / raw)
To: Pierre Muller; +Cc: gdb-patches
>>>>> "Pierre" == Pierre Muller <pierre.muller@ics-cnrs.unistra.fr> writes:
Pierre> Here is a new version of the patch.
Pierre> Tested on gcc16, adds 3 PASS (while current CVS
Pierre> gives two failures on gdb11530.exp test).
Pierre> 2010-05-08 Pierre Muller <muller@ics.u-strasbg.fr>
Pierre> PR exp/11530.
Pierre> * gdbtypes.c (lookup_struct_elt_type): Also lookup
Pierre> names of unnamed structures or unions.
Pierre> 2010-05-08 Pierre Muller <muller@ics.u-strasbg.fr>
Pierre> PR exp/11530.
Pierre> * testsuite/gdb.base/gdb11530.c: New file.
Pierre> * testsuite/gdb.base/gdb11530.exp: New file.
This is ok, thanks.
Tom
^ permalink raw reply [flat|nested] 6+ messages in thread
* RE: [RFA-v2] PR 11530: Fix and test case
2010-05-11 16:57 ` Tom Tromey
@ 2010-05-11 22:05 ` Pierre Muller
0 siblings, 0 replies; 6+ messages in thread
From: Pierre Muller @ 2010-05-11 22:05 UTC (permalink / raw)
To: 'Tom Tromey'; +Cc: gdb-patches
> -----Message d'origine-----
> De : gdb-patches-owner@sourceware.org [mailto:gdb-patches-
> owner@sourceware.org] De la part de Tom Tromey
> Envoyé : Tuesday, May 11, 2010 6:57 PM
> À : Pierre Muller
> Cc : gdb-patches@sourceware.org
> Objet : Re: [RFA-v2] PR 11530: Fix and test case
>
> >>>>> "Pierre" == Pierre Muller <pierre.muller@ics-cnrs.unistra.fr>
> writes:
>
> Pierre> Here is a new version of the patch.
> Pierre> Tested on gcc16, adds 3 PASS (while current CVS
> Pierre> gives two failures on gdb11530.exp test).
>
> Pierre> 2010-05-08 Pierre Muller <muller@ics.u-strasbg.fr>
>
> Pierre> PR exp/11530.
> Pierre> * gdbtypes.c (lookup_struct_elt_type): Also lookup
> Pierre> names of unnamed structures or unions.
>
> Pierre> 2010-05-08 Pierre Muller <muller@ics.u-strasbg.fr>
>
> Pierre> PR exp/11530.
> Pierre> * testsuite/gdb.base/gdb11530.c: New file.
> Pierre> * testsuite/gdb.base/gdb11530.exp: New file.
>
> This is ok, thanks.
Thanks for the review and approval,
patch committed.
Pierre Muller
Pascal language support maintainer for GDB
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2010-05-11 22:05 UTC | newest]
Thread overview: 6+ 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
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox