[PATCH] [gdb.fortran] Add type info of formal parameter for clang in ptype-on-functions.exp
Kumar N, Bhuvanendra
Bhuvanendra.KumarN@amd.com
Wed Jun 2 10:30:58 GMT 2021
[AMD Official Use Only - Internal Distribution Only]
Hi Andrew,
> Would you be willing to take this commit and see if you can finish this off so that it meets your needs?
Sure, will complete this patch and send fresh patch for review. Thanks for your comments
regards,
bhuvan
-----Original Message-----
From: Andrew Burgess <andrew.burgess@embecosm.com>
Sent: Wednesday, June 2, 2021 3:13 PM
To: Kumar N, Bhuvanendra <Bhuvanendra.KumarN@amd.com>
Cc: gdb-patches@sourceware.org; George, Jini Susan <JiniSusan.George@amd.com>; Achra, Nitika <Nitika.Achra@amd.com>; Sharma, Alok Kumar <AlokKumar.Sharma@amd.com>; E, Nagajyothi <Nagajyothi.E@amd.com>; Tomar, Sourabh Singh <SourabhSingh.Tomar@amd.com>
Subject: Re: [PATCH] [gdb.fortran] Add type info of formal parameter for clang in ptype-on-functions.exp
[CAUTION: External Email]
* Kumar N, Bhuvanendra <Bhuvanendra.KumarN@amd.com> [2021-05-26 07:59:08 +0000]:
> [AMD Official Use Only - Internal Distribution Only]
>
> Hi all,
>
> Gentle Ping 2!
>
> Please let me know if any other details are required, thanks
Hi,
Thanks for your patience, sorry to have taken so long to get back to you.
Below is a patch more inline with how I think cases like this should be addressed.
The difference to the approach you have taken is that, instead of just having two code paths, and in each path duplicating all of the tests, I use compiler checks to setup variables that are then used to tweak the expected output patterns.
The benefit I see is that if common parts of the output change, we only need to update one pattern, and if any extra tests are added then there will be less chance of the new test only being added along one path by mistake.
The only reason I didn't just commit this is that I think I'm not getting the same output as you are, you'll notice that some of the tests in this commit have setup_kfail, these are all the tests where I'm seeing different output to you.
Would you be willing to take this commit and see if you can finish this off so that it meets your needs?
Thanks,
Andrew
---
diff --git a/gdb/testsuite/gdb.fortran/ptype-on-functions.exp b/gdb/testsuite/gdb.fortran/ptype-on-functions.exp
index 14f522d6d42..772edc7e8a9 100644
--- a/gdb/testsuite/gdb.fortran/ptype-on-functions.exp
+++ b/gdb/testsuite/gdb.fortran/ptype-on-functions.exp
@@ -29,23 +29,54 @@ if ![fortran_runto_main] then {
continue
}
+set integer4 [fortran_int4]
+set logical4 [fortran_logical4]
+set integer8 [fortran_int8]
+
+if {[test_compiler_info {clang-*}]} {
+ set some_module_class_type "Type number"
+ set some_module_aux_info ", $integer8 \\(10\\)"
+} else {
+ set some_module_class_type "Type __class_some_module_Number(_t)?"
+ set some_module_aux_info ""
+}
+
+if {[test_compiler_info {clang-*}]} {
+ setup_kfail *-*-* "gets a pointer for some reason"
+}
gdb_test "ptype some_module::get_number" \
- "type = integer\\(kind=4\\) \\(Type __class_some_module_Number(_t)?\\)"
+ "type = $integer4 \\(${some_module_class_type}${some_module_aux_info}\\)"
gdb_test "ptype some_module::set_number" \
- "type = void \\(Type __class_some_module_Number(_t)?, integer\\(kind=4\\)\\)"
+ "type = void \\(${some_module_class_type}, $integer4${some_module_aux_info}\\)"
+if {[test_compiler_info {clang-*}]} {
+ setup_kfail *-*-* "gets a pointer for some reason"
+}
gdb_test "ptype is_bigger" \
- "type = logical\\(kind=4\\) \\(integer\\(kind=4\\), integer\\(kind=4\\)\\)"
+ "type = $logical4 \\($integer4, $integer4\\)"
gdb_test "ptype say_numbers" \
- "type = void \\(integer\\(kind=4\\), integer\\(kind=4\\), integer\\(kind=4\\)\\)"
+ "type = void \\($integer4, $integer4, $integer4\\)"
+set fun_ptr_arg "$integer4"
+if {[test_compiler_info {gcc-*}]} {
+ set fun_ptr_arg "REF TO -> \\( ${fun_ptr_arg} \\)"
+}
+
+if {[test_compiler_info {clang-*}]} {
+ setup_kfail *-*-* "missing symbol"
+}
gdb_test "ptype fun_ptr" \
- "type = PTR TO -> \\( integer\\(kind=4\\) \\(\\) \\(REF TO -> \\( integer\\(kind=4\\) \\)\\) \\)"
+ "type = PTR TO -> \\( $integer4 \\(\\) \\(${fun_ptr_arg}\\) \\)"
gdb_test "ptype say_string" \
- "type = void \\(character\\*\\(\\*\\), integer\\(kind=\\d+\\)\\)"
+ "type = void \\(character\[^,\]+, $integer8\\)"
+
+set say_array_artificial_first_arg ""
+if {[test_compiler_info {clang-*}]} {
+ set say_array_artificial_first_arg "$integer8, "
+}
gdb_test "ptype say_array" \
- "type = void \\(integer\\(kind=4\\) \\(:,:\\)\\)"
+ "type = void \\(${say_array_artificial_first_arg}$integer4 \\(:,:\\)\\)"
More information about the Gdb-patches
mailing list