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

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