From patchwork Fri Aug 1 21:02:17 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Kratochvil X-Patchwork-Id: 2287 Received: (qmail 6505 invoked by alias); 1 Aug 2014 21:02:26 -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 6496 invoked by uid 89); 1 Aug 2014 21:02:26 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.4 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD, SPF_HELO_PASS, SPF_PASS, UNSUBSCRIBE_BODY autolearn=no version=3.3.2 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 (AES256-GCM-SHA384 encrypted) ESMTPS; Fri, 01 Aug 2014 21:02:24 +0000 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s71L2MGg003643 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 1 Aug 2014 17:02:22 -0400 Received: from host2.jankratochvil.net (ovpn-116-57.ams2.redhat.com [10.36.116.57]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s71L2IX7015165 (version=TLSv1/SSLv3 cipher=AES128-GCM-SHA256 bits=128 verify=NO); Fri, 1 Aug 2014 17:02:20 -0400 Date: Fri, 1 Aug 2014 23:02:17 +0200 From: Jan Kratochvil To: Keven Boell Cc: Keven Boell , gdb-patches@sourceware.org, sanimir.agovic@intel.com Subject: [patch 1/2] Re: Crash regression(?) printing Fortran strings in bt [Re: [V2 00/23] Fortran dynamic array support] Message-ID: <20140801210217.GA26015@host2.jankratochvil.net> References: <1405070495-6948-1-git-send-email-keven.boell@intel.com> <20140729183023.GA17443@host2.jankratochvil.net> <20140729202710.GA20874@host2.jankratochvil.net> <53DB3FB3.6050601@linux.intel.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <53DB3FB3.6050601@linux.intel.com> User-Agent: Mutt/1.5.23 (2014-03-12) X-IsSubscribed: yes 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 diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c index 53cae2c..cf7ac26 100644 --- a/gdb/gdbtypes.c +++ b/gdb/gdbtypes.c @@ -1659,6 +1659,7 @@ is_dynamic_type_internal (struct type *type, int top_level) return !has_static_range (TYPE_RANGE_DATA (type)); case TYPE_CODE_ARRAY: + case TYPE_CODE_STRING: { gdb_assert (TYPE_NFIELDS (type) == 1); diff --git a/gdb/testsuite/gdb.fortran/dynamic-other-frame-stub.f90 b/gdb/testsuite/gdb.fortran/dynamic-other-frame-stub.f90 new file mode 100644 index 0000000..261ce17 --- /dev/null +++ b/gdb/testsuite/gdb.fortran/dynamic-other-frame-stub.f90 @@ -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 diff --git a/gdb/testsuite/gdb.fortran/dynamic-other-frame.exp b/gdb/testsuite/gdb.fortran/dynamic-other-frame.exp new file mode 100644 index 0000000..570a28c --- /dev/null +++ b/gdb/testsuite/gdb.fortran/dynamic-other-frame.exp @@ -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'.*} diff --git a/gdb/testsuite/gdb.fortran/dynamic-other-frame.f90 b/gdb/testsuite/gdb.fortran/dynamic-other-frame.f90 new file mode 100644 index 0000000..2bc637d --- /dev/null +++ b/gdb/testsuite/gdb.fortran/dynamic-other-frame.f90 @@ -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