From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by sourceware.org (Postfix) with ESMTPS id 4260B386F430 for ; Thu, 30 Jul 2020 15:47:59 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 4260B386F430 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=tdevries@suse.de X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id C705EAD65 for ; Thu, 30 Jul 2020 15:48:10 +0000 (UTC) Date: Thu, 30 Jul 2020 17:47:56 +0200 From: Tom de Vries To: gdb-patches@sourceware.org Subject: [committed][gdb/testsuite] Fix gdb.fortran/info-modules.exp with gcc-4.8 Message-ID: <20200730154755.GA20636@delia> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.10.1 (2018-07-13) X-Spam-Status: No, score=-10.8 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, KAM_NUMSUBJECT, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, 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: Thu, 30 Jul 2020 15:48:00 -0000 Hi, When running test-case gdb.fortran/info-modules.exp with gfortran 4.8.5, I get: ... FAIL: gdb.fortran/info-modules.exp: info module functions: \ check for entry 'info-types.f90', '35', \ 'void mod1::__copy_mod1_M1t1\(Type m1t1, Type m1t1\);' FAIL: gdb.fortran/info-modules.exp: info module functions -m mod1: \ check for entry 'info-types.f90', '35', \ 'void mod1::__copy_mod1_M1t1\(Type m1t1, Type m1t1\);' FAIL: gdb.fortran/info-modules.exp: info module variables: \ check for entry 'info-types.f90', '(35)?', \ 'Type m1t1 mod1::__def_init_mod1_M1t1;' FAIL: gdb.fortran/info-modules.exp: info module variables: \ check for entry 'info-types.f90', '(35)?', \ 'Type __vtype_mod1_M1t1 mod1::__vtab_mod1_M1t1;' ... With gfortran 7.5.0, we have: ... $ readelf -wi info-modules | egrep "DW_AT_name.*(copy|def_init|vtype)_mod1" <286> DW_AT_name : __def_init_mod1_M1t1 <29f> DW_AT_name : __vtype_mod1_M1t1 <3de> DW_AT_name : __copy_mod1_M1t1 $ ... but with gfortran 4.8.5: ... $ readelf -wi info-modules | egrep "DW_AT_name.*(copy|def_init|vtype)_mod1" $ ... Fix this by allowing these module functions and variables to be missing. Tested on x86_64-linux with gcc 4.8.5 and gcc 7.5.0. Committed to trunk. Thanks, - Tom [gdb/testsuite] Fix gdb.fortran/info-modules.exp with gcc-4.8 gdb/testsuite/ChangeLog: 2020-07-30 Tom de Vries * lib/sym-info-cmds.exp (GDBInfoModuleSymbols::check_entry_1): Factor out of ... (GDBInfoModuleSymbols::check_entry): ... here. (GDBInfoModuleSymbols::check_optional_entry): New proc. * gdb.fortran/info-modules.exp: Use check_optional_entry for entries related to __def_init_mod1_M1t1 / __vtype_mod1_M1t1 / __copy_mod1_M1t1. --- gdb/testsuite/gdb.fortran/info-modules.exp | 8 ++++---- gdb/testsuite/lib/sym-info-cmds.exp | 21 +++++++++++++++++++-- 2 files changed, 23 insertions(+), 6 deletions(-) diff --git a/gdb/testsuite/gdb.fortran/info-modules.exp b/gdb/testsuite/gdb.fortran/info-modules.exp index 02e35c207e..3af3d55e77 100644 --- a/gdb/testsuite/gdb.fortran/info-modules.exp +++ b/gdb/testsuite/gdb.fortran/info-modules.exp @@ -76,7 +76,7 @@ GDBInfoModuleSymbols::check_entry "${srcfile2}" "mod2" "22" \ "void mod2::sub_m2_a\\(${integer4}, ${logical4}\\);" GDBInfoModuleSymbols::check_entry "${srcfile2}" "mod2" "30" \ "${logical4} mod2::sub_m2_b\\(${real4}\\);" -GDBInfoModuleSymbols::check_entry "${srcfile}" "mod1" "35" \ +GDBInfoModuleSymbols::check_optional_entry "${srcfile}" "mod1" "35" \ "void mod1::__copy_mod1_M1t1\\(Type m1t1, Type m1t1\\);" GDBInfoModuleSymbols::check_entry "${srcfile}" "mod1" "25" \ "void mod1::sub_m1_a\\(${integer4}\\);" @@ -88,7 +88,7 @@ GDBInfoModuleSymbols::check_no_entry "${srcfile2}" ".*" GDBInfoModuleSymbols::run_command "info module functions -m mod1" GDBInfoModuleSymbols::check_header \ "All functions in all modules matching regular expression \"mod1\":" -GDBInfoModuleSymbols::check_entry "${srcfile}" "mod1" "35" \ +GDBInfoModuleSymbols::check_optional_entry "${srcfile}" "mod1" "35" \ "void mod1::__copy_mod1_M1t1\\(Type m1t1, Type m1t1\\);" GDBInfoModuleSymbols::check_entry "${srcfile}" "mod1" "25" \ "void mod1::sub_m1_a\\(${integer4}\\);" @@ -117,9 +117,9 @@ GDBInfoModuleSymbols::check_entry "${srcfile2}" "mod2" "19" \ "${integer4} mod2::mod2_var_1;" GDBInfoModuleSymbols::check_entry "${srcfile2}" "mod2" "20" \ "${real4} mod2::mod2_var_2;" -GDBInfoModuleSymbols::check_entry "${srcfile}" "mod1" "(35)?" \ +GDBInfoModuleSymbols::check_optional_entry "${srcfile}" "mod1" "(35)?" \ "Type m1t1 mod1::__def_init_mod1_M1t1;" -GDBInfoModuleSymbols::check_entry "${srcfile}" "mod1" "(35)?" \ +GDBInfoModuleSymbols::check_optional_entry "${srcfile}" "mod1" "(35)?" \ "Type __vtype_mod1_M1t1 mod1::__vtab_mod1_M1t1;" GDBInfoModuleSymbols::check_entry "${srcfile}" "mod1" "21" \ "${real4} mod1::mod1_var_1;" diff --git a/gdb/testsuite/lib/sym-info-cmds.exp b/gdb/testsuite/lib/sym-info-cmds.exp index 02f8b324b9..dd769ef131 100644 --- a/gdb/testsuite/lib/sym-info-cmds.exp +++ b/gdb/testsuite/lib/sym-info-cmds.exp @@ -421,7 +421,10 @@ namespace eval GDBInfoModuleSymbols { # If a matching entry is found then it is removed from the # _entries list, this allows us to check for duplicates using the # check_no_entry call. - proc check_entry { filename module lineno text { testname "" } } { + # + # If OPTIONAL, don't generate a FAIL for a mismatch, but use UNSUPPORTED + # instead. + proc check_entry_1 { filename module lineno text optional testname } { variable _entries variable _last_command @@ -458,7 +461,21 @@ namespace eval GDBInfoModuleSymbols { } set _entries $new_entries - gdb_assert { $found_match } $testname + if { $optional && ! $found_match } { + unsupported $testname + } else { + gdb_assert { $found_match } $testname + } + } + + # Call check_entry_1 with OPTIONAL == 0. + proc check_entry { filename module lineno text { testname "" } } { + check_entry_1 $filename $module $lineno $text 0 $testname + } + + # Call check_entry_1 with OPTIONAL == 1. + proc check_optional_entry { filename module lineno text { testname "" } } { + check_entry_1 $filename $module $lineno $text 1 $testname } # Check that there is no entry in the _entries list matching