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

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