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

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