191ccfb
http://sourceware.org/ml/gdb-patches/2014-08/msg00025.html
191ccfb
Subject: [patch 1/2] Re: Crash regression(?) printing Fortran strings in bt  [Re: [V2 00/23] Fortran dynamic array support]
191ccfb
191ccfb
191ccfb
--FCuugMFkClbJLl1L
191ccfb
Content-Type: text/plain; charset=us-ascii
191ccfb
Content-Disposition: inline
191ccfb
191ccfb
On Fri, 01 Aug 2014 09:20:19 +0200, Keven Boell wrote:
191ccfb
> I just tried it on Fedora 20 i686.  Applied the patch, you mentioned, on top of
191ccfb
> the Fortran VLA series and executed your dynamic-other-frame test.  Everything
191ccfb
> is working fine here, I cannot reproduce the crash.
191ccfb
191ccfb
I have it reproducible on Fedora 20 i686 with plain
191ccfb
CFLAGS=-g ./configure;make;cd gdb/testsuite;make site.exp;runtest gdb.fortran/dynamic-other-frame.exp
191ccfb
191ccfb
Besides that I have updated the testcase with
191ccfb
	gdb_test_no_output "set print frame-arguments all"
191ccfb
so that there is no longer needed the patch:
191ccfb
	[patch] Display Fortran strings in backtraces
191ccfb
	https://sourceware.org/ml/gdb-patches/2014-07/msg00709.html
191ccfb
191ccfb
The fix below has no regressions for me.  Unfortunately I do not see why you
191ccfb
cannot reproduce it.
191ccfb
191ccfb
191ccfb
Thanks,
191ccfb
Jan
191ccfb
191ccfb
--FCuugMFkClbJLl1L
191ccfb
Content-Type: text/plain; charset=us-ascii
191ccfb
Content-Disposition: inline; filename="vlastringonly.patch"
191ccfb
32f92b2
Index: gdb-7.9.50.20150520/gdb/gdbtypes.c
2f7f533
===================================================================
32f92b2
--- gdb-7.9.50.20150520.orig/gdb/gdbtypes.c	2015-05-31 16:14:04.164533833 +0200
32f92b2
+++ gdb-7.9.50.20150520/gdb/gdbtypes.c	2015-05-31 16:14:05.844545344 +0200
32f92b2
@@ -1851,6 +1851,7 @@ is_dynamic_type_internal (struct type *t
32f92b2
       }
191ccfb
 
191ccfb
     case TYPE_CODE_ARRAY:
191ccfb
+    case TYPE_CODE_STRING:
191ccfb
       {
191ccfb
 	gdb_assert (TYPE_NFIELDS (type) == 1);
191ccfb
 
32f92b2
@@ -2192,6 +2193,7 @@ resolve_dynamic_type_internal (struct ty
2f7f533
 	  }
2f7f533
 
2f7f533
 	case TYPE_CODE_ARRAY:
2f7f533
+	case TYPE_CODE_STRING:
32f92b2
 	  resolved_type = resolve_dynamic_array (type, addr_stack);
2f7f533
 	  break;
2f7f533
 
32f92b2
Index: gdb-7.9.50.20150520/gdb/testsuite/gdb.fortran/dynamic-other-frame-stub.f90
2f7f533
===================================================================
2f7f533
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
32f92b2
+++ gdb-7.9.50.20150520/gdb/testsuite/gdb.fortran/dynamic-other-frame-stub.f90	2015-05-31 16:14:05.844545344 +0200
191ccfb
@@ -0,0 +1,24 @@
191ccfb
+! Copyright 2010 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 bar
191ccfb
+  real :: dummy
191ccfb
+  dummy = 1
191ccfb
+end subroutine bar
32f92b2
Index: gdb-7.9.50.20150520/gdb/testsuite/gdb.fortran/dynamic-other-frame.exp
2f7f533
===================================================================
2f7f533
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
32f92b2
+++ gdb-7.9.50.20150520/gdb/testsuite/gdb.fortran/dynamic-other-frame.exp	2015-05-31 16:14:05.845545351 +0200
191ccfb
@@ -0,0 +1,39 @@
191ccfb
+# Copyright 2010 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
+set testfile "dynamic-other-frame"
191ccfb
+set srcfile1 ${testfile}.f90
191ccfb
+set srcfile2 ${testfile}-stub.f90
191ccfb
+set objfile2 [standard_output_file ${testfile}-stub.o]
191ccfb
+set executable ${testfile}
191ccfb
+set binfile [standard_output_file ${executable}]
191ccfb
+
191ccfb
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile2}" "${objfile2}" object {f90}] != ""
191ccfb
+     || [gdb_compile "${srcdir}/${subdir}/${srcfile1} ${objfile2}" "${binfile}" executable {debug f90}] != "" } {
191ccfb
+    untested "Couldn't compile ${srcfile1} or ${srcfile2}"
191ccfb
+    return -1
191ccfb
+}
191ccfb
+
191ccfb
+clean_restart ${executable}
191ccfb
+
191ccfb
+gdb_test_no_output "set print frame-arguments all"
191ccfb
+
191ccfb
+if ![runto bar_] then {
191ccfb
+    perror "couldn't run to bar_"
191ccfb
+    continue
191ccfb
+}
191ccfb
+
191ccfb
+gdb_test "bt" {foo \(string='hello'.*}
32f92b2
Index: gdb-7.9.50.20150520/gdb/testsuite/gdb.fortran/dynamic-other-frame.f90
2f7f533
===================================================================
2f7f533
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
32f92b2
+++ gdb-7.9.50.20150520/gdb/testsuite/gdb.fortran/dynamic-other-frame.f90	2015-05-31 16:14:05.845545351 +0200
191ccfb
@@ -0,0 +1,36 @@
191ccfb
+! Copyright 2010 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 foo (string)
191ccfb
+  interface
191ccfb
+    subroutine bar
191ccfb
+    end subroutine
191ccfb
+  end interface
191ccfb
+  character string*(*)
191ccfb
+  call bar                                ! stop-here
191ccfb
+end subroutine foo
191ccfb
+program test
191ccfb
+  interface
191ccfb
+    subroutine foo (string)
191ccfb
+    character string*(*)
191ccfb
+    end subroutine
191ccfb
+  end interface
191ccfb
+  call foo ('hello')
191ccfb
+end
32f92b2
Index: gdb-7.9.50.20150520/gdb/testsuite/gdb.fortran/vla-strings.exp
32f92b2
===================================================================
32f92b2
--- gdb-7.9.50.20150520.orig/gdb/testsuite/gdb.fortran/vla-strings.exp	2015-05-31 16:14:04.167533854 +0200
32f92b2
+++ gdb-7.9.50.20150520/gdb/testsuite/gdb.fortran/vla-strings.exp	2015-05-31 16:14:31.073718201 +0200
32f92b2
@@ -33,9 +33,6 @@ gdb_continue_to_breakpoint "var_char-all
32f92b2
 gdb_test "print var_char" \
32f92b2
   " = \\(PTR TO -> \\( character\\*10 \\)\\) ${hex}" \
32f92b2
   "print var_char after allocated first time"
32f92b2
-gdb_test "print *var_char" \
32f92b2
-  " = '\\\\000\\\\000\\\\000\\\\000\\\\000\\\\000\\\\000\\\\000\\\\000\\\\000'" \
32f92b2
-  "print *var_char after allocated first time"
32f92b2
 gdb_test "whatis var_char" "type = PTR TO -> \\( character\\*10 \\)" \
32f92b2
   "whatis var_char first time"
32f92b2
 gdb_test "ptype var_char" "type = PTR TO -> \\( character\\*10 \\)" \