From patchwork Thu Sep 1 09:48:03 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Kratochvil X-Patchwork-Id: 15151 Received: (qmail 99056 invoked by alias); 1 Sep 2016 09:48:22 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 99047 invoked by uid 89); 1 Sep 2016 09:48:21 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.6 required=5.0 tests=BAYES_00, KAM_ASCII_DIVIDERS, RP_MATCHES_RCVD, SPF_HELO_PASS, UNSUBSCRIBE_BODY autolearn=no version=3.3.2 spammy=keven, Keven, temple, Temple X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 01 Sep 2016 09:48:11 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 29903C057FAC; Thu, 1 Sep 2016 09:48:08 +0000 (UTC) Received: from host1.jankratochvil.net (ovpn-116-46.ams2.redhat.com [10.36.116.46]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u819m31D021752 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 1 Sep 2016 05:48:06 -0400 Date: Thu, 1 Sep 2016 11:48:03 +0200 From: Jan Kratochvil To: Bernhard Heckel Cc: "Weinmann, Christoph T" , gdb-patches@sourceware.org Subject: Re: [V4 00/21] Fortran dynamic array support Message-ID: <20160901094803.GA6858@host1.jankratochvil.net> References: <88072818E0A3D742B2B1AF16BBEC65A7263E6F2E@IRSMSX107.ger.corp.intel.com> <20160715091352.GA8059@host1.jankratochvil.net> <88072818E0A3D742B2B1AF16BBEC65A7263E8FD9@IRSMSX107.ger.corp.intel.com> <20160716151310.GA14331@host1.jankratochvil.net> <20160716151837.GA797@host1.jankratochvil.net> <88072818E0A3D742B2B1AF16BBEC65A7263F0988@IRSMSX107.ger.corp.intel.com> <20160816135920.GA26624@host1.jankratochvil.net> <57B6D831.4080605@intel.com> <20160821170346.GA21909@host1.jankratochvil.net> <57BC50D1.4020102@intel.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <57BC50D1.4020102@intel.com> User-Agent: Mutt/1.7.0 (2016-08-17) X-IsSubscribed: yes On Tue, 23 Aug 2016 15:34:09 +0200, Bernhard Heckel wrote: > created a branch with all stride patches. users/bheckel/fortran-strides 2c392d41a3f2e38deeb9db5b7a93ca45682bbe3b > I don't see regression on RH7.1, gcc 4.8.3-9 I see a regression in Fedora-specific testcase, attaching it also with a fix. Although it does not work just on your branch, apparently it has some dependency on other Fedora patches. http://pkgs.fedoraproject.org/cgit/rpms/gdb.git/tree/ It can be resolved later for upstream GDB I guess. Jan http://sourceware.org/ml/gdb-patches/2014-08/msg00025.html Subject: [patch 1/2] Re: Crash regression(?) printing Fortran strings in bt [Re: [V2 00/23] Fortran dynamic array support] --FCuugMFkClbJLl1L Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Fri, 01 Aug 2014 09:20:19 +0200, Keven Boell wrote: > I just tried it on Fedora 20 i686. Applied the patch, you mentioned, on top of > the Fortran VLA series and executed your dynamic-other-frame test. Everything > is working fine here, I cannot reproduce the crash. I have it reproducible on Fedora 20 i686 with plain CFLAGS=-g ./configure;make;cd gdb/testsuite;make site.exp;runtest gdb.fortran/dynamic-other-frame.exp Besides that I have updated the testcase with gdb_test_no_output "set print frame-arguments all" so that there is no longer needed the patch: [patch] Display Fortran strings in backtraces https://sourceware.org/ml/gdb-patches/2014-07/msg00709.html The fix below has no regressions for me. Unfortunately I do not see why you cannot reproduce it. Thanks, Jan --- ./gdb/dwarf2loc.c 2016-08-29 04:01:25.000000000 +0200 +++ ./gdb/dwarf2loc.c 2016-09-01 11:00:20.258909494 +0200 @@ -2289,6 +2289,15 @@ const struct dwarf_expr_context_funcs dw dwarf_expr_get_obj_addr }; +static void +select_frame_cleanup (void *arg) +{ + struct frame_info *frame = (struct frame_info *) arg; + + if (frame != NULL) + select_frame (frame); +} + /* Evaluate a location description, starting at DATA and with length SIZE, to find the current location of variable of TYPE in the context of FRAME. BYTE_OFFSET is applied after the contents are @@ -2318,6 +2327,11 @@ dwarf2_evaluate_loc_desc_full (struct ty ctx = new_dwarf_expr_context (); old_chain = make_cleanup_free_dwarf_expr_context (ctx); + + make_cleanup (select_frame_cleanup, deprecated_safe_get_selected_frame ()); + if (frame != NULL) + select_frame (frame); + value_chain = make_cleanup_value_free_to_mark (value_mark ()); ctx->gdbarch = get_objfile_arch (objfile); Index: gdb-7.9.50.20150520/gdb/testsuite/gdb.fortran/dynamic-other-frame-stub.f90 =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ gdb-7.9.50.20150520/gdb/testsuite/gdb.fortran/dynamic-other-frame-stub.f90 2015-05-31 16:14:05.844545344 +0200 @@ -0,0 +1,24 @@ +! Copyright 2010 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 2 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, write to the Free Software +! Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +! +! Ihis file is the Fortran source file for dynamic.exp. +! Original file written by Jakub Jelinek . +! Modified for the GDB testcase by Jan Kratochvil . + +subroutine bar + real :: dummy + dummy = 1 +end subroutine bar Index: gdb-7.9.50.20150520/gdb/testsuite/gdb.fortran/dynamic-other-frame.exp =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ gdb-7.9.50.20150520/gdb/testsuite/gdb.fortran/dynamic-other-frame.exp 2015-05-31 16:14:05.845545351 +0200 @@ -0,0 +1,39 @@ +# Copyright 2010 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 2 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, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +set testfile "dynamic-other-frame" +set srcfile1 ${testfile}.f90 +set srcfile2 ${testfile}-stub.f90 +set objfile2 [standard_output_file ${testfile}-stub.o] +set executable ${testfile} +set binfile [standard_output_file ${executable}] + +if { [gdb_compile "${srcdir}/${subdir}/${srcfile2}" "${objfile2}" object {f90}] != "" + || [gdb_compile "${srcdir}/${subdir}/${srcfile1} ${objfile2}" "${binfile}" executable {debug f90}] != "" } { + untested "Couldn't compile ${srcfile1} or ${srcfile2}" + return -1 +} + +clean_restart ${executable} + +gdb_test_no_output "set print frame-arguments all" + +if ![runto bar_] then { + perror "couldn't run to bar_" + continue +} + +gdb_test "bt" {foo \(string='hello'.*} Index: gdb-7.9.50.20150520/gdb/testsuite/gdb.fortran/dynamic-other-frame.f90 =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ gdb-7.9.50.20150520/gdb/testsuite/gdb.fortran/dynamic-other-frame.f90 2015-05-31 16:14:05.845545351 +0200 @@ -0,0 +1,36 @@ +! Copyright 2010 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 2 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, write to the Free Software +! Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +! +! Ihis file is the Fortran source file for dynamic.exp. +! Original file written by Jakub Jelinek . +! Modified for the GDB testcase by Jan Kratochvil . + +subroutine foo (string) + interface + subroutine bar + end subroutine + end interface + character string*(*) + call bar ! stop-here +end subroutine foo +program test + interface + subroutine foo (string) + character string*(*) + end subroutine + end interface + call foo ('hello') +end