From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr1-x434.google.com (mail-wr1-x434.google.com [IPv6:2a00:1450:4864:20::434]) by sourceware.org (Postfix) with ESMTPS id 4515938930D5 for ; Fri, 24 Apr 2020 10:17:55 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 4515938930D5 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=embecosm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=andrew.burgess@embecosm.com Received: by mail-wr1-x434.google.com with SMTP id t14so10084479wrw.12 for ; Fri, 24 Apr 2020 03:17:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=embecosm.com; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=JmLMAWaObDExAGZSXfnVxrrNa8/WyZhbAR/CJORLwxM=; b=PLxb6h2BlkNXxHkZNvziU/IHQGLWmd8TPNjkIoHYSsCMUbMk8sTJa4i+3Lbn5ht4wf +8mekYMfK729hLHvlcG0HWBG3H6MCziJlm7Z9i0o9DEA35LXzmVAr2xn374WCWNkCfu1 mkyZLMhCiqY8P2fOxxHPfRb5iGT+zcvwQf3p1yyhDITEc5bEUNgFungh7MFOZ3exO9K7 PbPrPB7gSYoXDZ+2XyLjxOMDY7QkWyIZyOroGGD2a7XpLAYCIU5vfoaagyNPLVuQ74/S NxxuRmc8AsKI+wPRHHsz5tOgQKbLbMsVzO493OJmiAl7nM16U7SQ8IY5S2gqdOTEzsnF 8a6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=JmLMAWaObDExAGZSXfnVxrrNa8/WyZhbAR/CJORLwxM=; b=Fiu67a9kyuzQuSRBDGywPVz/oUUJO6b4YJrO2jDq71Spmo0SQJfnw/w1OR6KtivLAs YDwnXbeCQXDp+MTtP+XtxILqYp7pqe0E8kosXTqldywuHrRQPMKhFFNQvs59kHy08j6r A7dJmr7D83wr9sUR0GV8Nc6hnFjnPsHjiw0ShvaH8fCzGVBpMds3GvzKYIvWGRrytUxI XyNJUTmEcdf+wMU/OV5udvZjpa9AYt4rpNFMNpbGHTjBkJvQqvjUCxU+L8mC/d3rumB7 CK+Hjwg4w2/dSczEJ7QK7kfYZYXuX8iw/fJiMMLBB2GLympmIkBPT5LiKoMqF3ABAnOB R9FQ== X-Gm-Message-State: AGi0PuZS4LF+eU6G/wIu56Vi2GhO3vhO3o/0LU0SaTNu3TeBzxRw3v9R N+Bc3bkjYAUdIFoJHWmHTPN3Ng== X-Google-Smtp-Source: APiQypLAi33gyfgXRppdXsrdMKJKlOUuJsecSoCpU7HG1Ua+w5NSTC4B1ED/DWQ57cMbpnO4ZWTh7g== X-Received: by 2002:a5d:634a:: with SMTP id b10mr10467513wrw.263.1587723474206; Fri, 24 Apr 2020 03:17:54 -0700 (PDT) Received: from localhost (host81-151-181-184.range81-151.btcentralplus.com. [81.151.181.184]) by smtp.gmail.com with ESMTPSA id l9sm7633445wrq.83.2020.04.24.03.17.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Apr 2020 03:17:53 -0700 (PDT) Date: Fri, 24 Apr 2020 11:17:52 +0100 From: Andrew Burgess To: "Sharma, Alok Kumar" Cc: "gdb-patches@sourceware.org" , "George, Jini Susan" , "Achra, Nitika" Subject: Re: [PATCH] gdb/fortran: Allow Flang MAIN_ in Fortran testing Message-ID: <20200424101752.GB3522@embecosm.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Operating-System: Linux/5.5.17-200.fc31.x86_64 (x86_64) X-Uptime: 11:09:09 up 3 days, 18:05, X-Editor: GNU Emacs [ http://www.gnu.org/software/emacs ] X-Spam-Status: No, score=-24.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Apr 2020 10:17:59 -0000 Hi, Thanks for look at this. * Sharma, Alok Kumar [2020-04-24 09:44:18 +0000]: > [AMD Official Use Only - Internal Distribution Only] You may want to figure out how to disable this for external mail. > > Hi all, > > I request you all to please review this patch. Below are the details. > > Problem Description: > > Name of fortran main function for Flang compiler is MAIN_ while > for gfortran it is MAIN__ . In test cases MAIN__ is hardcoded for > the purpose of inserting breakpoint. > (please note the number of underscores after MAIN) > > Resolution: > > New proc is added to detect main function name depending on the > compiler used. Which is used in testcases. > > This commit adds support for Flang main function, there should be > no change for gfortran. > > gdb/testsuite/ChangeLog > > * gdb.dwarf2/dw2-common-block.exp: Skip test except for gfortran, > as assembly file to be tested is generated by gfortran. > * lib/fortran.exp (fortran_main): New Proc, handle flang MAIN_. > * gdb.fortran/array-bounds-high.exp: Handle flang MAIN_ > * gdb.fortran/array-bounds.exp: Likewise. > * gdb.fortran/array-slices.exp: Likewise. > * gdb.fortran/block-data.exp: Likewise. > * gdb.fortran/charset.exp: Likewise. > * gdb.fortran/common-block.exp: Likewise. > * gdb.fortran/complex.exp: Likewise. > * gdb.fortran/derived-type-function.exp: Likewise. > * gdb.fortran/derived-type.exp: Likewise. > * gdb.fortran/info-modules.exp: Likewise. > * gdb.fortran/info-types.exp: Likewise. > * gdb.fortran/intrinsics.exp: Likewise. > * gdb.fortran/library-module.exp: Likewise. > * gdb.fortran/logical.exp: Likewise. > * gdb.fortran/max-depth.exp: Likewise. > * gdb.fortran/module.exp: Likewise. > * gdb.fortran/multi-dim.exp: Likewise. > * gdb.fortran/nested-funcs.exp: Likewise. > * gdb.fortran/print-formatted.exp: Likewise. > * gdb.fortran/print_type.exp: Likewise. > * gdb.fortran/printing-types.exp: Likewise. > * gdb.fortran/ptr-indentation.exp: Likewise. > * gdb.fortran/ptype-on-functions.exp: Likewise. > * gdb.fortran/subarray.exp: Likewise. > * gdb.fortran/vla-alloc-assoc.exp: Likewise. > * gdb.fortran/vla-datatypes.exp: Likewise. > * gdb.fortran/vla-history.exp: Likewise. > * gdb.fortran/vla-ptr-info.exp: Likewise. > * gdb.fortran/vla-ptype-sub.exp: Likewise. > * gdb.fortran/vla-ptype.exp: Likewise. > * gdb.fortran/vla-sizeof.exp: Likewise. > * gdb.fortran/vla-type.exp: Likewise. > * gdb.fortran/vla-value-sub-arbitrary.exp: Likewise. > * gdb.fortran/vla-value-sub-finish.exp: Likewise. > * gdb.fortran/vla-value-sub.exp: Likewise. > * gdb.fortran/vla-value.exp: Likewise. > * gdb.fortran/whatis_type.exp: Likewise. > * gdb.mi/mi-var-child-f.exp: Likewise. > > Please let me know your comments. > > Regards, > Alok > From 7c1667f2e074dc1e0d9a0336d9ec07da59124a72 Mon Sep 17 00:00:00 2001 > From: Alok Kumar Sharma > Date: Fri, 24 Apr 2020 14:46:09 +0530 > Subject: [PATCH] gdb/fortran: Allow Flang MAIN_ in Fortran testing > > Name of fortran main function for Flang compiler is MAIN_ while > for gfortran it is MAIN__ . In test cases MAIN__ is hardcoded for > the purpose of inserting breakpoint. > > New proc is added to detect main function name depending on the > compiler used. Which is used in testcases. > > This commit adds support for Flang main function, there should be > no change for gfortran. > > gdb/testsuite/ChangeLog > > * gdb.dwarf2/dw2-common-block.exp: Skip test except for gfortran, > as assembly file to be tested is generated by gfortran. > * lib/fortran.exp (fortran_main): New Proc, handle flang MAIN_. > * gdb.fortran/array-bounds-high.exp: Handle flang MAIN_ > * gdb.fortran/array-bounds.exp: Likewise. > * gdb.fortran/array-slices.exp: Likewise. > * gdb.fortran/block-data.exp: Likewise. > * gdb.fortran/charset.exp: Likewise. > * gdb.fortran/common-block.exp: Likewise. > * gdb.fortran/complex.exp: Likewise. > * gdb.fortran/derived-type-function.exp: Likewise. > * gdb.fortran/derived-type.exp: Likewise. > * gdb.fortran/info-modules.exp: Likewise. > * gdb.fortran/info-types.exp: Likewise. > * gdb.fortran/intrinsics.exp: Likewise. > * gdb.fortran/library-module.exp: Likewise. > * gdb.fortran/logical.exp: Likewise. > * gdb.fortran/max-depth.exp: Likewise. > * gdb.fortran/module.exp: Likewise. > * gdb.fortran/multi-dim.exp: Likewise. > * gdb.fortran/nested-funcs.exp: Likewise. > * gdb.fortran/print-formatted.exp: Likewise. > * gdb.fortran/print_type.exp: Likewise. > * gdb.fortran/printing-types.exp: Likewise. > * gdb.fortran/ptr-indentation.exp: Likewise. > * gdb.fortran/ptype-on-functions.exp: Likewise. > * gdb.fortran/subarray.exp: Likewise. > * gdb.fortran/vla-alloc-assoc.exp: Likewise. > * gdb.fortran/vla-datatypes.exp: Likewise. > * gdb.fortran/vla-history.exp: Likewise. > * gdb.fortran/vla-ptr-info.exp: Likewise. > * gdb.fortran/vla-ptype-sub.exp: Likewise. > * gdb.fortran/vla-ptype.exp: Likewise. > * gdb.fortran/vla-sizeof.exp: Likewise. > * gdb.fortran/vla-type.exp: Likewise. > * gdb.fortran/vla-value-sub-arbitrary.exp: Likewise. > * gdb.fortran/vla-value-sub-finish.exp: Likewise. > * gdb.fortran/vla-value-sub.exp: Likewise. > * gdb.fortran/vla-value.exp: Likewise. > * gdb.fortran/whatis_type.exp: Likewise. > * gdb.mi/mi-var-child-f.exp: Likewise. > > Change-Id: I0a30f5dad684879b416f71d3d08c385c159325bf > --- > gdb/testsuite/ChangeLog | 44 +++++++++++++++++++ > gdb/testsuite/gdb.dwarf2/dw2-common-block.exp | 6 +++ > .../gdb.fortran/array-bounds-high.exp | 5 ++- > gdb/testsuite/gdb.fortran/array-bounds.exp | 5 ++- > gdb/testsuite/gdb.fortran/array-slices.exp | 3 +- > gdb/testsuite/gdb.fortran/block-data.exp | 4 +- > gdb/testsuite/gdb.fortran/charset.exp | 6 ++- > gdb/testsuite/gdb.fortran/common-block.exp | 4 +- > gdb/testsuite/gdb.fortran/complex.exp | 5 ++- > .../gdb.fortran/derived-type-function.exp | 5 ++- > gdb/testsuite/gdb.fortran/derived-type.exp | 4 +- > gdb/testsuite/gdb.fortran/info-modules.exp | 4 +- > gdb/testsuite/gdb.fortran/info-types.exp | 4 +- > gdb/testsuite/gdb.fortran/intrinsics.exp | 4 +- > gdb/testsuite/gdb.fortran/library-module.exp | 5 ++- > gdb/testsuite/gdb.fortran/logical.exp | 5 ++- > gdb/testsuite/gdb.fortran/max-depth.exp | 4 +- > gdb/testsuite/gdb.fortran/module.exp | 6 +-- > gdb/testsuite/gdb.fortran/multi-dim.exp | 4 +- > gdb/testsuite/gdb.fortran/nested-funcs.exp | 4 +- > gdb/testsuite/gdb.fortran/print-formatted.exp | 4 +- > gdb/testsuite/gdb.fortran/print_type.exp | 2 +- > gdb/testsuite/gdb.fortran/printing-types.exp | 5 ++- > gdb/testsuite/gdb.fortran/ptr-indentation.exp | 4 +- > .../gdb.fortran/ptype-on-functions.exp | 4 +- > gdb/testsuite/gdb.fortran/subarray.exp | 5 ++- > gdb/testsuite/gdb.fortran/vla-alloc-assoc.exp | 3 +- > gdb/testsuite/gdb.fortran/vla-datatypes.exp | 2 +- > gdb/testsuite/gdb.fortran/vla-history.exp | 3 +- > gdb/testsuite/gdb.fortran/vla-ptr-info.exp | 3 +- > gdb/testsuite/gdb.fortran/vla-ptype-sub.exp | 2 +- > gdb/testsuite/gdb.fortran/vla-ptype.exp | 2 +- > gdb/testsuite/gdb.fortran/vla-sizeof.exp | 3 +- > gdb/testsuite/gdb.fortran/vla-type.exp | 2 +- > .../gdb.fortran/vla-value-sub-arbitrary.exp | 3 +- > .../gdb.fortran/vla-value-sub-finish.exp | 3 +- > gdb/testsuite/gdb.fortran/vla-value-sub.exp | 3 +- > gdb/testsuite/gdb.fortran/vla-value.exp | 6 +-- > gdb/testsuite/gdb.fortran/whatis_type.exp | 4 +- > gdb/testsuite/gdb.mi/mi-var-child-f.exp | 2 +- > gdb/testsuite/lib/fortran.exp | 16 +++++++ > 41 files changed, 148 insertions(+), 64 deletions(-) > > diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog > index 10683db566..e972f97fad 100644 > --- a/gdb/testsuite/ChangeLog > +++ b/gdb/testsuite/ChangeLog > @@ -1,3 +1,47 @@ > +2020-04-24 Alok Kumar Sharma > + > + * gdb.dwarf2/dw2-common-block.exp: Skip test except for gfortran, > + as assembly file to be tested is generated by gfortran. > + * lib/fortran.exp (fortran_main): New Proc, handle flang MAIN_. > + * gdb.fortran/array-bounds-high.exp: Handle flang MAIN_ > + * gdb.fortran/array-bounds.exp: Likewise. > + * gdb.fortran/array-slices.exp: Likewise. > + * gdb.fortran/block-data.exp: Likewise. > + * gdb.fortran/charset.exp: Likewise. > + * gdb.fortran/common-block.exp: Likewise. > + * gdb.fortran/complex.exp: Likewise. > + * gdb.fortran/derived-type-function.exp: Likewise. > + * gdb.fortran/derived-type.exp: Likewise. > + * gdb.fortran/info-modules.exp: Likewise. > + * gdb.fortran/info-types.exp: Likewise. > + * gdb.fortran/intrinsics.exp: Likewise. > + * gdb.fortran/library-module.exp: Likewise. > + * gdb.fortran/logical.exp: Likewise. > + * gdb.fortran/max-depth.exp: Likewise. > + * gdb.fortran/module.exp: Likewise. > + * gdb.fortran/multi-dim.exp: Likewise. > + * gdb.fortran/nested-funcs.exp: Likewise. > + * gdb.fortran/print-formatted.exp: Likewise. > + * gdb.fortran/print_type.exp: Likewise. > + * gdb.fortran/printing-types.exp: Likewise. > + * gdb.fortran/ptr-indentation.exp: Likewise. > + * gdb.fortran/ptype-on-functions.exp: Likewise. > + * gdb.fortran/subarray.exp: Likewise. > + * gdb.fortran/vla-alloc-assoc.exp: Likewise. > + * gdb.fortran/vla-datatypes.exp: Likewise. > + * gdb.fortran/vla-history.exp: Likewise. > + * gdb.fortran/vla-ptr-info.exp: Likewise. > + * gdb.fortran/vla-ptype-sub.exp: Likewise. > + * gdb.fortran/vla-ptype.exp: Likewise. > + * gdb.fortran/vla-sizeof.exp: Likewise. > + * gdb.fortran/vla-type.exp: Likewise. > + * gdb.fortran/vla-value-sub-arbitrary.exp: Likewise. > + * gdb.fortran/vla-value-sub-finish.exp: Likewise. > + * gdb.fortran/vla-value-sub.exp: Likewise. > + * gdb.fortran/vla-value.exp: Likewise. > + * gdb.fortran/whatis_type.exp: Likewise. > + * gdb.mi/mi-var-child-f.exp: Likewise. > + > 2020-04-23 Tom de Vries > > * gdb.base/decl-before-def.exp: Run to main and print a again. > diff --git a/gdb/testsuite/gdb.dwarf2/dw2-common-block.exp b/gdb/testsuite/gdb.dwarf2/dw2-common-block.exp > index 9bcf06b17f..cf41c6833f 100644 > --- a/gdb/testsuite/gdb.dwarf2/dw2-common-block.exp > +++ b/gdb/testsuite/gdb.dwarf2/dw2-common-block.exp > @@ -30,6 +30,12 @@ if {[skip_fortran_tests]} { > return 0 > } > > +# Assembly file is generated using gfortran. > +# skip running for other compilers. > +if {![test_compiler_info {gcc-*}]} { > + return 0 > +} I don't think this change relates to the name of the main function, right? So it should be split into a separate patch. > + > standard_testfile .S > > if { [prepare_for_testing "failed to prepare" "${testfile}" $srcfile \ > diff --git a/gdb/testsuite/gdb.fortran/array-bounds-high.exp b/gdb/testsuite/gdb.fortran/array-bounds-high.exp > index 81e2f87b89..f1945b4112 100644 > --- a/gdb/testsuite/gdb.fortran/array-bounds-high.exp > +++ b/gdb/testsuite/gdb.fortran/array-bounds-high.exp > @@ -20,13 +20,14 @@ if { [skip_fortran_tests] } { return -1 } > > set testfile "array-bounds-high" > standard_testfile .f90 > +load_lib fortran.exp > > if {[prepare_for_testing $testfile.exp $testfile $srcfile {f90 debug}]} { > return -1 > } > > -if {![runto MAIN__]} { > - perror "Could not run to breakpoint `MAIN__'." > +if {![runto $fmain]} { > + perror "Could not run to breakpoint `$fmain'." > continue > } > > diff --git a/gdb/testsuite/gdb.fortran/array-bounds.exp b/gdb/testsuite/gdb.fortran/array-bounds.exp > index 12bf5c2db3..be28ff6da9 100644 > --- a/gdb/testsuite/gdb.fortran/array-bounds.exp > +++ b/gdb/testsuite/gdb.fortran/array-bounds.exp > @@ -20,13 +20,14 @@ if { [skip_fortran_tests] } { return -1 } > > set testfile "array-bounds" > standard_testfile .f90 > +load_lib fortran.exp > > if {[prepare_for_testing $testfile.exp $testfile $srcfile {f90 debug}]} { > return -1 > } > > -if {![runto MAIN__]} { > - perror "Could not run to breakpoint `MAIN__'." > +if {![runto $fmain]} { > + perror "Could not run to breakpoint `$fmain'." > continue > } > > diff --git a/gdb/testsuite/gdb.fortran/array-slices.exp b/gdb/testsuite/gdb.fortran/array-slices.exp > index 11997f926a..e91db62aa1 100644 > --- a/gdb/testsuite/gdb.fortran/array-slices.exp > +++ b/gdb/testsuite/gdb.fortran/array-slices.exp > @@ -21,13 +21,14 @@ > if {[skip_fortran_tests]} { return -1 } > > standard_testfile ".f90" > +load_lib fortran.exp > > if {[prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} \ > {debug f90}]} { > return -1 > } > > -if ![runto_main] { > +if ![runto $fmain] { Out of interest, how is this test even passing on gFortran? runto_main should place a breakpoint on 'main', and I can't see any obvious special case handling for Fortran. And my main thought is that what we should do is override runto_main in lib/fortran.exp, and then switch all of the test over to using that instead, this would be more consistent with how the C/C++ tests work then. Thanks, Andrew > untested "could not run to main" > return -1 > } > diff --git a/gdb/testsuite/gdb.fortran/block-data.exp b/gdb/testsuite/gdb.fortran/block-data.exp > index 292afe6c16..520f0d5d28 100644 > --- a/gdb/testsuite/gdb.fortran/block-data.exp > +++ b/gdb/testsuite/gdb.fortran/block-data.exp > @@ -30,8 +30,8 @@ if {[prepare_for_testing $testfile.exp $testfile $srcfile {debug f90}]} { > return -1 > } > > -if ![runto MAIN__] then { > - untested "couldn't run to breakpoint MAIN__" > +if ![runto $fmain] then { > + untested "couldn't run to breakpoint $fmain" > return -1 > } > > diff --git a/gdb/testsuite/gdb.fortran/charset.exp b/gdb/testsuite/gdb.fortran/charset.exp > index f0f62f8490..11ab9dfdf0 100644 > --- a/gdb/testsuite/gdb.fortran/charset.exp > +++ b/gdb/testsuite/gdb.fortran/charset.exp > @@ -19,12 +19,14 @@ > if { [skip_fortran_tests] } { return -1 } > > standard_testfile .f90 > +load_lib fortran.exp > + > if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} {debug additional_flags=-fbackslash f90}] } { > return -1 > } > > -if ![runto MAIN__] { > - perror "Couldn't run to MAIN__" > +if ![runto $fmain] { > + perror "Couldn't run to $fmain" > continue > } > > diff --git a/gdb/testsuite/gdb.fortran/common-block.exp b/gdb/testsuite/gdb.fortran/common-block.exp > index 19c1af0d81..2b74a18e75 100644 > --- a/gdb/testsuite/gdb.fortran/common-block.exp > +++ b/gdb/testsuite/gdb.fortran/common-block.exp > @@ -27,8 +27,8 @@ if {[prepare_for_testing "failed to prepare" ${testfile} \ > return -1 > } > > -if ![runto MAIN__] then { > - perror "couldn't run to breakpoint MAIN__" > +if ![runto $fmain] then { > + perror "couldn't run to breakpoint $fmain" > continue > } > > diff --git a/gdb/testsuite/gdb.fortran/complex.exp b/gdb/testsuite/gdb.fortran/complex.exp > index c092ab29f1..8ac81c1fcb 100644 > --- a/gdb/testsuite/gdb.fortran/complex.exp > +++ b/gdb/testsuite/gdb.fortran/complex.exp > @@ -14,13 +14,14 @@ > # along with this program. If not, see . > > standard_testfile .f90 > +load_lib fortran.exp > > if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug f90 quiet}]} { > return -1 > } > > -if ![runto MAIN__] then { > - perror "Couldn't run to MAIN__" > +if ![runto $fmain] then { > + perror "Couldn't run to $fmain" > continue > } > > diff --git a/gdb/testsuite/gdb.fortran/derived-type-function.exp b/gdb/testsuite/gdb.fortran/derived-type-function.exp > index 1f0f957317..8a298f5f7b 100644 > --- a/gdb/testsuite/gdb.fortran/derived-type-function.exp > +++ b/gdb/testsuite/gdb.fortran/derived-type-function.exp > @@ -21,13 +21,14 @@ > if { [skip_fortran_tests] } { return -1 } > > standard_testfile .f90 > +load_lib fortran.exp > > if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug f90}]} { > return -1 > } > > -if ![runto MAIN__] then { > - perror "couldn't run to breakpoint MAIN__" > +if ![runto $fmain] then { > + perror "couldn't run to breakpoint $fmain" > continue > } > > diff --git a/gdb/testsuite/gdb.fortran/derived-type.exp b/gdb/testsuite/gdb.fortran/derived-type.exp > index f1705bffd8..eddd985e59 100644 > --- a/gdb/testsuite/gdb.fortran/derived-type.exp > +++ b/gdb/testsuite/gdb.fortran/derived-type.exp > @@ -27,8 +27,8 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug f90}]} { > return -1 > } > > -if ![runto MAIN__] then { > - perror "couldn't run to breakpoint MAIN__" > +if ![runto $fmain] then { > + perror "couldn't run to breakpoint $fmain" > continue > } > > diff --git a/gdb/testsuite/gdb.fortran/info-modules.exp b/gdb/testsuite/gdb.fortran/info-modules.exp > index 0c3c6a58e1..9967803dcc 100644 > --- a/gdb/testsuite/gdb.fortran/info-modules.exp > +++ b/gdb/testsuite/gdb.fortran/info-modules.exp > @@ -28,8 +28,8 @@ if { [prepare_for_testing "failed to prepare" $testfile \ > return -1 > } > > -if { ![runto MAIN__] } { > - perror "Could not run to breakpoint `MAIN__'." > +if { ![runto $fmain] } { > + perror "Could not run to breakpoint `$fmain'." > continue > } > > diff --git a/gdb/testsuite/gdb.fortran/info-types.exp b/gdb/testsuite/gdb.fortran/info-types.exp > index 2138937782..7f58740ed8 100644 > --- a/gdb/testsuite/gdb.fortran/info-types.exp > +++ b/gdb/testsuite/gdb.fortran/info-types.exp > @@ -27,8 +27,8 @@ if { [prepare_for_testing "failed to prepare" $testfile \ > return -1 > } > > -if { ![runto MAIN__] } { > - perror "Could not run to breakpoint `MAIN__'." > +if { ![runto $fmain] } { > + perror "Could not run to breakpoint `$fmain'." > continue > } > > diff --git a/gdb/testsuite/gdb.fortran/intrinsics.exp b/gdb/testsuite/gdb.fortran/intrinsics.exp > index 504bce4138..dca2d98cf4 100644 > --- a/gdb/testsuite/gdb.fortran/intrinsics.exp > +++ b/gdb/testsuite/gdb.fortran/intrinsics.exp > @@ -25,8 +25,8 @@ if { [prepare_for_testing "failed to prepare" $testfile $srcfile {debug f90}] } > return -1 > } > > -if { ![runto MAIN__] } { > - perror "Could not run to breakpoint `MAIN__'." > +if { ![runto $fmain] } { > + perror "Could not run to breakpoint `$fmain'." > continue > } > > diff --git a/gdb/testsuite/gdb.fortran/library-module.exp b/gdb/testsuite/gdb.fortran/library-module.exp > index f25988e32c..eb26551f4d 100644 > --- a/gdb/testsuite/gdb.fortran/library-module.exp > +++ b/gdb/testsuite/gdb.fortran/library-module.exp > @@ -40,9 +40,10 @@ if { [gdb_compile $srcdir/$subdir/$srcfile $binfile executable [list debug f90 > clean_restart $testfile > > gdb_load_shlib $libfile > +load_lib fortran.exp > > -if ![runto MAIN__] then { > - perror "couldn't run to breakpoint MAIN__" > +if ![runto $fmain] then { > + perror "couldn't run to breakpoint $fmain" > continue > } > > diff --git a/gdb/testsuite/gdb.fortran/logical.exp b/gdb/testsuite/gdb.fortran/logical.exp > index 324714fa49..ef5954aaf9 100644 > --- a/gdb/testsuite/gdb.fortran/logical.exp > +++ b/gdb/testsuite/gdb.fortran/logical.exp > @@ -16,13 +16,14 @@ > # This file was written by Jan Kratochvil . > > standard_testfile .f90 > +load_lib fortran.exp > > if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug f90 quiet}]} { > return -1 > } > > -if { ![runto MAIN__] } { > - perror "Could not run to breakpoint `MAIN__'." > +if { ![runto $fmain] } { > + perror "Could not run to breakpoint `$fmain'." > continue > } > > diff --git a/gdb/testsuite/gdb.fortran/max-depth.exp b/gdb/testsuite/gdb.fortran/max-depth.exp > index 262d0fdfa1..52b5a24b98 100644 > --- a/gdb/testsuite/gdb.fortran/max-depth.exp > +++ b/gdb/testsuite/gdb.fortran/max-depth.exp > @@ -26,8 +26,8 @@ if { [prepare_for_testing "failed to prepare" $testfile $srcfile {debug f90}] } > return -1 > } > > -if { ![runto MAIN__] } { > - perror "Could not run to breakpoint `MAIN__'." > +if { ![runto $fmain] } { > + perror "Could not run to breakpoint `$fmain'." > continue > } > > diff --git a/gdb/testsuite/gdb.fortran/module.exp b/gdb/testsuite/gdb.fortran/module.exp > index 1c269e2fed..9f5c79fba2 100644 > --- a/gdb/testsuite/gdb.fortran/module.exp > +++ b/gdb/testsuite/gdb.fortran/module.exp > @@ -29,8 +29,8 @@ gdb_test "p modmany::var_i" " = 14" "stopped language detection" > > gdb_test "print mod1::var_const" " = 20" "fully qualified name of DW_TAG_constant" > > -if ![runto MAIN__] then { > - perror "couldn't run to breakpoint MAIN__" > +if ![runto $fmain] then { > + perror "couldn't run to breakpoint $fmain" > continue > } > > @@ -123,7 +123,7 @@ complete "modmany::var" $modmany_list > # Breakpoint would work in language "c". > gdb_test "show language" {The current source language is "(auto; currently )?fortran".} > > -# gcc-4.4.2: The main program is always MAIN__ in .symtab so "runto" above > +# gcc-4.4.2: The main program is always $fmain in .symtab so "runto" above > # works. But DWARF DW_TAG_subprogram contains the name specified by > # the "program" Fortran statement. > if [gdb_breakpoint "module"] { > diff --git a/gdb/testsuite/gdb.fortran/multi-dim.exp b/gdb/testsuite/gdb.fortran/multi-dim.exp > index 05590914df..2567f166e2 100644 > --- a/gdb/testsuite/gdb.fortran/multi-dim.exp > +++ b/gdb/testsuite/gdb.fortran/multi-dim.exp > @@ -25,8 +25,8 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} {debug f90} > return -1 > } > > -if ![runto MAIN__] { > - perror "Couldn't run to MAIN__" > +if ![runto $fmain] { > + perror "Couldn't run to $fmain" > continue > } > > diff --git a/gdb/testsuite/gdb.fortran/nested-funcs.exp b/gdb/testsuite/gdb.fortran/nested-funcs.exp > index e4fc02ffa5..b68227cb5a 100755 > --- a/gdb/testsuite/gdb.fortran/nested-funcs.exp > +++ b/gdb/testsuite/gdb.fortran/nested-funcs.exp > @@ -25,8 +25,8 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug f90}]} { > return -1 > } > > -if ![runto MAIN__] then { > - perror "couldn't run to breakpoint MAIN__" > +if ![runto $fmain] then { > + perror "couldn't run to breakpoint $fmain" > continue > } > > diff --git a/gdb/testsuite/gdb.fortran/print-formatted.exp b/gdb/testsuite/gdb.fortran/print-formatted.exp > index 8c6529ce7f..cd12c6b3c4 100644 > --- a/gdb/testsuite/gdb.fortran/print-formatted.exp > +++ b/gdb/testsuite/gdb.fortran/print-formatted.exp > @@ -25,8 +25,8 @@ if { [prepare_for_testing "failed to prepare" $testfile $srcfile {debug f90}] } > return -1 > } > > -if { ![runto MAIN__] } { > - fail "runto MAIN__" > +if { ![runto $fmain] } { > + fail "runto $fmain" > return -1 > } > > diff --git a/gdb/testsuite/gdb.fortran/print_type.exp b/gdb/testsuite/gdb.fortran/print_type.exp > index 7d5915390d..615c2be226 100755 > --- a/gdb/testsuite/gdb.fortran/print_type.exp > +++ b/gdb/testsuite/gdb.fortran/print_type.exp > @@ -24,7 +24,7 @@ if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} \ > return -1 > } > > -if ![runto_main] { > +if ![runto $fmain] { > untested "could not run to main" > return -1 > } > diff --git a/gdb/testsuite/gdb.fortran/printing-types.exp b/gdb/testsuite/gdb.fortran/printing-types.exp > index 2c88f9e003..206cccd19b 100644 > --- a/gdb/testsuite/gdb.fortran/printing-types.exp > +++ b/gdb/testsuite/gdb.fortran/printing-types.exp > @@ -16,13 +16,14 @@ > if {[skip_fortran_tests]} { return -1 } > > standard_testfile .f90 > +load_lib fortran.exp > > if {[prepare_for_testing $testfile.exp $testfile $srcfile {debug f90}]} { > return -1 > } > > -if {![runto MAIN__]} then { > - untested "could not run to breakpoint MAIN__" > +if {![runto $fmain]} then { > + untested "could not run to breakpoint $fmain" > return -1 > } > > diff --git a/gdb/testsuite/gdb.fortran/ptr-indentation.exp b/gdb/testsuite/gdb.fortran/ptr-indentation.exp > index 285e24e2cc..bffd4983f0 100644 > --- a/gdb/testsuite/gdb.fortran/ptr-indentation.exp > +++ b/gdb/testsuite/gdb.fortran/ptr-indentation.exp > @@ -22,8 +22,8 @@ if {[prepare_for_testing $testfile.exp $testfile $srcfile {debug f90}]} { > return -1 > } > > -if {![runto MAIN__]} then { > - untested "couldn't run to breakpoint MAIN__" > +if {![runto $fmain]} then { > + untested "couldn't run to breakpoint $fmain" > return -1 > } > > diff --git a/gdb/testsuite/gdb.fortran/ptype-on-functions.exp b/gdb/testsuite/gdb.fortran/ptype-on-functions.exp > index d91e4bd48e..bf1f5d8637 100644 > --- a/gdb/testsuite/gdb.fortran/ptype-on-functions.exp > +++ b/gdb/testsuite/gdb.fortran/ptype-on-functions.exp > @@ -24,8 +24,8 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug f90}]} { > return -1 > } > > -if ![runto MAIN__] then { > - perror "couldn't run to breakpoint MAIN__" > +if ![runto $fmain] then { > + perror "couldn't run to breakpoint $fmain" > continue > } > > diff --git a/gdb/testsuite/gdb.fortran/subarray.exp b/gdb/testsuite/gdb.fortran/subarray.exp > index 5e3e8c38cb..c8aa5fe829 100644 > --- a/gdb/testsuite/gdb.fortran/subarray.exp > +++ b/gdb/testsuite/gdb.fortran/subarray.exp > @@ -21,6 +21,7 @@ > if { [skip_fortran_tests] } { return -1 } > > standard_testfile .f > +load_lib fortran.exp > > if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug f90}]} { > return -1 > @@ -31,8 +32,8 @@ gdb_start > gdb_reinitialize_dir $srcdir/$subdir > gdb_load ${binfile} > > -if ![runto MAIN__] then { > - perror "couldn't run to breakpoint MAIN__" > +if ![runto $fmain] then { > + perror "couldn't run to breakpoint $fmain" > continue > } > > diff --git a/gdb/testsuite/gdb.fortran/vla-alloc-assoc.exp b/gdb/testsuite/gdb.fortran/vla-alloc-assoc.exp > index 5d8585c2ee..ba1ee8e58c 100644 > --- a/gdb/testsuite/gdb.fortran/vla-alloc-assoc.exp > +++ b/gdb/testsuite/gdb.fortran/vla-alloc-assoc.exp > @@ -14,13 +14,14 @@ > # along with this program. If not, see . > > standard_testfile "vla.f90" > +load_lib fortran.exp > > if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} \ > {debug f90 quiet}] } { > return -1 > } > > -if ![runto_main] { > +if ![runto $fmain] { > untested "could not run to main" > return -1 > } > diff --git a/gdb/testsuite/gdb.fortran/vla-datatypes.exp b/gdb/testsuite/gdb.fortran/vla-datatypes.exp > index 2db9b3e110..b4c4b198c3 100644 > --- a/gdb/testsuite/gdb.fortran/vla-datatypes.exp > +++ b/gdb/testsuite/gdb.fortran/vla-datatypes.exp > @@ -24,7 +24,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} \ > # check that all fortran standard datatypes will be > # handled correctly when using as VLA's > > -if ![runto_main] { > +if ![runto $fmain] { > untested "could not run to main" > return -1 > } > diff --git a/gdb/testsuite/gdb.fortran/vla-history.exp b/gdb/testsuite/gdb.fortran/vla-history.exp > index 24bd945f4a..aa38d5288c 100644 > --- a/gdb/testsuite/gdb.fortran/vla-history.exp > +++ b/gdb/testsuite/gdb.fortran/vla-history.exp > @@ -14,13 +14,14 @@ > # along with this program. If not, see . > > standard_testfile "vla.f90" > +load_lib fortran.exp > > if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} \ > {debug f90 quiet}] } { > return -1 > } > > -if ![runto_main] { > +if ![runto $fmain] { > untested "could not run to main" > return -1 > } > diff --git a/gdb/testsuite/gdb.fortran/vla-ptr-info.exp b/gdb/testsuite/gdb.fortran/vla-ptr-info.exp > index 24c7b45840..1538f689e2 100644 > --- a/gdb/testsuite/gdb.fortran/vla-ptr-info.exp > +++ b/gdb/testsuite/gdb.fortran/vla-ptr-info.exp > @@ -14,13 +14,14 @@ > # along with this program. If not, see . > > standard_testfile "vla.f90" > +load_lib fortran.exp > > if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} \ > {debug f90 quiet}] } { > return -1 > } > > -if ![runto_main] { > +if ![runto $fmain] { > untested "could not run to main" > return -1 > } > diff --git a/gdb/testsuite/gdb.fortran/vla-ptype-sub.exp b/gdb/testsuite/gdb.fortran/vla-ptype-sub.exp > index 09909e74b0..90455601e4 100644 > --- a/gdb/testsuite/gdb.fortran/vla-ptype-sub.exp > +++ b/gdb/testsuite/gdb.fortran/vla-ptype-sub.exp > @@ -21,7 +21,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} \ > return -1 > } > > -if ![runto_main] { > +if ![runto $fmain] { > untested "could not run to main" > return -1 > } > diff --git a/gdb/testsuite/gdb.fortran/vla-ptype.exp b/gdb/testsuite/gdb.fortran/vla-ptype.exp > index 22b2005317..39d00a32c2 100644 > --- a/gdb/testsuite/gdb.fortran/vla-ptype.exp > +++ b/gdb/testsuite/gdb.fortran/vla-ptype.exp > @@ -21,7 +21,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} \ > return -1 > } > > -if ![runto_main] { > +if ![runto $fmain] { > untested "could not run to main" > return -1 > } > diff --git a/gdb/testsuite/gdb.fortran/vla-sizeof.exp b/gdb/testsuite/gdb.fortran/vla-sizeof.exp > index 8e7d36314e..c826d96eb9 100644 > --- a/gdb/testsuite/gdb.fortran/vla-sizeof.exp > +++ b/gdb/testsuite/gdb.fortran/vla-sizeof.exp > @@ -14,13 +14,14 @@ > # along with this program. If not, see . > > standard_testfile "vla.f90" > +load_lib fortran.exp > > if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} \ > {debug f90 quiet}] } { > return -1 > } > > -if ![runto_main] { > +if ![runto $fmain] { > untested "could not run to main" > return -1 > } > diff --git a/gdb/testsuite/gdb.fortran/vla-type.exp b/gdb/testsuite/gdb.fortran/vla-type.exp > index 6d885e7889..d9b66ff395 100755 > --- a/gdb/testsuite/gdb.fortran/vla-type.exp > +++ b/gdb/testsuite/gdb.fortran/vla-type.exp > @@ -21,7 +21,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} \ > return -1 > } > > -if ![runto_main] { > +if ![runto $fmain] { > untested "could not run to main" > return -1 > } > diff --git a/gdb/testsuite/gdb.fortran/vla-value-sub-arbitrary.exp b/gdb/testsuite/gdb.fortran/vla-value-sub-arbitrary.exp > index ab61dde06f..a18b4e4209 100644 > --- a/gdb/testsuite/gdb.fortran/vla-value-sub-arbitrary.exp > +++ b/gdb/testsuite/gdb.fortran/vla-value-sub-arbitrary.exp > @@ -14,13 +14,14 @@ > # along with this program. If not, see . > > standard_testfile "vla-sub.f90" > +load_lib fortran.exp > > if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} \ > {debug f90 quiet}] } { > return -1 > } > > -if ![runto_main] { > +if ![runto $fmain] { > untested "could not run to main" > return -1 > } > diff --git a/gdb/testsuite/gdb.fortran/vla-value-sub-finish.exp b/gdb/testsuite/gdb.fortran/vla-value-sub-finish.exp > index afd992cee4..a056fc2732 100644 > --- a/gdb/testsuite/gdb.fortran/vla-value-sub-finish.exp > +++ b/gdb/testsuite/gdb.fortran/vla-value-sub-finish.exp > @@ -14,13 +14,14 @@ > # along with this program. If not, see . > > standard_testfile "vla-sub.f90" > +load_lib fortran.exp > > if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} \ > {debug f90 quiet}] } { > return -1 > } > > -if ![runto_main] { > +if ![runto $fmain] { > untested "could not run to main" > return -1 > } > diff --git a/gdb/testsuite/gdb.fortran/vla-value-sub.exp b/gdb/testsuite/gdb.fortran/vla-value-sub.exp > index 3311f6befa..e0a42260a4 100644 > --- a/gdb/testsuite/gdb.fortran/vla-value-sub.exp > +++ b/gdb/testsuite/gdb.fortran/vla-value-sub.exp > @@ -14,13 +14,14 @@ > # along with this program. If not, see . > > standard_testfile "vla-sub.f90" > +load_lib fortran.exp > > if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} \ > {debug f90 quiet}] } { > return -1 > } > > -if ![runto_main] { > +if ![runto $fmain] { > untested "could not run to main" > return -1 > } > diff --git a/gdb/testsuite/gdb.fortran/vla-value.exp b/gdb/testsuite/gdb.fortran/vla-value.exp > index 5af17b570c..994a5a3e7a 100644 > --- a/gdb/testsuite/gdb.fortran/vla-value.exp > +++ b/gdb/testsuite/gdb.fortran/vla-value.exp > @@ -21,7 +21,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} \ > return -1 > } > > -if ![runto_main] { > +if ![runto $fmain] { > untested "could not run to main" > return -1 > } > @@ -129,8 +129,8 @@ gdb_test "print vla1(9, 9, 9)" "no such vector element \\\(vector not allocated\ > # Try to assign VLA to user variable > clean_restart ${testfile} > > -if ![runto MAIN__] then { > - perror "couldn't run to breakpoint MAIN__" > +if ![runto $fmain] then { > + perror "couldn't run to breakpoint $fmain" > continue > } > gdb_breakpoint [gdb_get_line_number "vla2-allocated"] > diff --git a/gdb/testsuite/gdb.fortran/whatis_type.exp b/gdb/testsuite/gdb.fortran/whatis_type.exp > index 6a9cc0a81e..8a9a1eb79f 100644 > --- a/gdb/testsuite/gdb.fortran/whatis_type.exp > +++ b/gdb/testsuite/gdb.fortran/whatis_type.exp > @@ -23,8 +23,8 @@ if { [prepare_for_testing "failed to prepare" ${testfile} \ > return -1 > } > > -if ![runto MAIN__] { > - fail "run to MAIN__" > +if ![runto $fmain] { > + fail "run to $fmain" > return > } > > diff --git a/gdb/testsuite/gdb.mi/mi-var-child-f.exp b/gdb/testsuite/gdb.mi/mi-var-child-f.exp > index 8cfffa7c08..363da0b7ed 100644 > --- a/gdb/testsuite/gdb.mi/mi-var-child-f.exp > +++ b/gdb/testsuite/gdb.mi/mi-var-child-f.exp > @@ -36,7 +36,7 @@ if {[gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" \ > mi_gdb_reinitialize_dir $srcdir/$subdir > mi_gdb_load ${binfile} > > -mi_runto MAIN__ > +mi_runto $fmain > > mi_create_varobj "array" "array" "create local variable array" > > diff --git a/gdb/testsuite/lib/fortran.exp b/gdb/testsuite/lib/fortran.exp > index 549ed65790..0bd95504c8 100644 > --- a/gdb/testsuite/lib/fortran.exp > +++ b/gdb/testsuite/lib/fortran.exp > @@ -18,6 +18,8 @@ > # Auxiliary function to set the language to fortran. > # The result is 1 (true) for success, 0 (false) for failure. > > +global fmain > + > proc set_lang_fortran {} { > if [gdb_test_no_output "set language fortran"] { > return 0 > @@ -126,3 +128,17 @@ proc fortran_character1 {} { > return "unknown" > } > } > + > +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" > + } > +} > + > +set fmain [fortran_main] > -- > 2.17.1