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

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