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

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