+2016-05-25 Bernhard Heckel <bernhard.heckel@intel.com>
+
+ * f-typeprint.c (f_type_print_base): Decrease show by one.
+
2016-05-25 Bernhard Heckel <bernhard.heckel@intel.com>
* f-typeprint.c (f_type_print_base): Don't print fields when show < 0.
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);
+ f_type_print_base (TYPE_FIELD_TYPE (type, index), stream,
+ show - 1, level + 4);
fputs_filtered (" :: ", stream);
fputs_filtered (TYPE_FIELD_NAME (type, index), stream);
f_type_print_varspec_suffix (TYPE_FIELD_TYPE (type, index),
- stream, 0, 0, 0, 0);
+ stream, show - 1, 0, 0, 0);
fputs_filtered ("\n", stream);
}
fprintfi_filtered (level, stream, "End Type ");
+2016-05-25 Bernhard Heckel <bernhard.heckel@intel.com>
+
+ * gdb.fortran/type.f90: Add nested structures.
+ * gdb.fortran/whatis-type.exp: Whatis/ptype nested structures.
+ * gdb.fortran/derived-type.exp: Adapt expected output.
+ * gdb.fortran/vla-type.exp: Adapt expected output.
+
2016-05-25 Bernhard Heckel <bernhard.heckel@intel.com>
* gdb.fortran/whatis_type.exp: Adapt expected output.
set test "type-printing for derived type"
gdb_test_multiple "ptype q" $test {
- -re "type = Type foo\r\n *$real :: a\r\n *Type bar\r\n *$int :: c\r\n *$real :: d\r\n *End Type bar :: x\r\n *character\\*7 :: b\r\n *End Type foo\r\n$gdb_prompt $" {
+ -re "type = Type foo\r\n *$real :: a\r\n *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 *$real :: a\r\n *Type bar\r\n *$int :: c\r\n *$real :: d\r\n *End Type bar :: x\r\n *character :: b\\(7\\)\r\n *End Type foo\r\n$gdb_prompt $" {
+ -re "type = Type foo\r\n *$real :: a\r\n *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
real :: t1_r
end type t1
+ type :: t2
+ integer :: t2_i
+ type (t1) :: t1_n
+ end type t2
+
+ type :: t3
+ integer :: t3_i
+ type (t2) :: t2_n
+ end type t3
+
type (t1) :: t1v
+ type (t2) :: t2v
+ type (t3) :: t3v
t1v%t1_i = 42
- t1v%t1_r = 42.24 ! bp1
+ t1v%t1_r = 42.24
+
+ t2v%t2_i = 2
+ t2v%t1_n%t1_i = 21
+ t3v%t3_i = 3
+ t3v%t2_n%t2_i = 32
+ t3v%t2_n%t1_n%t1_i = 321 ! bp1
+
end program type
gdb_test "print fivev%tone%ivla(3, 2, 1)" " = 321"
gdb_test "ptype fivev" \
[multi_line "type = Type five" \
- "\\s+Type one" \
- "\\s+$int :: ivla\\\(10,10,10\\\)" \
- "\\s+End Type one :: tone" \
+ "\\s+Type one :: tone" \
"End Type five" ]
# Check array of types containing a VLA
gdb_test "print fivearr(2)%tone%ivla(6, 7, 8)" " = 678"
gdb_test "ptype fivearr(1)" \
[multi_line "type = Type five" \
- "\\s+Type one" \
- "\\s+$int :: ivla\\\(2,4,6\\\)" \
- "\\s+End Type one :: tone" \
+ "\\s+Type one :: tone" \
"End Type five" ]
gdb_test "ptype fivearr(2)" \
[multi_line "type = Type five" \
- "\\s+Type one" \
- "\\s+$int :: ivla\\\(12,14,16\\\)" \
- "\\s+End Type one :: tone" \
+ "\\s+Type one :: tone" \
"End Type five" ]
# Check allocation status of dynamic array and it's dynamic members
gdb_test "next" ""
gdb_test "ptype fivedynarr(2)" \
[multi_line "type = Type five" \
- "\\s+Type one" \
- "\\s+$int :: ivla\\\(<not allocated>\\\)" \
- "\\s+End Type one :: tone" \
+ "\\s+Type one :: tone" \
"End Type five" ]
# Check dynamic array of types containing a VLA
gdb_test "print fivedynarr(2)%tone%ivla(6, 7, 8)" " = 678"
gdb_test "ptype fivedynarr(1)" \
[multi_line "type = Type five" \
- "\\s+Type one" \
- "\\s+$int :: ivla\\\(2,4,6\\\)" \
- "\\s+End Type one :: tone" \
+ "\\s+Type one :: tone" \
"End Type five" ]
gdb_test "ptype fivedynarr(2)" \
[multi_line "type = Type five" \
- "\\s+Type one" \
- "\\s+$int :: ivla\\\(12,14,16\\\)" \
- "\\s+End Type one :: tone" \
+ "\\s+Type one :: tone" \
"End Type five" ]
gdb_test "whatis t1" "type = Type t1"
gdb_test "whatis t1v" "type = Type t1"
+gdb_test "whatis t2" "type = Type t2"
+gdb_test "whatis t2v" "type = Type t2"
+gdb_test "whatis t3" "type = Type t3"
+gdb_test "whatis t3v" "type = Type t3"
gdb_test "ptype t1" \
[multi_line "type = Type t1" \
" $t1_r" \
"End Type t1"] \
"ptype t1v"
+
+gdb_test "ptype t2v" \
+ [multi_line "type = Type t2" \
+ " $int :: t2_i" \
+ " Type t1 :: t1_n" \
+ "End Type t2"]
+
+gdb_test "ptype t3v" \
+ [multi_line "type = Type t3" \
+ " $int :: t3_i" \
+ " Type t2 :: t2_n" \
+ "End Type t3"]