|
|
a8223e |
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
|
|
a8223e |
From: Kevin Buettner <kevinb@redhat.com>
|
|
|
a8223e |
Date: Mon, 24 May 2021 17:07:36 -0700
|
|
|
a8223e |
Subject: gdb-rhbz1964167-fortran-whitespace_array.patch
|
|
|
a8223e |
|
|
|
a8223e |
;; [fortran] Backport Andrew Burgess's commit which eliminates undesirable
|
|
|
a8223e |
;; whitespace when printing arrays.
|
|
|
a8223e |
|
|
|
a8223e |
gdb/fortran: Change whitespace when printing arrays
|
|
|
a8223e |
|
|
|
a8223e |
This commit makes the whitespace usage when printing Fortran arrays
|
|
|
a8223e |
more consistent, and more inline with how we print C arrays.
|
|
|
a8223e |
|
|
|
a8223e |
Currently a 2 dimensional Fotran array is printed like this, I find
|
|
|
a8223e |
the marked whitespace unpleasant:
|
|
|
a8223e |
|
|
|
a8223e |
(( 1, 2, 3) ( 4, 5, 6) )
|
|
|
a8223e |
^ ^ ^
|
|
|
a8223e |
|
|
|
a8223e |
After this commit the same array is printed like this:
|
|
|
a8223e |
|
|
|
a8223e |
((1, 2, 3) (4, 5, 6))
|
|
|
a8223e |
|
|
|
a8223e |
Which seems more inline with how we print C arrays, in the case of C
|
|
|
a8223e |
arrays we don't add extra whitespace before the first element.
|
|
|
a8223e |
|
|
|
a8223e |
gdb/ChangeLog:
|
|
|
a8223e |
|
|
|
a8223e |
* f-valprint.c (f77_print_array_1): Adjust printing of whitespace
|
|
|
a8223e |
for arrays.
|
|
|
a8223e |
|
|
|
a8223e |
gdb/testsuite/ChangeLog:
|
|
|
a8223e |
|
|
|
a8223e |
* gdb.fortran/array-slices.exp: Update expected results.
|
|
|
a8223e |
* gdb.fortran/class-allocatable-array.exp: Likewise.
|
|
|
a8223e |
* gdb.fortran/multi-dim.exp: Likewise.
|
|
|
a8223e |
* gdb.fortran/vla-type.exp: Likewise.
|
|
|
a8223e |
* gdb.mi/mi-vla-fortran.exp: Likewise.
|
|
|
a8223e |
|
|
|
a8223e |
diff --git a/gdb/f-valprint.c b/gdb/f-valprint.c
|
|
|
a8223e |
--- a/gdb/f-valprint.c
|
|
|
a8223e |
+++ b/gdb/f-valprint.c
|
|
|
a8223e |
@@ -137,14 +137,17 @@
|
|
|
a8223e |
(TYPE_TARGET_TYPE (type), value_contents_for_printing_const (val)
|
|
|
a8223e |
+ offs, addr + offs);
|
|
|
a8223e |
|
|
|
a8223e |
- fprintf_filtered (stream, "( ");
|
|
|
a8223e |
+ fprintf_filtered (stream, "(");
|
|
|
a8223e |
f77_print_array_1 (nss + 1, ndimensions, value_type (subarray),
|
|
|
a8223e |
value_contents_for_printing (subarray),
|
|
|
a8223e |
value_embedded_offset (subarray),
|
|
|
a8223e |
value_address (subarray),
|
|
|
a8223e |
stream, recurse, subarray, options, elts);
|
|
|
a8223e |
offs += byte_stride;
|
|
|
a8223e |
- fprintf_filtered (stream, ") ");
|
|
|
a8223e |
+ fprintf_filtered (stream, ")");
|
|
|
a8223e |
+
|
|
|
a8223e |
+ if (i < upperbound)
|
|
|
a8223e |
+ fprintf_filtered (stream, " ");
|
|
|
a8223e |
}
|
|
|
a8223e |
if (*elts >= options->print_max && i < upperbound)
|
|
|
a8223e |
fprintf_filtered (stream, "...");
|
|
|
a8223e |
diff --git a/gdb/testsuite/gdb.fortran/array-slices.exp b/gdb/testsuite/gdb.fortran/array-slices.exp
|
|
|
a8223e |
--- a/gdb/testsuite/gdb.fortran/array-slices.exp
|
|
|
a8223e |
+++ b/gdb/testsuite/gdb.fortran/array-slices.exp
|
|
|
a8223e |
@@ -38,14 +38,14 @@ gdb_breakpoint [gdb_get_line_number "Final Breakpoint"]
|
|
|
a8223e |
|
|
|
a8223e |
set array_contents \
|
|
|
a8223e |
[list \
|
|
|
a8223e |
- " = \\(\\( 1, 2, 3, 4, 5, 6, 7, 8, 9, 10\\) \\( 11, 12, 13, 14, 15, 16, 17, 18, 19, 20\\) \\( 21, 22, 23, 24, 25, 26, 27, 28, 29, 30\\) \\( 31, 32, 33, 34, 35, 36, 37, 38, 39, 40\\) \\( 41, 42, 43, 44, 45, 46, 47, 48, 49, 50\\) \\( 51, 52, 53, 54, 55, 56, 57, 58, 59, 60\\) \\( 61, 62, 63, 64, 65, 66, 67, 68, 69, 70\\) \\( 71, 72, 73, 74, 75, 76, 77, 78, 79, 80\\) \\( 81, 82, 83, 84, 85, 86, 87, 88, 89, 90\\) \\( 91, 92, 93, 94, 95, 96, 97, 98, 99, 100\\) \\)" \
|
|
|
a8223e |
- " = \\(\\( 1, 2, 3, 4, 5\\) \\( 11, 12, 13, 14, 15\\) \\( 21, 22, 23, 24, 25\\) \\( 31, 32, 33, 34, 35\\) \\( 41, 42, 43, 44, 45\\) \\)" \
|
|
|
a8223e |
- " = \\(\\( 1, 3, 5, 7, 9\\) \\( 21, 23, 25, 27, 29\\) \\( 41, 43, 45, 47, 49\\) \\( 61, 63, 65, 67, 69\\) \\( 81, 83, 85, 87, 89\\) \\)" \
|
|
|
a8223e |
- " = \\(\\( 1, 4, 7, 10\\) \\( 21, 24, 27, 30\\) \\( 41, 44, 47, 50\\) \\( 61, 64, 67, 70\\) \\( 81, 84, 87, 90\\) \\)" \
|
|
|
a8223e |
- " = \\(\\( 1, 5, 9\\) \\( 31, 35, 39\\) \\( 61, 65, 69\\) \\( 91, 95, 99\\) \\)" \
|
|
|
a8223e |
- " = \\(\\( -26, -25, -24, -23, -22, -21, -20, -19, -18, -17\\) \\( -19, -18, -17, -16, -15, -14, -13, -12, -11, -10\\) \\( -12, -11, -10, -9, -8, -7, -6, -5, -4, -3\\) \\( -5, -4, -3, -2, -1, 0, 1, 2, 3, 4\\) \\( 2, 3, 4, 5, 6, 7, 8, 9, 10, 11\\) \\( 9, 10, 11, 12, 13, 14, 15, 16, 17, 18\\) \\( 16, 17, 18, 19, 20, 21, 22, 23, 24, 25\\) \\( 23, 24, 25, 26, 27, 28, 29, 30, 31, 32\\) \\( 30, 31, 32, 33, 34, 35, 36, 37, 38, 39\\) \\( 37, 38, 39, 40, 41, 42, 43, 44, 45, 46\\) \\)" \
|
|
|
a8223e |
- " = \\(\\( -26, -25, -24, -23, -22, -21\\) \\( -19, -18, -17, -16, -15, -14\\) \\( -12, -11, -10, -9, -8, -7\\) \\)" \
|
|
|
a8223e |
- " = \\(\\( -26, -24, -22, -20, -18\\) \\( -5, -3, -1, 1, 3\\) \\( 16, 18, 20, 22, 24\\) \\( 37, 39, 41, 43, 45\\) \\)" ]
|
|
|
a8223e |
+ " = \\(\\(1, 2, 3, 4, 5, 6, 7, 8, 9, 10\\) \\(11, 12, 13, 14, 15, 16, 17, 18, 19, 20\\) \\(21, 22, 23, 24, 25, 26, 27, 28, 29, 30\\) \\(31, 32, 33, 34, 35, 36, 37, 38, 39, 40\\) \\(41, 42, 43, 44, 45, 46, 47, 48, 49, 50\\) \\(51, 52, 53, 54, 55, 56, 57, 58, 59, 60\\) \\(61, 62, 63, 64, 65, 66, 67, 68, 69, 70\\) \\(71, 72, 73, 74, 75, 76, 77, 78, 79, 80\\) \\(81, 82, 83, 84, 85, 86, 87, 88, 89, 90\\) \\(91, 92, 93, 94, 95, 96, 97, 98, 99, 100\\)\\)" \
|
|
|
a8223e |
+ " = \\(\\(1, 2, 3, 4, 5\\) \\(11, 12, 13, 14, 15\\) \\(21, 22, 23, 24, 25\\) \\(31, 32, 33, 34, 35\\) \\(41, 42, 43, 44, 45\\)\\)" \
|
|
|
a8223e |
+ " = \\(\\(1, 3, 5, 7, 9\\) \\(21, 23, 25, 27, 29\\) \\(41, 43, 45, 47, 49\\) \\(61, 63, 65, 67, 69\\) \\(81, 83, 85, 87, 89\\)\\)" \
|
|
|
a8223e |
+ " = \\(\\(1, 4, 7, 10\\) \\(21, 24, 27, 30\\) \\(41, 44, 47, 50\\) \\(61, 64, 67, 70\\) \\(81, 84, 87, 90\\)\\)" \
|
|
|
a8223e |
+ " = \\(\\(1, 5, 9\\) \\(31, 35, 39\\) \\(61, 65, 69\\) \\(91, 95, 99\\)\\)" \
|
|
|
a8223e |
+ " = \\(\\(-26, -25, -24, -23, -22, -21, -20, -19, -18, -17\\) \\(-19, -18, -17, -16, -15, -14, -13, -12, -11, -10\\) \\(-12, -11, -10, -9, -8, -7, -6, -5, -4, -3\\) \\(-5, -4, -3, -2, -1, 0, 1, 2, 3, 4\\) \\(2, 3, 4, 5, 6, 7, 8, 9, 10, 11\\) \\(9, 10, 11, 12, 13, 14, 15, 16, 17, 18\\) \\(16, 17, 18, 19, 20, 21, 22, 23, 24, 25\\) \\(23, 24, 25, 26, 27, 28, 29, 30, 31, 32\\) \\(30, 31, 32, 33, 34, 35, 36, 37, 38, 39\\) \\(37, 38, 39, 40, 41, 42, 43, 44, 45, 46\\)\\)" \
|
|
|
a8223e |
+ " = \\(\\(-26, -25, -24, -23, -22, -21\\) \\(-19, -18, -17, -16, -15, -14\\) \\(-12, -11, -10, -9, -8, -7\\)\\)" \
|
|
|
a8223e |
+ " = \\(\\(-26, -24, -22, -20, -18\\) \\(-5, -3, -1, 1, 3\\) \\(16, 18, 20, 22, 24\\) \\(37, 39, 41, 43, 45\\)\\)" ]
|
|
|
a8223e |
|
|
|
a8223e |
set message_strings \
|
|
|
a8223e |
[list \
|
|
|
a8223e |
diff --git a/gdb/testsuite/gdb.fortran/class-allocatable-array.exp b/gdb/testsuite/gdb.fortran/class-allocatable-array.exp
|
|
|
a8223e |
--- a/gdb/testsuite/gdb.fortran/class-allocatable-array.exp
|
|
|
a8223e |
+++ b/gdb/testsuite/gdb.fortran/class-allocatable-array.exp
|
|
|
a8223e |
@@ -40,4 +40,4 @@ gdb_continue_to_breakpoint "Break Here"
|
|
|
a8223e |
# cetainly going to fail.
|
|
|
a8223e |
gdb_test "print this" " = \\( _data = \[^\r\n\]+, _vptr = \[^\r\n\]+\\)"
|
|
|
a8223e |
gdb_test "print this%_data" " = \\(PTR TO -> \\( Type test_type \\)\\) \[^\r\n\]+"
|
|
|
a8223e |
-gdb_test "print this%_data%b" " = \\(\\( 1, 2, 3\\) \\( 4, 5, 6\\) \\)"
|
|
|
a8223e |
+gdb_test "print this%_data%b" " = \\(\\(1, 2, 3\\) \\(4, 5, 6\\)\\)"
|
|
|
a8223e |
diff --git a/gdb/testsuite/gdb.fortran/multi-dim.exp b/gdb/testsuite/gdb.fortran/multi-dim.exp
|
|
|
a8223e |
--- a/gdb/testsuite/gdb.fortran/multi-dim.exp
|
|
|
a8223e |
+++ b/gdb/testsuite/gdb.fortran/multi-dim.exp
|
|
|
a8223e |
@@ -57,7 +57,7 @@ gdb_test "print foo(3,3,4)" \
|
|
|
a8223e |
"print an invalid array index (3,3,4)"
|
|
|
a8223e |
|
|
|
a8223e |
gdb_test "print foo" \
|
|
|
a8223e |
- { = \(\( \( 10, 10\) \( 10, 10\) \( 10, 10\) \) \( \( 10, 10\) \( 10, 10\) \( 10, 10\) \) \( \( 10, 10\) \( 10, 10\) \( 10, 10\) \) \( \( 10, 10\) \( 10, 10\) \( 10, 20\) \) \)} \
|
|
|
a8223e |
+ { = \(\(\(10, 10\) \(10, 10\) \(10, 10\)\) \(\(10, 10\) \(10, 10\) \(10, 10\)\) \(\(10, 10\) \(10, 10\) \(10, 10\)\) \(\(10, 10\) \(10, 10\) \(10, 20\)\)\)} \
|
|
|
a8223e |
"print full contents of the array"
|
|
|
a8223e |
|
|
|
a8223e |
gdb_breakpoint [gdb_get_line_number "break-variable"]
|
|
|
a8223e |
diff --git a/gdb/testsuite/gdb.fortran/vla-type.exp b/gdb/testsuite/gdb.fortran/vla-type.exp
|
|
|
a8223e |
--- a/gdb/testsuite/gdb.fortran/vla-type.exp
|
|
|
a8223e |
+++ b/gdb/testsuite/gdb.fortran/vla-type.exp
|
|
|
a8223e |
@@ -66,9 +66,9 @@ gdb_test "ptype twov" \
|
|
|
a8223e |
"\\s+$int, allocatable :: ivla1\\\(5,12,99\\\)" \
|
|
|
a8223e |
"\\s+$int, allocatable :: ivla2\\\(9,12\\\)" \
|
|
|
a8223e |
"End Type two" ]
|
|
|
a8223e |
-gdb_test "print twov" " = \\\( ivla1 = \\\(\\\( \\\( 1, 1, 1, 1, 1\\\)\
|
|
|
a8223e |
- \\\( 1, 1, 321, 1, 1\\\)\
|
|
|
a8223e |
- \\\( 1, 1, 1, 1, 1\\\) .*"
|
|
|
a8223e |
+gdb_test "print twov" " = \\\( ivla1 = \\\(\\\(\\\(1, 1, 1, 1, 1\\\)\
|
|
|
a8223e |
+ \\\(1, 1, 321, 1, 1\\\)\
|
|
|
a8223e |
+ \\\(1, 1, 1, 1, 1\\\) .*"
|
|
|
a8223e |
|
|
|
a8223e |
# Check type with attribute at beginn of type
|
|
|
a8223e |
gdb_breakpoint [gdb_get_line_number "threev-filled"]
|
|
|
a8223e |
diff --git a/gdb/testsuite/gdb.mi/mi-vla-fortran.exp b/gdb/testsuite/gdb.mi/mi-vla-fortran.exp
|
|
|
a8223e |
--- a/gdb/testsuite/gdb.mi/mi-vla-fortran.exp
|
|
|
a8223e |
+++ b/gdb/testsuite/gdb.mi/mi-vla-fortran.exp
|
|
|
a8223e |
@@ -180,7 +180,7 @@ mi_run_cmd
|
|
|
a8223e |
mi_expect_stop "breakpoint-hit" "vla" "" ".*vla.f90" "$bp_lineno" \
|
|
|
a8223e |
{ "" "disp=\"del\"" } "run to breakpoint at line $bp_lineno"
|
|
|
a8223e |
mi_gdb_test "590-data-evaluate-expression pvla2" \
|
|
|
a8223e |
- "590\\^done,value=\"\\(\\( 2, 2, 2, 2, 2\\) \\( 2, 2, 2, 2, 2\\) \\)\"" \
|
|
|
a8223e |
+ "590\\^done,value=\"\\(\\(2, 2, 2, 2, 2\\) \\(2, 2, 2, 2, 2\\)\\)\"" \
|
|
|
a8223e |
"evaluate associated vla"
|
|
|
a8223e |
|
|
|
a8223e |
mi_create_varobj_checked pvla2_associated pvla2 \
|