Blame SOURCES/gdb-fortran-frame-string.patch

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