* [PATCH 3/4] Fortran, typeprint: Decrease level of details when printing elements of a structure.
2016-05-10 14:16 [PATCH 0/4] Fortran, typeprint Bernhard Heckel
2016-05-10 14:16 ` [PATCH 1/4] Fortran, typeprint: Fix wrong indentation when ptype nested structures Bernhard Heckel
@ 2016-05-10 14:16 ` Bernhard Heckel
2016-05-11 13:40 ` Yao Qi
2016-05-10 14:16 ` [PATCH 2/4] Fortran, typeprint: Take level of details into account " Bernhard Heckel
2016-05-10 14:18 ` [PATCH 4/4] Fortran, typeprint: Forward level of details to be printed for pointers Bernhard Heckel
3 siblings, 1 reply; 16+ messages in thread
From: Bernhard Heckel @ 2016-05-10 14:16 UTC (permalink / raw)
To: qiyaoltc; +Cc: gdb-patches, Bernhard Heckel
According to the typeprint's description, the level of details is
decreased by one for the typeprint of elements of a structure.
Before:
(gdb) ptype t3v
type = Type t3
integer(kind=4) :: t3_i
Type t2
integer(kind=4) :: t2_i
Type t1
integer(kind=4) :: t1_i
real(kind=4) :: t1_r
End Type t1 :: t1_n
End Type t2 :: t2_n
End Type t3
After:
(gdb) ptype t3v
type = Type t3
integer(kind=4) :: t3_i
Type t2
integer(kind=4) :: t2_i
Type t1 :: t1_n
End Type t2 :: t2_n
End Type t3
2016-05-09 Bernhard Heckel <bernhard.heckel@intel.com>
gdb/Changelog:
* f-typeprint.c (f_type_print_base): Decrease show by one.
gdb/testsuite/Changelog:
* gdb.fortran/type.f90: Add nested structures.
* gdb.fortran/whatis_type.exp: Whatis/ptype nested structures.
---
gdb/f-typeprint.c | 2 +-
gdb/testsuite/gdb.fortran/type.f90 | 21 ++++++++++++++++++++-
gdb/testsuite/gdb.fortran/whatis_type.exp | 22 ++++++++++++++++++++++
3 files changed, 43 insertions(+), 2 deletions(-)
diff --git a/gdb/f-typeprint.c b/gdb/f-typeprint.c
index 49f374a..0389c14 100644
--- a/gdb/f-typeprint.c
+++ b/gdb/f-typeprint.c
@@ -376,7 +376,7 @@ f_type_print_base (struct type *type, struct ui_file *stream, int show,
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 ");
diff --git a/gdb/testsuite/gdb.fortran/type.f90 b/gdb/testsuite/gdb.fortran/type.f90
index b3ae693..00dc650 100644
--- a/gdb/testsuite/gdb.fortran/type.f90
+++ b/gdb/testsuite/gdb.fortran/type.f90
@@ -21,8 +21,27 @@ program type
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
diff --git a/gdb/testsuite/gdb.fortran/whatis_type.exp b/gdb/testsuite/gdb.fortran/whatis_type.exp
index 2caebe6..c1e2745 100644
--- a/gdb/testsuite/gdb.fortran/whatis_type.exp
+++ b/gdb/testsuite/gdb.fortran/whatis_type.exp
@@ -40,6 +40,10 @@ set t1_r "$real :: t1_r"
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" \
@@ -52,3 +56,21 @@ gdb_test "ptype t1v" \
" $t1_i" \
" $t1_r" \
"End Type t1"]
+
+gdb_test "ptype t2v" \
+ [multi_line "type = Type t2" \
+ " $int :: t2_i" \
+ " Type t1" \
+ " $int :: t1_i" \
+ " $real :: t1_r" \
+ " End Type t1 :: t1_n" \
+ "End Type t2"]
+
+gdb_test "ptype t3v" \
+ [multi_line "type = Type t3" \
+ " $int :: t3_i" \
+ " Type t2" \
+ " $int :: t2_i" \
+ " Type t1 :: t1_n" \
+ " End Type t2 :: t2_n" \
+ "End Type t3"]
--
2.7.1.339.g0233b80
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH 2/4] Fortran, typeprint: Take level of details into account when printing elements of a structure.
2016-05-10 14:16 [PATCH 0/4] Fortran, typeprint Bernhard Heckel
2016-05-10 14:16 ` [PATCH 1/4] Fortran, typeprint: Fix wrong indentation when ptype nested structures Bernhard Heckel
2016-05-10 14:16 ` [PATCH 3/4] Fortran, typeprint: Decrease level of details when printing elements of a structure Bernhard Heckel
@ 2016-05-10 14:16 ` Bernhard Heckel
2016-05-11 12:09 ` Yao Qi
2016-05-12 12:06 ` Yao Qi
2016-05-10 14:18 ` [PATCH 4/4] Fortran, typeprint: Forward level of details to be printed for pointers Bernhard Heckel
3 siblings, 2 replies; 16+ messages in thread
From: Bernhard Heckel @ 2016-05-10 14:16 UTC (permalink / raw)
To: qiyaoltc; +Cc: gdb-patches, Bernhard Heckel
According to the typeprint's description, elements of a structure
should not be printed when show is <= -1.
This variable is also used to distinguish the level of details
between "ptype" and "whatis" expressions.
Before:
(gdb) whatis t1v
type = Type t1
integer(kind=4) :: t1_i
real(kind=4) :: t1_r
End Type t1
After:
(gdb) whatis t1v
type = Type t1
2016-05-09 Bernhard Heckel <bernhard.heckel@intel.com>
gdb/Changelog:
* f-typeprint.c (f_type_print_base): Don't print structure fields when show is <= -1.
gdb/testsuite/Changelog:
* gdb.fortran/whatis_type.exp: Adapt expected output.
---
gdb/f-typeprint.c | 27 ++++++++++++++++-----------
gdb/testsuite/gdb.fortran/whatis_type.exp | 13 ++-----------
2 files changed, 18 insertions(+), 22 deletions(-)
diff --git a/gdb/f-typeprint.c b/gdb/f-typeprint.c
index 1990e1b..49f374a 100644
--- a/gdb/f-typeprint.c
+++ b/gdb/f-typeprint.c
@@ -364,19 +364,24 @@ f_type_print_base (struct type *type, struct ui_file *stream, int show,
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++)
+ /* According to the definition,
+ we only print structure elements in case show >= 0. */
+ if (show >= 0)
{
- f_type_print_base (TYPE_FIELD_TYPE (type, index), stream, show,
- 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);
fputs_filtered ("\n", stream);
- }
- fprintfi_filtered (level, stream, "End Type ");
- fputs_filtered (TYPE_TAG_NAME (type), stream);
+ for (index = 0; index < TYPE_NFIELDS (type); index++)
+ {
+ 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);
+ fputs_filtered ("\n", stream);
+ }
+ fprintfi_filtered (level, stream, "End Type ");
+ fputs_filtered (TYPE_TAG_NAME (type), stream);
+ }
break;
case TYPE_CODE_MODULE:
diff --git a/gdb/testsuite/gdb.fortran/whatis_type.exp b/gdb/testsuite/gdb.fortran/whatis_type.exp
index edaf4fd..2caebe6 100644
--- a/gdb/testsuite/gdb.fortran/whatis_type.exp
+++ b/gdb/testsuite/gdb.fortran/whatis_type.exp
@@ -38,17 +38,8 @@ gdb_continue_to_breakpoint "bp1"
set t1_i "$int :: t1_i"
set t1_r "$real :: t1_r"
-gdb_test "whatis t1" \
- [multi_line "type = Type t1" \
- " $t1_i" \
- " $t1_r" \
- "End Type t1"]
-
-gdb_test "whatis t1v" \
- [multi_line "type = Type t1" \
- " $t1_i" \
- " $t1_r" \
- "End Type t1"]
+gdb_test "whatis t1" "type = Type t1"
+gdb_test "whatis t1v" "type = Type t1"
gdb_test "ptype t1" \
[multi_line "type = Type t1" \
--
2.7.1.339.g0233b80
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH 1/4] Fortran, typeprint: Fix wrong indentation when ptype nested structures.
2016-05-10 14:16 [PATCH 0/4] Fortran, typeprint Bernhard Heckel
@ 2016-05-10 14:16 ` Bernhard Heckel
2016-05-11 11:58 ` Yao Qi
2016-05-11 11:59 ` Yao Qi
2016-05-10 14:16 ` [PATCH 3/4] Fortran, typeprint: Decrease level of details when printing elements of a structure Bernhard Heckel
` (2 subsequent siblings)
3 siblings, 2 replies; 16+ messages in thread
From: Bernhard Heckel @ 2016-05-10 14:16 UTC (permalink / raw)
To: qiyaoltc; +Cc: gdb-patches, Bernhard Heckel
Level of indentation was not proper handled when printing
the elements type's name.
Before:
type = Type t1
integer(kind=4) :: var_1
integer(kind=4) :: var_2
End Type t1
After:
type = Type t1
integer(kind=4) :: var_1
integer(kind=4) :: var_2
End Type t1
2016-03-18 Bernhard Heckel <bernhard.heckel@intel.com>
gdb/Changelog:
* f-typeprint.c (f_type_print_base): Take print level into account.
gdb/testsuite/Changelog:
* print_type.exp: Fix expected output.
---
gdb/f-typeprint.c | 2 +-
gdb/testsuite/gdb.fortran/whatis_type.exp | 26 ++++++++++++++++++--------
2 files changed, 19 insertions(+), 9 deletions(-)
diff --git a/gdb/f-typeprint.c b/gdb/f-typeprint.c
index 32989d4..1990e1b 100644
--- a/gdb/f-typeprint.c
+++ b/gdb/f-typeprint.c
@@ -288,7 +288,7 @@ f_type_print_base (struct type *type, struct ui_file *stream, int show,
if ((show <= 0) && (TYPE_NAME (type) != NULL))
{
- fputs_filtered (TYPE_NAME (type), stream);
+ fprintfi_filtered (level, stream, "%s", TYPE_NAME (type));
return;
}
diff --git a/gdb/testsuite/gdb.fortran/whatis_type.exp b/gdb/testsuite/gdb.fortran/whatis_type.exp
index af897a6..edaf4fd 100644
--- a/gdb/testsuite/gdb.fortran/whatis_type.exp
+++ b/gdb/testsuite/gdb.fortran/whatis_type.exp
@@ -39,15 +39,25 @@ set t1_i "$int :: t1_i"
set t1_r "$real :: t1_r"
gdb_test "whatis t1" \
- "type = Type t1\r\n${t1_i}\r\n${t1_r}\r\nEnd Type t1" \
- "whatis t1"
+ [multi_line "type = Type t1" \
+ " $t1_i" \
+ " $t1_r" \
+ "End Type t1"]
+
gdb_test "whatis t1v" \
- "type = Type t1\r\n${t1_i}\r\n${t1_r}\r\nEnd Type t1" \
- "whatis t1v"
+ [multi_line "type = Type t1" \
+ " $t1_i" \
+ " $t1_r" \
+ "End Type t1"]
gdb_test "ptype t1" \
- "type = Type t1\r\n ${t1_i}\r\n ${t1_r}\r\nEnd Type t1" \
- "ptype t1"
+ [multi_line "type = Type t1" \
+ " $t1_i" \
+ " $t1_r" \
+ "End Type t1"]
+
gdb_test "ptype t1v" \
- "type = Type t1\r\n ${t1_i}\r\n ${t1_r}\r\nEnd Type t1" \
- "ptype t1v"
+ [multi_line "type = Type t1" \
+ " $t1_i" \
+ " $t1_r" \
+ "End Type t1"]
--
2.7.1.339.g0233b80
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH 0/4] Fortran, typeprint
@ 2016-05-10 14:16 Bernhard Heckel
2016-05-10 14:16 ` [PATCH 1/4] Fortran, typeprint: Fix wrong indentation when ptype nested structures Bernhard Heckel
` (3 more replies)
0 siblings, 4 replies; 16+ messages in thread
From: Bernhard Heckel @ 2016-05-10 14:16 UTC (permalink / raw)
To: qiyaoltc; +Cc: gdb-patches, Bernhard Heckel
This series fixes various issues in fortran's typeprint.
Tested on Ubuntu1504, Fedora23, Fedora21
Bernhard Heckel (4):
Fortran, typeprint: Fix wrong indentation when ptype nested
structures.
Fortran, typeprint: Take level of details into account when printing
elements of a structure.
Fortran, typeprint: Decrease level of details when printing elements
of a structure.
Fortran, typeprint: Forward level of details to be printed for
pointers.
gdb/f-typeprint.c | 33 ++++++++++--------
gdb/testsuite/gdb.fortran/type.f90 | 26 +++++++++++++-
gdb/testsuite/gdb.fortran/whatis_type.exp | 53 +++++++++++++++++++++++-----
3 files changed, 87 insertions(+), 25 deletions(-)
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH 4/4] Fortran, typeprint: Forward level of details to be printed for pointers.
2016-05-10 14:16 [PATCH 0/4] Fortran, typeprint Bernhard Heckel
` (2 preceding siblings ...)
2016-05-10 14:16 ` [PATCH 2/4] Fortran, typeprint: Take level of details into account " Bernhard Heckel
@ 2016-05-10 14:18 ` Bernhard Heckel
2016-05-11 13:42 ` Yao Qi
2016-05-13 14:27 ` Yao Qi
3 siblings, 2 replies; 16+ messages in thread
From: Bernhard Heckel @ 2016-05-10 14:18 UTC (permalink / raw)
To: qiyaoltc; +Cc: gdb-patches, Bernhard Heckel
Variable "show" was hardcoded to zero for pointer and reference types.
This implementation didn't allow a correct "whatis" print
for those types and results in same output for "ptype" and "whatis".
Before:
(gdb) whatis t3p
type = PTR TO -> ( Type t3
integer(kind=4) :: t3_i
Type t2
integer(kind=4) :: t2_i
Type t1 :: t1_n
End Type t2 :: t2_n
End Type t3 )
After:
(gdb) whatis t3p
type = PTR TO -> ( Type t3 )
2016-05-09 Bernhard Heckel <bernhard.heckel@intel.com>
gdb/Changelog:
* f-typeprint.c (f_type_print_base): Replace 0 by show.
gdb/testsuite/Changelog:
* gdb.fortran/type.f90: Add pointer variable.
* gdb.fortran/whatis_type.exp: Add whatis/ptype of pointers.
---
gdb/f-typeprint.c | 4 ++--
gdb/testsuite/gdb.fortran/type.f90 | 9 +++++++--
gdb/testsuite/gdb.fortran/whatis_type.exp | 10 ++++++++++
3 files changed, 19 insertions(+), 4 deletions(-)
diff --git a/gdb/f-typeprint.c b/gdb/f-typeprint.c
index 0389c14..f1f0063 100644
--- a/gdb/f-typeprint.c
+++ b/gdb/f-typeprint.c
@@ -308,12 +308,12 @@ f_type_print_base (struct type *type, struct ui_file *stream, int show,
case TYPE_CODE_PTR:
fprintf_filtered (stream, "PTR TO -> ( ");
- f_type_print_base (TYPE_TARGET_TYPE (type), stream, 0, level);
+ f_type_print_base (TYPE_TARGET_TYPE (type), stream, show, level);
break;
case TYPE_CODE_REF:
fprintf_filtered (stream, "REF TO -> ( ");
- f_type_print_base (TYPE_TARGET_TYPE (type), stream, 0, level);
+ f_type_print_base (TYPE_TARGET_TYPE (type), stream, show, level);
break;
case TYPE_CODE_VOID:
diff --git a/gdb/testsuite/gdb.fortran/type.f90 b/gdb/testsuite/gdb.fortran/type.f90
index 00dc650..0295a20 100644
--- a/gdb/testsuite/gdb.fortran/type.f90
+++ b/gdb/testsuite/gdb.fortran/type.f90
@@ -33,7 +33,10 @@ program type
type (t1) :: t1v
type (t2) :: t2v
- type (t3) :: t3v
+ type (t3), target :: t3v
+ type(t3), pointer :: t3p
+
+ nullify (t3p)
t1v%t1_i = 42
t1v%t1_r = 42.24
@@ -42,6 +45,8 @@ program type
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
+ t3v%t2_n%t1_n%t1_i = 321
+
+ t3p => t3v ! bp1
end program type
diff --git a/gdb/testsuite/gdb.fortran/whatis_type.exp b/gdb/testsuite/gdb.fortran/whatis_type.exp
index c1e2745..8ac9355 100644
--- a/gdb/testsuite/gdb.fortran/whatis_type.exp
+++ b/gdb/testsuite/gdb.fortran/whatis_type.exp
@@ -44,6 +44,7 @@ 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 "whatis t3p" "type = PTR TO -> \\( Type t3 \\)"
gdb_test "ptype t1" \
[multi_line "type = Type t1" \
@@ -74,3 +75,12 @@ gdb_test "ptype t3v" \
" Type t1 :: t1_n" \
" End Type t2 :: t2_n" \
"End Type t3"]
+
+gdb_test "ptype t3p" \
+ [multi_line "type = PTR TO -> \\( Type t3" \
+ " $int :: t3_i" \
+ " Type t2" \
+ " $int :: t2_i" \
+ " Type t1 :: t1_n" \
+ " End Type t2 :: t2_n" \
+ "End Type t3 \\)"]
--
2.7.1.339.g0233b80
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 1/4] Fortran, typeprint: Fix wrong indentation when ptype nested structures.
2016-05-10 14:16 ` [PATCH 1/4] Fortran, typeprint: Fix wrong indentation when ptype nested structures Bernhard Heckel
@ 2016-05-11 11:58 ` Yao Qi
2016-05-11 11:59 ` Yao Qi
1 sibling, 0 replies; 16+ messages in thread
From: Yao Qi @ 2016-05-11 11:58 UTC (permalink / raw)
To: Bernhard Heckel; +Cc: qiyaoltc, gdb-patches
Bernhard Heckel <bernhard.heckel@intel.com> writes:
> diff --git a/gdb/testsuite/gdb.fortran/whatis_type.exp b/gdb/testsuite/gdb.fortran/whatis_type.exp
> index af897a6..edaf4fd 100644
> --- a/gdb/testsuite/gdb.fortran/whatis_type.exp
> +++ b/gdb/testsuite/gdb.fortran/whatis_type.exp
> @@ -39,15 +39,25 @@ set t1_i "$int :: t1_i"
> set t1_r "$real :: t1_r"
>
> gdb_test "whatis t1" \
> - "type = Type t1\r\n${t1_i}\r\n${t1_r}\r\nEnd Type t1" \
> - "whatis t1"
> + [multi_line "type = Type t1" \
> + " $t1_i" \
> + " $t1_r" \
> + "End Type t1"]
> +
> gdb_test "whatis t1v" \
> - "type = Type t1\r\n${t1_i}\r\n${t1_r}\r\nEnd Type t1" \
> - "whatis t1v"
> + [multi_line "type = Type t1" \
> + " $t1_i" \
> + " $t1_r" \
> + "End Type t1"]
>
> gdb_test "ptype t1" \
> - "type = Type t1\r\n ${t1_i}\r\n ${t1_r}\r\nEnd Type t1" \
> - "ptype t1"
> + [multi_line "type = Type t1" \
> + " $t1_i" \
> + " $t1_r" \
> + "End Type t1"]
> +
> gdb_test "ptype t1v" \
> - "type = Type t1\r\n ${t1_i}\r\n ${t1_r}\r\nEnd Type t1" \
> - "ptype t1v"
> + [multi_line "type = Type t1" \
> + " $t1_i" \
> + " $t1_r" \
> + "End Type t1"]
Could you please split your patch to two parts? The first part is to
change test case using multi_line, and the second part is to adjust the
indentation of expected output in the test.
Looks your patch only affects the output of "whatis".
--
Yao (齐尧)
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 1/4] Fortran, typeprint: Fix wrong indentation when ptype nested structures.
2016-05-10 14:16 ` [PATCH 1/4] Fortran, typeprint: Fix wrong indentation when ptype nested structures Bernhard Heckel
2016-05-11 11:58 ` Yao Qi
@ 2016-05-11 11:59 ` Yao Qi
1 sibling, 0 replies; 16+ messages in thread
From: Yao Qi @ 2016-05-11 11:59 UTC (permalink / raw)
To: Bernhard Heckel; +Cc: qiyaoltc, gdb-patches
Bernhard Heckel <bernhard.heckel@intel.com> writes:
> gdb/testsuite/Changelog:
> * print_type.exp: Fix expected output.
^^^^^^^^^^^^^^: gdb.fortran/whatis_type.exp
--
Yao (齐尧)
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 2/4] Fortran, typeprint: Take level of details into account when printing elements of a structure.
2016-05-10 14:16 ` [PATCH 2/4] Fortran, typeprint: Take level of details into account " Bernhard Heckel
@ 2016-05-11 12:09 ` Yao Qi
2016-05-12 12:06 ` Yao Qi
1 sibling, 0 replies; 16+ messages in thread
From: Yao Qi @ 2016-05-11 12:09 UTC (permalink / raw)
To: Bernhard Heckel; +Cc: qiyaoltc, gdb-patches
Bernhard Heckel <bernhard.heckel@intel.com> writes:
Hi Bernhard,
Patch is good to me, some comments below,
> According to the typeprint's description, elements of a structure
> should not be printed when show is <= -1.
s/<= -1/< 0/ ?
> This variable is also used to distinguish the level of details
> between "ptype" and "whatis" expressions.
>
> Before:
> (gdb) whatis t1v
> type = Type t1
> integer(kind=4) :: t1_i
> real(kind=4) :: t1_r
> End Type t1
>
> After:
> (gdb) whatis t1v
> type = Type t1
>
> 2016-05-09 Bernhard Heckel <bernhard.heckel@intel.com>
>
> gdb/Changelog:
> * f-typeprint.c (f_type_print_base): Don't print structure fields when show is <= -1.
>
This line is too long. s/ <= -1/ < 0/
> diff --git a/gdb/testsuite/gdb.fortran/whatis_type.exp b/gdb/testsuite/gdb.fortran/whatis_type.exp
> index edaf4fd..2caebe6 100644
> --- a/gdb/testsuite/gdb.fortran/whatis_type.exp
> +++ b/gdb/testsuite/gdb.fortran/whatis_type.exp
> @@ -38,17 +38,8 @@ gdb_continue_to_breakpoint "bp1"
> set t1_i "$int :: t1_i"
> set t1_r "$real :: t1_r"
>
> -gdb_test "whatis t1" \
> - [multi_line "type = Type t1" \
> - " $t1_i" \
> - " $t1_r" \
> - "End Type t1"]
> -
> -gdb_test "whatis t1v" \
> - [multi_line "type = Type t1" \
> - " $t1_i" \
> - " $t1_r" \
> - "End Type t1"]
> +gdb_test "whatis t1" "type = Type t1"
> +gdb_test "whatis t1v" "type = Type t1"
>
> gdb_test "ptype t1" \
> [multi_line "type = Type t1" \
This patch can be the first one in this series, and you don't have to
adjust the test of "whatis" back and forth (I mean in patch 1 and 2).
--
Yao (齐尧)
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 3/4] Fortran, typeprint: Decrease level of details when printing elements of a structure.
2016-05-10 14:16 ` [PATCH 3/4] Fortran, typeprint: Decrease level of details when printing elements of a structure Bernhard Heckel
@ 2016-05-11 13:40 ` Yao Qi
2016-05-12 8:00 ` Bernhard Heckel
0 siblings, 1 reply; 16+ messages in thread
From: Yao Qi @ 2016-05-11 13:40 UTC (permalink / raw)
To: Bernhard Heckel; +Cc: qiyaoltc, gdb-patches
Bernhard Heckel <bernhard.heckel@intel.com> writes:
> (gdb) ptype t3v
> type = Type t3
> integer(kind=4) :: t3_i
> Type t2
> integer(kind=4) :: t2_i
> Type t1 :: t1_n
> End Type t2 :: t2_n
> End Type t3
Why do we print the "definition" of Type t2? Why don't we print
(gdb) ptype t3v
type = Type t3
integer(kind=4) :: t3_i
Type t2 t2_n
End Type t3
If I do the same in C, GDB doesn't print the definition of struct t2.
(gdb) ptype t1
type = struct t1 {
int i;
struct t2 t2;
}
--
Yao (齐尧)
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 4/4] Fortran, typeprint: Forward level of details to be printed for pointers.
2016-05-10 14:18 ` [PATCH 4/4] Fortran, typeprint: Forward level of details to be printed for pointers Bernhard Heckel
@ 2016-05-11 13:42 ` Yao Qi
2016-05-13 14:27 ` Yao Qi
1 sibling, 0 replies; 16+ messages in thread
From: Yao Qi @ 2016-05-11 13:42 UTC (permalink / raw)
To: Bernhard Heckel; +Cc: qiyaoltc, gdb-patches
Bernhard Heckel <bernhard.heckel@intel.com> writes:
> 2016-05-09 Bernhard Heckel <bernhard.heckel@intel.com>
>
> gdb/Changelog:
> * f-typeprint.c (f_type_print_base): Replace 0 by show.
>
> gdb/testsuite/Changelog:
> * gdb.fortran/type.f90: Add pointer variable.
> * gdb.fortran/whatis_type.exp: Add whatis/ptype of pointers.
Patch is good to me.
--
Yao (齐尧)
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 3/4] Fortran, typeprint: Decrease level of details when printing elements of a structure.
2016-05-11 13:40 ` Yao Qi
@ 2016-05-12 8:00 ` Bernhard Heckel
2016-05-12 12:45 ` Yao Qi
0 siblings, 1 reply; 16+ messages in thread
From: Bernhard Heckel @ 2016-05-12 8:00 UTC (permalink / raw)
To: Yao Qi; +Cc: gdb-patches
On 11/05/2016 15:40, Yao Qi wrote:
> Bernhard Heckel <bernhard.heckel@intel.com> writes:
>
>> (gdb) ptype t3v
>> type = Type t3
>> integer(kind=4) :: t3_i
>> Type t2
>> integer(kind=4) :: t2_i
>> Type t1 :: t1_n
>> End Type t2 :: t2_n
>> End Type t3
> Why do we print the "definition" of Type t2? Why don't we print
>
> (gdb) ptype t3v
> type = Type t3
> integer(kind=4) :: t3_i
> Type t2 t2_n
> End Type t3
>
> If I do the same in C, GDB doesn't print the definition of struct t2.
>
> (gdb) ptype t1
> type = struct t1 {
> int i;
> struct t2 t2;
> }
>
This is what the comment says:
SHOW nonzero means don't print this type as just its name;
show its real definition even if it has a name.
SHOW zero means print just typename or struct tag if there is one
SHOW negative means abbreviate structure elements.
SHOW is decremented for printing of structure elements.
From that, I understood that I have to print the elements when show is >=0.
Am I wrong? If so, I have to change Patch2.
Intel Deutschland GmbH
Registered Address: Am Campeon 10-12, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de
Managing Directors: Christin Eisenschmid, Christian Lamprechter
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 2/4] Fortran, typeprint: Take level of details into account when printing elements of a structure.
2016-05-10 14:16 ` [PATCH 2/4] Fortran, typeprint: Take level of details into account " Bernhard Heckel
2016-05-11 12:09 ` Yao Qi
@ 2016-05-12 12:06 ` Yao Qi
2016-05-12 12:42 ` Bernhard Heckel
1 sibling, 1 reply; 16+ messages in thread
From: Yao Qi @ 2016-05-12 12:06 UTC (permalink / raw)
To: Bernhard Heckel; +Cc: qiyaoltc, gdb-patches
Bernhard Heckel <bernhard.heckel@intel.com> writes:
> - f_type_print_base (TYPE_FIELD_TYPE (type, index), stream, show,
> - 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);
> fputs_filtered ("\n", stream);
> - }
> - fprintfi_filtered (level, stream, "End Type ");
> - fputs_filtered (TYPE_TAG_NAME (type), stream);
> + for (index = 0; index < TYPE_NFIELDS (type); index++)
> + {
> + f_type_print_base (TYPE_FIELD_TYPE (type, index), stream, show - 1,
> + level + 4);
I read this patch again, and happen to see that we pass "show - 1" to
f_type_print_base instead of "show". I think the change is correct, but
it shouldn't fall in this patch, right?
--
Yao (齐尧)
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 2/4] Fortran, typeprint: Take level of details into account when printing elements of a structure.
2016-05-12 12:06 ` Yao Qi
@ 2016-05-12 12:42 ` Bernhard Heckel
0 siblings, 0 replies; 16+ messages in thread
From: Bernhard Heckel @ 2016-05-12 12:42 UTC (permalink / raw)
To: Yao Qi; +Cc: gdb-patches
On 12/05/2016 14:06, Yao Qi wrote:
> Bernhard Heckel <bernhard.heckel@intel.com> writes:
>
>> - f_type_print_base (TYPE_FIELD_TYPE (type, index), stream, show,
>> - 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);
>> fputs_filtered ("\n", stream);
>> - }
>> - fprintfi_filtered (level, stream, "End Type ");
>> - fputs_filtered (TYPE_TAG_NAME (type), stream);
>> + for (index = 0; index < TYPE_NFIELDS (type); index++)
>> + {
>> + f_type_print_base (TYPE_FIELD_TYPE (type, index), stream, show - 1,
>> + level + 4);
> I read this patch again, and happen to see that we pass "show - 1" to
> f_type_print_base instead of "show". I think the change is correct, but
> it shouldn't fall in this patch, right?
>
Yes, you are right. Show -1 should not go into this patch.
Thx
Intel Deutschland GmbH
Registered Address: Am Campeon 10-12, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de
Managing Directors: Christin Eisenschmid, Christian Lamprechter
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 3/4] Fortran, typeprint: Decrease level of details when printing elements of a structure.
2016-05-12 8:00 ` Bernhard Heckel
@ 2016-05-12 12:45 ` Yao Qi
0 siblings, 0 replies; 16+ messages in thread
From: Yao Qi @ 2016-05-12 12:45 UTC (permalink / raw)
To: Bernhard Heckel; +Cc: Yao Qi, gdb-patches
Bernhard Heckel <bernhard.heckel@intel.com> writes:
> This is what the comment says:
> SHOW nonzero means don't print this type as just its name;
> show its real definition even if it has a name.
> SHOW zero means print just typename or struct tag if there is one
> SHOW negative means abbreviate structure elements.
> SHOW is decremented for printing of structure elements.
>
> From that, I understood that I have to print the elements when show is >=0.
My understanding to the comments above is that we should print elements
when show is > 0. When show is zero, "print just typename or struct
tag", which means when we print t3v,
(gdb) ptype t3v
type = Type t3 <--- show is 1
integer(kind=4) :: t3_i <--- show is 0
Type t2 t2_n <--- show is 0
End Type t3
we should only print type name of t2, rather than its elements, right?
> Am I wrong? If so, I have to change Patch2.
I'd like to leave it to you or someone else who is familiar with the
type print or fortran.
--
Yao (齐尧)
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 4/4] Fortran, typeprint: Forward level of details to be printed for pointers.
2016-05-10 14:18 ` [PATCH 4/4] Fortran, typeprint: Forward level of details to be printed for pointers Bernhard Heckel
2016-05-11 13:42 ` Yao Qi
@ 2016-05-13 14:27 ` Yao Qi
2016-05-13 15:55 ` Yao Qi
1 sibling, 1 reply; 16+ messages in thread
From: Yao Qi @ 2016-05-13 14:27 UTC (permalink / raw)
To: Bernhard Heckel; +Cc: qiyaoltc, gdb-patches
Bernhard Heckel <bernhard.heckel@intel.com> writes:
> +
> +gdb_test "ptype t3p" \
> + [multi_line "type = PTR TO -> \\( Type t3" \
> + " $int :: t3_i" \
> + " Type t2" \
> + " $int :: t2_i" \
> + " Type t1 :: t1_n" \
> + " End Type t2 :: t2_n" \
> + "End Type t3 \\)"]
Why do we print type t2? Sorry I didn't notice this in V1 review.
--
Yao (齐尧)
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 4/4] Fortran, typeprint: Forward level of details to be printed for pointers.
2016-05-13 14:27 ` Yao Qi
@ 2016-05-13 15:55 ` Yao Qi
0 siblings, 0 replies; 16+ messages in thread
From: Yao Qi @ 2016-05-13 15:55 UTC (permalink / raw)
To: Bernhard Heckel; +Cc: gdb-patches
On 13/05/16 15:27, Yao Qi wrote:
>> +
>> >+gdb_test "ptype t3p" \
>> >+ [multi_line "type = PTR TO -> \\( Type t3" \
>> >+ " $int :: t3_i" \
>> >+ " Type t2" \
>> >+ " $int :: t2_i" \
>> >+ " Type t1 :: t1_n" \
>> >+ " End Type t2 :: t2_n" \
>> >+ "End Type t3 \\)"]
> Why do we print type t2? Sorry I didn't notice this in V1 review.
I thought it is from V2 series. Sorry for the noise.
--
Yao (é½å°§)
^ permalink raw reply [flat|nested] 16+ messages in thread
end of thread, other threads:[~2016-05-13 15:55 UTC | newest]
Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-10 14:16 [PATCH 0/4] Fortran, typeprint Bernhard Heckel
2016-05-10 14:16 ` [PATCH 1/4] Fortran, typeprint: Fix wrong indentation when ptype nested structures Bernhard Heckel
2016-05-11 11:58 ` Yao Qi
2016-05-11 11:59 ` Yao Qi
2016-05-10 14:16 ` [PATCH 3/4] Fortran, typeprint: Decrease level of details when printing elements of a structure Bernhard Heckel
2016-05-11 13:40 ` Yao Qi
2016-05-12 8:00 ` Bernhard Heckel
2016-05-12 12:45 ` Yao Qi
2016-05-10 14:16 ` [PATCH 2/4] Fortran, typeprint: Take level of details into account " Bernhard Heckel
2016-05-11 12:09 ` Yao Qi
2016-05-12 12:06 ` Yao Qi
2016-05-12 12:42 ` Bernhard Heckel
2016-05-10 14:18 ` [PATCH 4/4] Fortran, typeprint: Forward level of details to be printed for pointers Bernhard Heckel
2016-05-11 13:42 ` Yao Qi
2016-05-13 14:27 ` Yao Qi
2016-05-13 15:55 ` Yao Qi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).