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