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

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