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

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