public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [Ping] [PATCH] gdb, testsuite: Fix mi-var-child-f.exp for Intel compilers.
@ 2021-05-21  6:52 Willgerodt, Felix
  2021-05-24 20:58 ` Keith Seitz
  0 siblings, 1 reply; 4+ messages in thread
From: Willgerodt, Felix @ 2021-05-21  6:52 UTC (permalink / raw)
  To: gdb-patches

Kindly pinging!

Felix

-----Original Message-----
From: Willgerodt, Felix <felix.willgerodt@intel.com> 
Sent: Freitag, 7. Mai 2021 09:33
To: Willgerodt, Felix <felix.willgerodt@intel.com>; gdb-patches@sourceware.org
Subject: [PATCH] gdb, testsuite: Fix mi-var-child-f.exp for Intel compilers.

mi-var-child-f.exp uses array.f as the inferior, which uses an unnamed main function.  This causes false positive fails for Intel compilers, as they emit the following DWARF:

~~~
0x0000002a:   DW_TAG_subprogram
                DW_AT_low_pc    (0x0000000000404800)
                DW_AT_high_pc   (0x000000000040484c)
                DW_AT_frame_base        (DW_OP_reg6 RBP)
                DW_AT_linkage_name      ("MAIN__")
                DW_AT_name      ("_unnamed_main$$")
                DW_AT_decl_file ("array.f")
                DW_AT_decl_line (16)
                DW_AT_external  (true)
                DW_AT_main_subprogram   (true)
~~~

The testsuite for fortran uses test_compiler_info to determine a hardcoded string which is used to run to main and as a testing regex:

~~~
proc fortran_main {} {
    if {[test_compiler_info {gcc-4-[012]-*}]
         || [test_compiler_info {gcc-*}]
         || [test_compiler_info {icc-*}] {
	return "MAIN__"
    } elseif {[test_compiler_info {clang-*}]} {
	return "MAIN_"
    } else {
	return "unknown"
    }
}
~~~

GDB however uses DW_AT_name mostly in its output, which fails the regex.
To fix this testcase immediately, I modernized array.f and gave it a named main.  There was no specific reason it was unnamed anyway.  Fixing the testsuite properly is not straightforward.  fortran_main and test_compiler_info would need some changes, which has broader influences.
I might look at this later down the road.

gdb/testsuite/ChangeLog:
2021-05-06  Felix Willgerodt  <felix.willgerodt@intel.com>

	* gdb.mi/array.f: Convert into...
	* gdb.mi/array.f90: ...this.
	* gdb.mi/mi-var-child-f.exp: Use array.f90.
---
 gdb/testsuite/gdb.mi/array.f            | 20 --------------------
 gdb/testsuite/gdb.mi/array.f90          | 21 +++++++++++++++++++++
 gdb/testsuite/gdb.mi/mi-var-child-f.exp |  4 ++--
 3 files changed, 23 insertions(+), 22 deletions(-)  delete mode 100644 gdb/testsuite/gdb.mi/array.f  create mode 100644 gdb/testsuite/gdb.mi/array.f90

diff --git a/gdb/testsuite/gdb.mi/array.f b/gdb/testsuite/gdb.mi/array.f deleted file mode 100644 index 2d31ecae984..00000000000
--- a/gdb/testsuite/gdb.mi/array.f
+++ /dev/null
@@ -1,20 +0,0 @@
-c Copyright 2006-2021 Free Software Foundation, Inc.
-
-c This program is free software; you can redistribute it and/or modify -c it under the terms of the GNU General Public License as published by -c the Free Software Foundation; either version 3 of the License, or -c (at your option) any later version.
-c
-c This program is distributed in the hope that it will be useful, -c but WITHOUT ANY WARRANTY; without even the implied warranty of -c MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the -c GNU General Public License for more details.
-c
-c You should have received a copy of the GNU General Public License -c along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-      INTEGER array(1:2,-1:1)
-      DATA array/11,21,12,22,13,23/
-      CONTINUE
-      STOP
-      END
diff --git a/gdb/testsuite/gdb.mi/array.f90 b/gdb/testsuite/gdb.mi/array.f90 new file mode 100644 index 00000000000..b414b27e026
--- /dev/null
+++ b/gdb/testsuite/gdb.mi/array.f90
@@ -0,0 +1,21 @@
+! Copyright 2006-2021 Free Software Foundation, Inc.
+
+! This program is free software; you can redistribute it and/or modify 
+! it under the terms of the GNU General Public License as published by 
+! the Free Software Foundation; either version 3 of the License, or ! 
+(at your option) any later version.
+!
+! This program is distributed in the hope that it will be useful, ! but 
+WITHOUT ANY WARRANTY; without even the implied warranty of ! 
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the ! GNU 
+General Public License for more details.
+!
+! You should have received a copy of the GNU General Public License ! 
+along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+program prog_array
+  INTEGER array (1:2,-1:1)
+  DATA array/11,21,12,22,13,23/
+  CONTINUE
+  STOP
+end program prog_array
diff --git a/gdb/testsuite/gdb.mi/mi-var-child-f.exp b/gdb/testsuite/gdb.mi/mi-var-child-f.exp
index 272505a4d69..f35c0cdd6d3 100644
--- a/gdb/testsuite/gdb.mi/mi-var-child-f.exp
+++ b/gdb/testsuite/gdb.mi/mi-var-child-f.exp
@@ -26,7 +26,7 @@ if [mi_gdb_start] {
     continue
 }
 
-standard_testfile array.f
+standard_testfile array.f90
 
 if {[gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" \
 	 executable {debug f90}] != ""} {
@@ -36,7 +36,7 @@ if {[gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" \  mi_gdb_reinitialize_dir $srcdir/$subdir  mi_gdb_load ${binfile}
 
-mi_runto [fortran_main]
+mi_runto prog_array
 
 mi_create_varobj "array" "array" "create local variable array"
 
--
2.25.4

Intel Deutschland GmbH
Registered Address: Am Campeon 10, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de <http://www.intel.de>
Managing Directors: Christin Eisenschmid, Sharon Heck, Tiffany Doon Silva  
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Ping] [PATCH] gdb, testsuite: Fix mi-var-child-f.exp for Intel compilers.
  2021-05-21  6:52 [Ping] [PATCH] gdb, testsuite: Fix mi-var-child-f.exp for Intel compilers Willgerodt, Felix
@ 2021-05-24 20:58 ` Keith Seitz
  2021-05-25  8:25   ` Willgerodt, Felix
  0 siblings, 1 reply; 4+ messages in thread
From: Keith Seitz @ 2021-05-24 20:58 UTC (permalink / raw)
  To: Willgerodt, Felix, gdb-patches

On 5/20/21 11:52 PM, Willgerodt, Felix via Gdb-patches wrote:
> Kindly pinging!
> 

Thank you for your patience. Unfortunately, not many of us here are fortran-
literate, including myself, but I know a bit about the test suite. :-)

> -----Original Message-----
> From: Willgerodt, Felix <felix.willgerodt@intel.com> 
> Sent: Freitag, 7. Mai 2021 09:33
> To: Willgerodt, Felix <felix.willgerodt@intel.com>; gdb-patches@sourceware.org
> Subject: [PATCH] gdb, testsuite: Fix mi-var-child-f.exp for Intel compilers.
> 

> GDB however uses DW_AT_name mostly in its output, which fails the regex.
> To fix this testcase immediately, I modernized array.f and gave it a named main.  There was no specific reason it was unnamed anyway.  Fixing the testsuite properly is not straightforward.  fortran_main and test_compiler_info would need some changes, which has broader influences.

This seems reasonable to me given that the test is not specifically testing
unnamed main functions, as you said. [If it did, I would expect the test to be
in gdb.fortran anyway!]

I recommend this patch be approved.

Keith

PS. Since this is essentially a rename of array.f -> array.f90, I hope it will
be possible to preserve whatever history we have on the file w/git mv?


^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: [Ping] [PATCH] gdb, testsuite: Fix mi-var-child-f.exp for Intel compilers.
  2021-05-24 20:58 ` Keith Seitz
@ 2021-05-25  8:25   ` Willgerodt, Felix
  2021-05-25 15:18     ` Keith Seitz
  0 siblings, 1 reply; 4+ messages in thread
From: Willgerodt, Felix @ 2021-05-25  8:25 UTC (permalink / raw)
  To: Keith Seitz, gdb-patches

> I recommend this patch be approved.

Thanks!

> PS. Since this is essentially a rename of array.f -> array.f90, I hope it will be possible to preserve whatever history we have on the file w/git mv?

I don't think I understand your question. Afaik git mv doesn't add anything in regards to file tracking compared to mv.
It will always be like this:

$ git log --oneline -- gdb/testsuite/gdb.mi/array.f90
048a4177f6a (HEAD -> up/fortran) gdb, testsuite: Fix mi-var-child-f.exp for Intel compilers.
$ git log --oneline --follow -- gdb/testsuite/gdb.mi/array.f90
048a4177f6a (HEAD -> up/fortran) gdb, testsuite: Fix mi-var-child-f.exp for Intel compilers.
3666a048837 Update copyright year range in all GDB files
b811d2c2920 Update copyright year range in all GDB files.
42a4f53d2bf Update copyright year range in all GDB files.
...


Regards,
Felix
Intel Deutschland GmbH
Registered Address: Am Campeon 10, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de <http://www.intel.de>
Managing Directors: Christin Eisenschmid, Sharon Heck, Tiffany Doon Silva  
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Ping] [PATCH] gdb, testsuite: Fix mi-var-child-f.exp for Intel compilers.
  2021-05-25  8:25   ` Willgerodt, Felix
@ 2021-05-25 15:18     ` Keith Seitz
  0 siblings, 0 replies; 4+ messages in thread
From: Keith Seitz @ 2021-05-25 15:18 UTC (permalink / raw)
  To: Willgerodt, Felix, gdb-patches

On 5/25/21 1:25 AM, Willgerodt, Felix wrote:
> I don't think I understand your question. Afaik git mv doesn't add
> anything in regards to file tracking compared to mv.

I guess my confusion stems from the copyright range listed in gdb.mi/array.f90:

> +! Copyright 2006-2021 Free Software Foundation, Inc.

I'm not sure what this is meant to convey. However, git shows:

> $ git log --oneline --follow -- gdb/testsuite/gdb.mi/array.f90
> 048a4177f6a (HEAD -> up/fortran) gdb, testsuite: Fix mi-var-child-f.exp for Intel compilers.
> 3666a048837 Update copyright year range in all GDB files
> b811d2c2920 Update copyright year range in all GDB files.
> 42a4f53d2bf Update copyright year range in all GDB files.
> ...

that the file's history is preserved, so that's all I wanted to ensure,
however that was accomplished.

In short, (still) LGTM.

Keith


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-05-25 15:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-21  6:52 [Ping] [PATCH] gdb, testsuite: Fix mi-var-child-f.exp for Intel compilers Willgerodt, Felix
2021-05-24 20:58 ` Keith Seitz
2021-05-25  8:25   ` Willgerodt, Felix
2021-05-25 15:18     ` Keith Seitz

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).