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

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