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

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