This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [patch] Testsuite: Fortran: 6.8 regression + gfortran updates
- From: Jan Kratochvil <jan dot kratochvil at redhat dot com>
- To: Joel Brobecker <brobecker at adacore dot com>
- Cc: gdb-patches at sourceware dot org, Markus Deuling <deuling at de dot ibm dot com>
- Date: Wed, 7 Jan 2009 08:37:54 +0100
- Subject: Re: [patch] Testsuite: Fortran: 6.8 regression + gfortran updates
- References: <20081208181523.GA23831@host0.dyn.jankratochvil.net> <20081229034845.GF4216@adacore.com> <20090106140516.GA16916@host0.dyn.jankratochvil.net> <20090107051404.GI3664@adacore.com>
On Wed, 07 Jan 2009 06:14:04 +0100, Joel Brobecker wrote:
> > gdb/
> > 2009-01-06 Jan Kratochvil <jan.kratochvil@redhat.com>
> >
> > * f-typeprint.c (f_type_print_base <TYPE_CODE_STRUCT>): Fix output
> > spacing, a regression from 2008-04-22.
>
> I am not sure about this part - the use of the "indented" printf seems
> to be pretty deliberate, and we find this use elsewhere for the other
> kinds of types. Looks like Fortran developers like indented type names?
I agree the indentation in general is correct. But it is done there twice now
- both before and after the `::' delimiter. Indentation should happen only at
the column 1. For `a' variable level == 0 but for `c' and `d' level == 4:
(gdb) ptype q
type = Type foo
real(kind=4) :: a
^^^^ is right. ^ is not seen as it got indented by 0 characters.
Type bar
integer(kind=4) :: c
^^^^^^^^ is right. ^^^^ is excessive.
real(kind=4) :: d
case TYPE_CODE_STRUCT:
case TYPE_CODE_UNION:
if (TYPE_CODE (type) == TYPE_CODE_UNION)
fprintfi_filtered (level, stream, "Type, C_Union :: ");
else
fprintfi_filtered (level, stream, "Type ");
fputs_filtered (TYPE_TAG_NAME (type), stream);
fputs_filtered ("\n", stream);
for (index = 0; index < TYPE_NFIELDS (type); index++)
{
f_type_print_base (TYPE_FIELD_TYPE (type, index), stream, show,
level + 4);
^^^ This indentation is correct.
fputs_filtered (" :: ", stream);
fprintfi_filtered (level, stream, "%s",
TYPE_FIELD_NAME (type, index));
^^^ But this indentation is excessive.
f_type_print_varspec_suffix (TYPE_FIELD_TYPE (type, index),
stream, 0, 0, 0);
fputs_filtered ("\n", stream);
}
The secondary indentation can be seen introduced by the Markus D.'s change:
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/f-typeprint.c.diff?cvsroot=src&r1=1.22&r2=1.23
> This, in turn, conditions the changes to the testsuite, but it should
> only be minimal.
It affects only:
FAIL: gdb.fortran/derived-type.exp: type-printing for derived type
Otherwise added there a comment above `set int4'.
Thanks,
Jan
gdb/
2009-01-07 Jan Kratochvil <jan.kratochvil@redhat.com>
* f-typeprint.c (f_type_print_base <TYPE_CODE_STRUCT>): Fix output
spacing, a regression from 2008-04-22.
gdb/testsuite/
2009-01-07 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.fortran/derived-type.exp: New variables int4 and real4. Match
now the output exactly, using less wildcards. Expect also the output
of gfortran-4.3. Update for the f-valprint.c modification from
2008-04-22.
* gdb.fortran/subarray.exp: Expect also the output of gfortran-4.3.
Remove gdb_test test names where matching the command.
--- gdb/f-typeprint.c 3 Jan 2009 05:57:51 -0000 1.25
+++ gdb/f-typeprint.c 7 Jan 2009 07:34:04 -0000
@@ -359,8 +359,7 @@ f_type_print_base (struct type *type, st
f_type_print_base (TYPE_FIELD_TYPE (type, index), stream, show,
level + 4);
fputs_filtered (" :: ", stream);
- fprintfi_filtered (level, stream, "%s",
- TYPE_FIELD_NAME (type, index));
+ fputs_filtered (TYPE_FIELD_NAME (type, index), stream);
f_type_print_varspec_suffix (TYPE_FIELD_TYPE (type, index),
stream, 0, 0, 0);
fputs_filtered ("\n", stream);
--- gdb/testsuite/gdb.fortran/derived-type.exp 3 Jan 2009 05:58:04 -0000 1.7
+++ gdb/testsuite/gdb.fortran/derived-type.exp 7 Jan 2009 07:34:06 -0000
@@ -41,24 +41,56 @@ if ![runto MAIN__] then {
continue
}
-gdb_test "ptype p" \
- "type = Type bar.*int4.*\:\: c.*real.*\:\: d.*End Type bar" \
- "ptype p"
-gdb_test "ptype q" \
- "type = Type foo.*real.*\:\: a.*Type bar.*int4.*\:\: c.*real.*\:\: d.*End Type bar \:\: x.*character.*\\(7\\) \:\: b.*End Type foo" \
- "type-printing for derived type"
+# (gfortran-4.1|gfortran-4.3). Other Fortran compilers would need other
+# expect-strings.
+set int4 "(int4|integer\\(kind=4\\))"
+set real4 "(real4|real\\(kind=4\\))"
+
+gdb_test "ptype p" "type = Type bar\r\n *${int4} :: c\r\n *${real4} :: d\r\n *End Type bar"
+
+set test "type-printing for derived type"
+gdb_test_multiple "ptype q" $test {
+ -re "type = Type foo\r\n *${real4} :: a\r\n *Type bar\r\n *${int4} :: c\r\n *${real4} :: d\r\n *End Type bar :: x\r\n *character\\*7 :: b\r\n *End Type foo\r\n$gdb_prompt $" {
+ pass $test
+ }
+ -re "type = Type foo\r\n *${real4} :: a\r\n *Type bar\r\n *${int4} :: c\r\n *${real4} :: d\r\n *End Type bar :: x\r\n *character :: b\\(7\\)\r\n *End Type foo\r\n$gdb_prompt $" {
+ # Compiler should produce string, not an array of characters.
+ setup_xfail "*-*-*"
+ fail $test
+ }
+}
gdb_breakpoint [gdb_get_line_number "print"]
gdb_continue_to_breakpoint "print"
-gdb_test "print p" "\\$\[0-9\]+ = \\{ 1, 2.375\\}"
+gdb_test "print p" "\\$\[0-9\]+ = \\( 1, 2\\.375 \\)"
gdb_test "print p%c" "\\$\[0-9\]+ = 1"
-gdb_test "print p%d" "\\$\[0-9\]+ = 2.375"
-gdb_test "print q%a" "\\$\[0-9\]+ = 3.125"
-gdb_test "print q%b" "\\$\[0-9\]+ = \\(.*a.*b.*c.*d.*e.*f.*g.*\\)"
+gdb_test "print p%d" "\\$\[0-9\]+ = 2\\.375"
+gdb_test "print q%a" "\\$\[0-9\]+ = 3\\.125"
+
+set test "print q%b"
+gdb_test_multiple $test $test {
+ -re "\\$\[0-9\]+ = 'abcdefg'\r\n$gdb_prompt $" {
+ pass $test
+ }
+ -re "\\$\[0-9\]+ = \\(97 'a', 98 'b', 99 'c', 100 'd', 101 'e', 102 'f', 103 'g'\\)\r\n$gdb_prompt $" {
+ # Compiler should produce string, not an array of characters.
+ setup_xfail "*-*-*"
+ fail $test
+ }
+}
+
gdb_test "print q%x%c" "\\$\[0-9\]+ = 1"
-gdb_test "print q%x%d" "\\$\[0-9\]+ = 2.375"
-gdb_test "print q" \
- "\\$\[0-9\]+ = \\{ 3.125, \\{ 1, 2.375\\}, \\(.*a.*b.*c.*d.*e.*f.*g.*\\)\\}" \
- "print q"
+gdb_test "print q%x%d" "\\$\[0-9\]+ = 2\\.375"
+set test "print q"
+gdb_test_multiple $test $test {
+ -re "\\$\[0-9\]+ = \\( 3.125, \\( 1, 2\\.375 \\), 'abcdefg' \\)\r\n$gdb_prompt $" {
+ pass $test
+ }
+ -re "\\$\[0-9\]+ = \\( 3.125, \\( 1, 2\\.375 \\), \\(97 'a', 98 'b', 99 'c', 100 'd', 101 'e', 102 'f', 103 'g'\\) \\)\r\n$gdb_prompt $" {
+ # Compiler should produce string, not an array of characters.
+ setup_xfail "*-*-*"
+ fail $test
+ }
+}
--- gdb/testsuite/gdb.fortran/subarray.exp 3 Jan 2009 05:58:04 -0000 1.7
+++ gdb/testsuite/gdb.fortran/subarray.exp 7 Jan 2009 07:34:06 -0000
@@ -53,13 +53,56 @@ gdb_test "continue" \
# Test four different kinds of subarray expression evaluation.
-gdb_test "print str(2:4)" ".*1 = \\(98 'b', 99 'c', 100 'd'\\).*" "print str(2:4)"
-gdb_test "print str(:3)" ".*2 = \\(97 'a', 98 'b', 99 'c'\\).*" "print str(:3)"
-gdb_test "print str(5:)" ".*3 = \\(101 'e', 102 'f', 103 'g'\\).*" "print str(5:)"
-gdb_test "print str(:)" ".*4 = \\(97 'a', 98 'b', 99 'c', 100 'd', 101 'e', 102 'f', 103 'g'\\).*" "print str(:)"
+set test "print str(2:4)"
+gdb_test_multiple $test $test {
+ -re "\\$\[0-9\]+ = 'bcd'\r\n$gdb_prompt $" {
+ pass $test
+ }
+ -re "\\$\[0-9\]+ = \\(98 'b', 99 'c', 100 'd'\\)\r\n$gdb_prompt $" {
+ # Compiler should produce string, not an array of characters.
+ setup_xfail "*-*-*"
+ fail $test
+ }
+}
-gdb_test "print array(2:4)" ".*5 = \\(2, 3, 4\\).*" "print array(2:4)"
-gdb_test "print array(:3)" ".*6 = \\(1, 2, 3\\).*" "print array(:3)"
-gdb_test "print array(5:)" ".*7 = \\(5, 6, 7\\).*" "print array(5:)"
-gdb_test "print array(:)" ".*8 = \\(1, 2, 3, 4, 5, 6, 7\\).*" "print array(:)"
+set test "print str(:3)"
+gdb_test_multiple $test $test {
+ -re "\\$\[0-9\]+ = 'abc'\r\n$gdb_prompt $" {
+ pass $test
+ }
+ -re "\\$\[0-9\]+ = \\(97 'a', 98 'b', 99 'c'\\)\r\n$gdb_prompt $" {
+ # Compiler should produce string, not an array of characters.
+ setup_xfail "*-*-*"
+ fail $test
+ }
+}
+
+set test "print str(5:)"
+gdb_test_multiple $test $test {
+ -re "\\$\[0-9\]+ = 'efg'\r\n$gdb_prompt $" {
+ pass $test
+ }
+ -re "\\$\[0-9\]+ = \\(101 'e', 102 'f', 103 'g'\\)\r\n$gdb_prompt $" {
+ # Compiler should produce string, not an array of characters.
+ setup_xfail "*-*-*"
+ fail $test
+ }
+}
+
+set test "print str(:)"
+gdb_test_multiple $test $test {
+ -re "\\$\[0-9\]+ = 'abcdefg'\r\n$gdb_prompt $" {
+ pass $test
+ }
+ -re "\\$\[0-9\]+ = \\(97 'a', 98 'b', 99 'c', 100 'd', 101 'e', 102 'f', 103 'g'\\)\r\n$gdb_prompt $" {
+ # Compiler should produce string, not an array of characters.
+ setup_xfail "*-*-*"
+ fail $test
+ }
+}
+
+gdb_test "print array(2:4)" "\\$\[0-9\]+ = \\(2, 3, 4\\)"
+gdb_test "print array(:3)" "\\$\[0-9\]+ = \\(1, 2, 3\\)"
+gdb_test "print array(5:)" "\\$\[0-9\]+ = \\(5, 6, 7\\)"
+gdb_test "print array(:)" "\\$\[0-9\]+ = \\(1, 2, 3, 4, 5, 6, 7\\)"