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

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