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

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