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

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