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