From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: gdb-patches@sourceware.org
Subject: [patch] Display Fortran strings in backtraces
Date: Tue, 29 Jul 2014 03:54:00 -0000 [thread overview]
Message-ID: <20140728214654.GA26290@host2.jankratochvil.net> (raw)
[-- Attachment #1: Type: text/plain, Size: 666 bytes --]
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
[-- Attachment #2: fortran-frame-string.patch --]
[-- Type: text/plain, Size: 3390 bytes --]
gdb/
2014-07-28 Jan Kratochvil <jan.kratochvil@redhat.com>
* valprint.c (val_print_scalar_type_p): For TYPE_CODE_STRING return 0.
gdb/testsuite/
2014-07-28 Jan Kratochvil <jan.kratochvil@redhat.com>
* 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 <jakub@redhat.com>.
+! Modified for the GDB testcase by Jan Kratochvil <jan.kratochvil@redhat.com>.
+
+ subroutine f(s)
+ character*3 s
+ s = s
+ end
+
+ program main
+ call f ('foo')
+ end
next reply other threads:[~2014-07-28 21:47 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-29 3:54 Jan Kratochvil [this message]
2014-07-29 16:23 ` Tom Tromey
2014-07-29 20:20 ` Joel Brobecker
2014-07-29 20:27 ` Jan Kratochvil
2014-07-29 21:08 ` Joel Brobecker
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140728214654.GA26290@host2.jankratochvil.net \
--to=jan.kratochvil@redhat.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox