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

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