405ea9
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
405ea9
From: Fedora GDB patches <invalid@email.com>
405ea9
Date: Fri, 27 Oct 2017 21:07:50 +0200
405ea9
Subject: gdb-fortran-frame-string.patch
405ea9
405ea9
;; Display Fortran strings in backtraces.
405ea9
;;=fedoratest
405ea9
405ea9
http://sourceware.org/ml/gdb-patches/2014-07/msg00709.html
405ea9
405ea9
Hi,
405ea9
405ea9
for Fortran it fixes displaying normal strings also in frames/backtraces:
405ea9
405ea9
(gdb) frame
405ea9
->
405ea9
405ea9
The patch is simple and I do not see why it should not be this way.
405ea9
405ea9
For C/C++ TYPE_CODE_STRING is not used.  I am not aware of Pascal but that
405ea9
language is currently not really much supported in GDB anyway.
405ea9
405ea9
This was a part of my archer/jankratochvil/vla branch but it is not a part of
405ea9
the Intel VLA patchset as it in fact is completely unrelated to "VLA".
405ea9
405ea9
No regressions on {x86_64,x86_64-m32,i686}-fedora22pre-linux-gnu.
405ea9
405ea9
Thanks,
405ea9
Jan
405ea9
405ea9
diff --git a/gdb/testsuite/gdb.fortran/fortran-frame-string.exp b/gdb/testsuite/gdb.fortran/fortran-frame-string.exp
405ea9
new file mode 100644
405ea9
--- /dev/null
405ea9
+++ b/gdb/testsuite/gdb.fortran/fortran-frame-string.exp
405ea9
@@ -0,0 +1,36 @@
405ea9
+# Copyright 2014 Free Software Foundation, Inc.
405ea9
+
405ea9
+# This program is free software; you can redistribute it and/or modify
405ea9
+# it under the terms of the GNU General Public License as published by
405ea9
+# the Free Software Foundation; either version 2 of the License, or
405ea9
+# (at your option) any later version.
405ea9
+#
405ea9
+# This program is distributed in the hope that it will be useful,
405ea9
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
405ea9
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
405ea9
+# GNU General Public License for more details.
405ea9
+#
405ea9
+# You should have received a copy of the GNU General Public License
405ea9
+# along with this program; if not, write to the Free Software
405ea9
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
405ea9
+
405ea9
+standard_testfile .f90
405ea9
+if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} {debug f90}] } {
405ea9
+    return -1
405ea9
+}
405ea9
+
405ea9
+if ![runto MAIN__] then {
405ea9
+    perror "couldn't run to breakpoint MAIN__"
405ea9
+    continue
405ea9
+}
405ea9
+
405ea9
+gdb_breakpoint [gdb_get_line_number "s = s"]
405ea9
+gdb_continue_to_breakpoint "s = s"
405ea9
+
405ea9
+gdb_test "ptype s" {type = character\*3}
405ea9
+gdb_test "p s" " = 'foo'"
405ea9
+
405ea9
+# Fix rejected upstream:
405ea9
+# https://sourceware.org/ml/gdb-patches/2014-07/msg00768.html
405ea9
+setup_kfail "rejected" *-*-*
405ea9
+gdb_test "frame" { \(s='foo', .*}
405ea9
diff --git a/gdb/testsuite/gdb.fortran/fortran-frame-string.f90 b/gdb/testsuite/gdb.fortran/fortran-frame-string.f90
405ea9
new file mode 100644
405ea9
--- /dev/null
405ea9
+++ b/gdb/testsuite/gdb.fortran/fortran-frame-string.f90
405ea9
@@ -0,0 +1,28 @@
405ea9
+! Copyright 2014 Free Software Foundation, Inc.
405ea9
+!
405ea9
+! This program is free software; you can redistribute it and/or modify
405ea9
+! it under the terms of the GNU General Public License as published by
405ea9
+! the Free Software Foundation; either version 2 of the License, or
405ea9
+! (at your option) any later version.
405ea9
+!
405ea9
+! This program is distributed in the hope that it will be useful,
405ea9
+! but WITHOUT ANY WARRANTY; without even the implied warranty of
405ea9
+! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
405ea9
+! GNU General Public License for more details.
405ea9
+!
405ea9
+! You should have received a copy of the GNU General Public License
405ea9
+! along with this program; if not, write to the Free Software
405ea9
+! Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
405ea9
+!
405ea9
+! Ihis file is the Fortran source file for dynamic.exp.
405ea9
+! Original file written by Jakub Jelinek <jakub@redhat.com>.
405ea9
+! Modified for the GDB testcase by Jan Kratochvil <jan.kratochvil@redhat.com>.
405ea9
+
405ea9
+  subroutine f(s)
405ea9
+  character*3 s
405ea9
+  s = s
405ea9
+  end
405ea9
+
405ea9
+  program main
405ea9
+  call f ('foo')
405ea9
+  end