summaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorJan Kratochvil <jan.kratochvil@redhat.com>2009-01-07 12:39:12 +0000
committerJan Kratochvil <jan.kratochvil@redhat.com>2009-01-07 12:39:12 +0000
commitdcc61fc257100b0742340b450af4f958b138673d (patch)
treee181944d349053f2a568a53ccb5a430c93af7424 /gdb
parentbefd85e74b156e716882e75fdbd68ec5b07db36a (diff)
downloadgdb-dcc61fc257100b0742340b450af4f958b138673d.tar.gz
gdb/
* f-typeprint.c (f_type_print_base <TYPE_CODE_STRUCT>): Fix output spacing, a regression from 2008-04-22. gdb/testsuite/ * 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.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog5
-rw-r--r--gdb/f-typeprint.c3
-rw-r--r--gdb/testsuite/ChangeLog9
-rw-r--r--gdb/testsuite/gdb.fortran/derived-type.exp61
-rw-r--r--gdb/testsuite/gdb.fortran/subarray.exp58
5 files changed, 112 insertions, 24 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index feea4fd535b..8daaae923cf 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@
+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.
+
2009-01-07 Joel Brobecker <brobecker@adacore.com>
* utils.c (gdb_print_host_address): Adjust implementation to
diff --git a/gdb/f-typeprint.c b/gdb/f-typeprint.c
index 419a8831c0f..f5c10ab342a 100644
--- a/gdb/f-typeprint.c
+++ b/gdb/f-typeprint.c
@@ -359,8 +359,7 @@ f_type_print_base (struct type *type, struct ui_file *stream, int show,
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);
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 3b9c4b459ef..c8266764330 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,12 @@
+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.
+
2009-01-01 Pedro Alves <pedro@codesourcery.com>
PR breakpoints/9681:
diff --git a/gdb/testsuite/gdb.fortran/derived-type.exp b/gdb/testsuite/gdb.fortran/derived-type.exp
index 86e4474a65d..47e68f2175c 100644
--- a/gdb/testsuite/gdb.fortran/derived-type.exp
+++ b/gdb/testsuite/gdb.fortran/derived-type.exp
@@ -41,24 +41,57 @@ 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"
+# Depending on the compiler version being used, the name of the 4-byte integer
+# and real types can be printed differently. For instance, gfortran-4.1 uses
+# "int4" whereas gfortran-4.3 uses "int(kind=4)".
+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
+ }
+}
diff --git a/gdb/testsuite/gdb.fortran/subarray.exp b/gdb/testsuite/gdb.fortran/subarray.exp
index a12a007aa26..b8ddf2660c6 100644
--- a/gdb/testsuite/gdb.fortran/subarray.exp
+++ b/gdb/testsuite/gdb.fortran/subarray.exp
@@ -53,13 +53,55 @@ 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
+ }
+}
+
+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
+ }
+}
-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(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\\)"