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

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