From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by sourceware.org (Postfix) with ESMTPS id F364B383CCEA for ; Wed, 31 Aug 2022 09:37:18 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org F364B383CCEA X-IronPort-AV: E=McAfee;i="6500,9779,10455"; a="292988058" X-IronPort-AV: E=Sophos;i="5.93,277,1654585200"; d="scan'208";a="292988058" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Aug 2022 02:37:17 -0700 X-IronPort-AV: E=Sophos;i="5.93,277,1654585200"; d="scan'208";a="641781523" Received: from labpcdell3650-003.iul.intel.com (HELO localhost) ([172.28.49.87]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Aug 2022 02:37:16 -0700 From: Nils-Christian Kempke To: gdb-patches@sourceware.org Cc: tom@tromey.com, Nils-Christian Kempke Subject: [PATCH v2 3/4] testsuite, fortran: adapt tests for ifort's 'start' behavior Date: Wed, 31 Aug 2022 11:36:49 +0200 Message-Id: <20220831093650.674582-4-nils-christian.kempke@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220831093650.674582-1-nils-christian.kempke@intel.com> References: <20220831093650.674582-1-nils-christian.kempke@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-10.3 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) 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: Wed, 31 Aug 2022 09:37:24 -0000 The modified tests array-slices-bad.exp and vla-type.exp both set a breakpoint at the first real statement in the respective executables. Normally, the expected behavior of fortran_runto_main for these would be the stopping of the debugger at exactly the first statment in the code. Strangely, neither gfortran nor ifx seem to do this for these tests. Instead, issuing 'start' in ifx (for either of the 2 tests) lets GDB stop at the 'program ...' line and gfortran stops at a variable declaration line. E.g. for vla-type it stops at 41 type(five) :: fivearr (2) So, actually, ifort's behavior can be considered to be a bit more 'correct' here. This patch remove the fortran_runto_main in the two tests and instead uses runto to directly run to the first breakpoint set at the first program statement. This works with both compiler behaviors and makes the tests more robust. --- gdb/testsuite/gdb.fortran/array-slices-bad.exp | 13 +++++-------- gdb/testsuite/gdb.fortran/vla-type.exp | 11 +++-------- 2 files changed, 8 insertions(+), 16 deletions(-) diff --git a/gdb/testsuite/gdb.fortran/array-slices-bad.exp b/gdb/testsuite/gdb.fortran/array-slices-bad.exp index b832fea292a..a9da37bc3dd 100644 --- a/gdb/testsuite/gdb.fortran/array-slices-bad.exp +++ b/gdb/testsuite/gdb.fortran/array-slices-bad.exp @@ -28,20 +28,17 @@ if {[prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} \ # Avoid shared lib symbols. gdb_test_no_output "set auto-solib-add off" -if ![fortran_runto_main] { - return -1 -} - # Avoid libc symbols, in particular the 'array' type. gdb_test_no_output "nosharedlibrary" -# gdb_breakpoint [gdb_get_line_number "Display Message Breakpoint"] -gdb_breakpoint [gdb_get_line_number "First Breakpoint"] +if {![runto [gdb_get_line_number "First Breakpoint"]]} { + perror "couldn't run to breakpoint First Breakpoint" + return -1 +} + gdb_breakpoint [gdb_get_line_number "Second Breakpoint"] gdb_breakpoint [gdb_get_line_number "Final Breakpoint"] -gdb_continue_to_breakpoint "First Breakpoint" - # Access not yet allocated array. gdb_test "print other" " = " gdb_test "print other(0:4,2:3)" "array not allocated" diff --git a/gdb/testsuite/gdb.fortran/vla-type.exp b/gdb/testsuite/gdb.fortran/vla-type.exp index fc8494fe36c..1bc30dc7f15 100755 --- a/gdb/testsuite/gdb.fortran/vla-type.exp +++ b/gdb/testsuite/gdb.fortran/vla-type.exp @@ -23,19 +23,14 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} \ return -1 } -if ![fortran_runto_main] { - return -1 -} - # Depending on the compiler being used, the type names can be printed differently. set int [fortran_int4] # Check if not allocated VLA in type does not break # the debugger when accessing it. -# break main for Flang compiler already breaks here -if { ![test_compiler_info {flang-*} f90] } { - gdb_breakpoint [gdb_get_line_number "before-allocated"] - gdb_continue_to_breakpoint "before-allocated" +if {![runto [gdb_get_line_number "before-allocated"]]} { + perror "couldn't run to breakpoint before-allocated" + return -1 } gdb_test "print twov" " = \\\( ivla1 = , ivla2 = \\\)" \ -- 2.25.1 Intel Deutschland GmbH Registered Address: Am Campeon 10, 85579 Neubiberg, Germany Tel: +49 89 99 8853-0, 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