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