Blame SOURCES/gdb-vla-intel-stringbt-fix.patch

7a6771
http://sourceware.org/ml/gdb-patches/2014-08/msg00025.html
7a6771
Subject: [patch 1/2] Re: Crash regression(?) printing Fortran strings in bt  [Re: [V2 00/23] Fortran dynamic array support]
7a6771
7a6771
7a6771
--FCuugMFkClbJLl1L
7a6771
Content-Type: text/plain; charset=us-ascii
7a6771
Content-Disposition: inline
7a6771
7a6771
On Fri, 01 Aug 2014 09:20:19 +0200, Keven Boell wrote:
7a6771
> I just tried it on Fedora 20 i686.  Applied the patch, you mentioned, on top of
7a6771
> the Fortran VLA series and executed your dynamic-other-frame test.  Everything
7a6771
> is working fine here, I cannot reproduce the crash.
7a6771
7a6771
I have it reproducible on Fedora 20 i686 with plain
7a6771
CFLAGS=-g ./configure;make;cd gdb/testsuite;make site.exp;runtest gdb.fortran/dynamic-other-frame.exp
7a6771
7a6771
Besides that I have updated the testcase with
7a6771
	gdb_test_no_output "set print frame-arguments all"
7a6771
so that there is no longer needed the patch:
7a6771
	[patch] Display Fortran strings in backtraces
7a6771
	https://sourceware.org/ml/gdb-patches/2014-07/msg00709.html
7a6771
7a6771
The fix below has no regressions for me.  Unfortunately I do not see why you
7a6771
cannot reproduce it.
7a6771
7a6771
7a6771
Thanks,
7a6771
Jan
7a6771
7a6771
--- ./gdb/dwarf2loc.c	2016-08-29 04:01:25.000000000 +0200
7a6771
+++ ./gdb/dwarf2loc.c	2016-09-01 11:00:20.258909494 +0200
7a6771
@@ -2289,6 +2289,15 @@ const struct dwarf_expr_context_funcs dw
7a6771
   dwarf_expr_get_obj_addr
7a6771
 };
7a6771
 
7a6771
+static void
7a6771
+select_frame_cleanup (void *arg)
7a6771
+{
7a6771
+  struct frame_info *frame = (struct frame_info *) arg;
7a6771
+
7a6771
+  if (frame != NULL)
7a6771
+    select_frame (frame);
7a6771
+}
7a6771
+
7a6771
 /* Evaluate a location description, starting at DATA and with length
7a6771
    SIZE, to find the current location of variable of TYPE in the
7a6771
    context of FRAME.  BYTE_OFFSET is applied after the contents are
7a6771
@@ -2318,6 +2327,11 @@ dwarf2_evaluate_loc_desc_full (struct ty
7a6771
 
7a6771
   ctx = new_dwarf_expr_context ();
7a6771
   old_chain = make_cleanup_free_dwarf_expr_context (ctx);
7a6771
+
7a6771
+  make_cleanup (select_frame_cleanup, deprecated_safe_get_selected_frame ());
7a6771
+  if (frame != NULL)
7a6771
+    select_frame (frame);
7a6771
+
7a6771
   value_chain = make_cleanup_value_free_to_mark (value_mark ());
7a6771
 
7a6771
   ctx->gdbarch = get_objfile_arch (objfile);
7a6771
Index: gdb-7.9.50.20150520/gdb/testsuite/gdb.fortran/dynamic-other-frame-stub.f90
7a6771
===================================================================
7a6771
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
7a6771
+++ gdb-7.9.50.20150520/gdb/testsuite/gdb.fortran/dynamic-other-frame-stub.f90	2015-05-31 16:14:05.844545344 +0200
7a6771
@@ -0,0 +1,24 @@
7a6771
+! Copyright 2010 Free Software Foundation, Inc.
7a6771
+!
7a6771
+! This program is free software; you can redistribute it and/or modify
7a6771
+! it under the terms of the GNU General Public License as published by
7a6771
+! the Free Software Foundation; either version 2 of the License, or
7a6771
+! (at your option) any later version.
7a6771
+!
7a6771
+! This program is distributed in the hope that it will be useful,
7a6771
+! but WITHOUT ANY WARRANTY; without even the implied warranty of
7a6771
+! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
7a6771
+! GNU General Public License for more details.
7a6771
+!
7a6771
+! You should have received a copy of the GNU General Public License
7a6771
+! along with this program; if not, write to the Free Software
7a6771
+! Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
7a6771
+!
7a6771
+! Ihis file is the Fortran source file for dynamic.exp.
7a6771
+! Original file written by Jakub Jelinek <jakub@redhat.com>.
7a6771
+! Modified for the GDB testcase by Jan Kratochvil <jan.kratochvil@redhat.com>.
7a6771
+
7a6771
+subroutine bar
7a6771
+  real :: dummy
7a6771
+  dummy = 1
7a6771
+end subroutine bar
7a6771
Index: gdb-7.9.50.20150520/gdb/testsuite/gdb.fortran/dynamic-other-frame.exp
7a6771
===================================================================
7a6771
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
7a6771
+++ gdb-7.9.50.20150520/gdb/testsuite/gdb.fortran/dynamic-other-frame.exp	2015-05-31 16:14:05.845545351 +0200
7a6771
@@ -0,0 +1,39 @@
7a6771
+# Copyright 2010 Free Software Foundation, Inc.
7a6771
+
7a6771
+# This program is free software; you can redistribute it and/or modify
7a6771
+# it under the terms of the GNU General Public License as published by
7a6771
+# the Free Software Foundation; either version 2 of the License, or
7a6771
+# (at your option) any later version.
7a6771
+# 
7a6771
+# This program is distributed in the hope that it will be useful,
7a6771
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
7a6771
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
7a6771
+# GNU General Public License for more details.
7a6771
+# 
7a6771
+# You should have received a copy of the GNU General Public License
7a6771
+# along with this program; if not, write to the Free Software
7a6771
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  
7a6771
+
7a6771
+set testfile "dynamic-other-frame"
7a6771
+set srcfile1 ${testfile}.f90
7a6771
+set srcfile2 ${testfile}-stub.f90
7a6771
+set objfile2 [standard_output_file ${testfile}-stub.o]
7a6771
+set executable ${testfile}
7a6771
+set binfile [standard_output_file ${executable}]
7a6771
+
7a6771
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile2}" "${objfile2}" object {f90}] != ""
7a6771
+     || [gdb_compile "${srcdir}/${subdir}/${srcfile1} ${objfile2}" "${binfile}" executable {debug f90}] != "" } {
7a6771
+    untested "Couldn't compile ${srcfile1} or ${srcfile2}"
7a6771
+    return -1
7a6771
+}
7a6771
+
7a6771
+clean_restart ${executable}
7a6771
+
7a6771
+gdb_test_no_output "set print frame-arguments all"
7a6771
+
7a6771
+if ![runto bar_] then {
7a6771
+    perror "couldn't run to bar_"
7a6771
+    continue
7a6771
+}
7a6771
+
7a6771
+gdb_test "bt" {foo \(string='hello'.*}
7a6771
Index: gdb-7.9.50.20150520/gdb/testsuite/gdb.fortran/dynamic-other-frame.f90
7a6771
===================================================================
7a6771
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
7a6771
+++ gdb-7.9.50.20150520/gdb/testsuite/gdb.fortran/dynamic-other-frame.f90	2015-05-31 16:14:05.845545351 +0200
7a6771
@@ -0,0 +1,36 @@
7a6771
+! Copyright 2010 Free Software Foundation, Inc.
7a6771
+!
7a6771
+! This program is free software; you can redistribute it and/or modify
7a6771
+! it under the terms of the GNU General Public License as published by
7a6771
+! the Free Software Foundation; either version 2 of the License, or
7a6771
+! (at your option) any later version.
7a6771
+!
7a6771
+! This program is distributed in the hope that it will be useful,
7a6771
+! but WITHOUT ANY WARRANTY; without even the implied warranty of
7a6771
+! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
7a6771
+! GNU General Public License for more details.
7a6771
+!
7a6771
+! You should have received a copy of the GNU General Public License
7a6771
+! along with this program; if not, write to the Free Software
7a6771
+! Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
7a6771
+!
7a6771
+! Ihis file is the Fortran source file for dynamic.exp.
7a6771
+! Original file written by Jakub Jelinek <jakub@redhat.com>.
7a6771
+! Modified for the GDB testcase by Jan Kratochvil <jan.kratochvil@redhat.com>.
7a6771
+
7a6771
+subroutine foo (string)
7a6771
+  interface
7a6771
+    subroutine bar
7a6771
+    end subroutine
7a6771
+  end interface
7a6771
+  character string*(*)
7a6771
+  call bar                                ! stop-here
7a6771
+end subroutine foo
7a6771
+program test
7a6771
+  interface
7a6771
+    subroutine foo (string)
7a6771
+    character string*(*)
7a6771
+    end subroutine
7a6771
+  end interface
7a6771
+  call foo ('hello')
7a6771
+end