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

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