From patchwork Mon Jul 28 21:46:54 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Kratochvil X-Patchwork-Id: 2201 Received: (qmail 16201 invoked by alias); 28 Jul 2014 21:47:01 -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 16184 invoked by uid 89); 28 Jul 2014 21:47:00 -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; Mon, 28 Jul 2014 21:46:59 +0000 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s6SLkwtG027846 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 28 Jul 2014 17:46:58 -0400 Received: from host2.jankratochvil.net (ovpn-116-29.ams2.redhat.com [10.36.116.29]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s6SLks72017858 (version=TLSv1/SSLv3 cipher=AES128-GCM-SHA256 bits=128 verify=NO) for ; Mon, 28 Jul 2014 17:46:57 -0400 Date: Mon, 28 Jul 2014 23:46:54 +0200 From: Jan Kratochvil To: gdb-patches@sourceware.org Subject: [patch] Display Fortran strings in backtraces Message-ID: <20140728214654.GA26290@host2.jankratochvil.net> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.23 (2014-03-12) X-IsSubscribed: yes Hi, for Fortran it fixes displaying normal strings also in frames/backtraces: (gdb) frame #0 f (s=..., _s=3) at ./gdb.fortran/fortran-frame-string.f90:24 -> #0 f (s='foo', _s=3) at ./gdb.fortran/fortran-frame-string.f90:24 The patch is simple and I do not see why it should not be this way. For C/C++ TYPE_CODE_STRING is not used. I am not aware of Pascal but that language is currently not really much supported in GDB anyway. This was a part of my archer/jankratochvil/vla branch but it is not a part of the Intel VLA patchset as it in fact is completely unrelated to "VLA". No regressions on {x86_64,x86_64-m32,i686}-fedora22pre-linux-gnu. Thanks, Jan gdb/ 2014-07-28 Jan Kratochvil * valprint.c (val_print_scalar_type_p): For TYPE_CODE_STRING return 0. gdb/testsuite/ 2014-07-28 Jan Kratochvil * gdb.fortran/fortran-frame-string.exp: New file. * gdb.fortran/fortran-frame-string.f90: New file. diff --git a/gdb/valprint.c b/gdb/valprint.c index 8600b34..c3d10f9 100644 --- a/gdb/valprint.c +++ b/gdb/valprint.c @@ -290,7 +290,6 @@ val_print_scalar_type_p (struct type *type) case TYPE_CODE_STRUCT: case TYPE_CODE_UNION: case TYPE_CODE_SET: - case TYPE_CODE_STRING: return 0; default: return 1; diff --git a/gdb/testsuite/gdb.fortran/fortran-frame-string.exp b/gdb/testsuite/gdb.fortran/fortran-frame-string.exp new file mode 100644 index 0000000..e9d7bc0 --- /dev/null +++ b/gdb/testsuite/gdb.fortran/fortran-frame-string.exp @@ -0,0 +1,32 @@ +# Copyright 2014 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. + +standard_testfile .f90 +if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} {debug f90}] } { + return -1 +} + +if ![runto MAIN__] then { + perror "couldn't run to breakpoint MAIN__" + continue +} + +gdb_breakpoint [gdb_get_line_number "s = s"] +gdb_continue_to_breakpoint "s = s" + +gdb_test "ptype s" {type = character\*3} +gdb_test "p s" " = 'foo'" +gdb_test "frame" { \(s='foo', .*} diff --git a/gdb/testsuite/gdb.fortran/fortran-frame-string.f90 b/gdb/testsuite/gdb.fortran/fortran-frame-string.f90 new file mode 100644 index 0000000..3d1576f --- /dev/null +++ b/gdb/testsuite/gdb.fortran/fortran-frame-string.f90 @@ -0,0 +1,28 @@ +! Copyright 2014 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 f(s) + character*3 s + s = s + end + + program main + call f ('foo') + end