a8767b3
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
f524ac5
From: Jan Kratochvil <jan.kratochvil@redhat.com>
f524ac5
Date: Fri, 1 Aug 2014 23:02:17 +0200
fd7e5d7
Subject: gdb-vla-intel-stringbt-fix.patch
Jan Kratochvil 191ccfb
f637971
;;=push+jan
f637971
f524ac5
http://sourceware.org/ml/gdb-patches/2014-08/msg00025.html
Jan Kratochvil 191ccfb
Jan Kratochvil 191ccfb
On Fri, 01 Aug 2014 09:20:19 +0200, Keven Boell wrote:
Jan Kratochvil 191ccfb
> I just tried it on Fedora 20 i686.  Applied the patch, you mentioned, on top of
Jan Kratochvil 191ccfb
> the Fortran VLA series and executed your dynamic-other-frame test.  Everything
Jan Kratochvil 191ccfb
> is working fine here, I cannot reproduce the crash.
Jan Kratochvil 191ccfb
Jan Kratochvil 191ccfb
I have it reproducible on Fedora 20 i686 with plain
Jan Kratochvil 191ccfb
CFLAGS=-g ./configure;make;cd gdb/testsuite;make site.exp;runtest gdb.fortran/dynamic-other-frame.exp
Jan Kratochvil 191ccfb
Jan Kratochvil 191ccfb
Besides that I have updated the testcase with
Jan Kratochvil 191ccfb
	gdb_test_no_output "set print frame-arguments all"
Jan Kratochvil 191ccfb
so that there is no longer needed the patch:
Jan Kratochvil 191ccfb
	[patch] Display Fortran strings in backtraces
Jan Kratochvil 191ccfb
	https://sourceware.org/ml/gdb-patches/2014-07/msg00709.html
Jan Kratochvil 191ccfb
Jan Kratochvil 191ccfb
The fix below has no regressions for me.  Unfortunately I do not see why you
Jan Kratochvil 191ccfb
cannot reproduce it.
Jan Kratochvil 191ccfb
Jan Kratochvil 191ccfb
Thanks,
Jan Kratochvil 191ccfb
Jan
Jan Kratochvil 191ccfb
f637971
diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c
f637971
--- a/gdb/dwarf2loc.c
f637971
+++ b/gdb/dwarf2loc.c
a5d2c85
@@ -2154,6 +2154,20 @@ dwarf2_evaluate_loc_desc_full (struct type *type, struct frame_info *frame,
Jan Kratochvil af2c2a5
   ctx.per_cu = per_cu;
Jan Kratochvil af2c2a5
   ctx.obj_address = 0;
Jan Kratochvil 0300a2e
 
Jan Kratochvil 5e93e40
+frame_id old_frame_id (get_frame_id (deprecated_safe_get_selected_frame ()));
Jan Kratochvil b1807ab
+class RestoreCall {
Jan Kratochvil b1807ab
+private:
Jan Kratochvil b1807ab
+  const std::function<void ()> func;
Jan Kratochvil b1807ab
+public:
Jan Kratochvil b1807ab
+  RestoreCall(std::function<void ()> func_):func(func_) {}
Jan Kratochvil b1807ab
+  ~RestoreCall() { func(); }
Jan Kratochvil 5e93e40
+} restore_frame([=]() {
Jan Kratochvil 5e93e40
+  frame_info *old_frame (frame_find_by_id (old_frame_id));
Jan Kratochvil 5e93e40
+  if (old_frame != NULL)
Jan Kratochvil 5e93e40
+    select_frame (old_frame);
Jan Kratochvil b1807ab
+});
Jan Kratochvil b1807ab
+if (frame != NULL) select_frame (frame);
Jan Kratochvil 0300a2e
+
Jan Kratochvil af2c2a5
   scoped_value_mark free_values;
Jan Kratochvil 0300a2e
 
Jan Kratochvil af2c2a5
   ctx.gdbarch = get_objfile_arch (objfile);
f637971
diff --git a/gdb/testsuite/gdb.fortran/dynamic-other-frame-stub.f90 b/gdb/testsuite/gdb.fortran/dynamic-other-frame-stub.f90
f637971
new file mode 100644
f637971
--- /dev/null
f637971
+++ b/gdb/testsuite/gdb.fortran/dynamic-other-frame-stub.f90
Jan Kratochvil 191ccfb
@@ -0,0 +1,24 @@
Jan Kratochvil 191ccfb
+! Copyright 2010 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 bar
Jan Kratochvil 191ccfb
+  real :: dummy
Jan Kratochvil 191ccfb
+  dummy = 1
Jan Kratochvil 191ccfb
+end subroutine bar
f637971
diff --git a/gdb/testsuite/gdb.fortran/dynamic-other-frame.exp b/gdb/testsuite/gdb.fortran/dynamic-other-frame.exp
f637971
new file mode 100644
f637971
--- /dev/null
f637971
+++ b/gdb/testsuite/gdb.fortran/dynamic-other-frame.exp
Jan Kratochvil 191ccfb
@@ -0,0 +1,39 @@
Jan Kratochvil 191ccfb
+# Copyright 2010 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
+set testfile "dynamic-other-frame"
Jan Kratochvil 191ccfb
+set srcfile1 ${testfile}.f90
Jan Kratochvil 191ccfb
+set srcfile2 ${testfile}-stub.f90
Jan Kratochvil 191ccfb
+set objfile2 [standard_output_file ${testfile}-stub.o]
Jan Kratochvil 191ccfb
+set executable ${testfile}
Jan Kratochvil 191ccfb
+set binfile [standard_output_file ${executable}]
Jan Kratochvil 191ccfb
+
Jan Kratochvil 191ccfb
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile2}" "${objfile2}" object {f90}] != ""
Jan Kratochvil 191ccfb
+     || [gdb_compile "${srcdir}/${subdir}/${srcfile1} ${objfile2}" "${binfile}" executable {debug f90}] != "" } {
Jan Kratochvil 191ccfb
+    untested "Couldn't compile ${srcfile1} or ${srcfile2}"
Jan Kratochvil 191ccfb
+    return -1
Jan Kratochvil 191ccfb
+}
Jan Kratochvil 191ccfb
+
Jan Kratochvil 191ccfb
+clean_restart ${executable}
Jan Kratochvil 191ccfb
+
Jan Kratochvil 191ccfb
+gdb_test_no_output "set print frame-arguments all"
Jan Kratochvil 191ccfb
+
Jan Kratochvil 191ccfb
+if ![runto bar_] then {
Jan Kratochvil 191ccfb
+    perror "couldn't run to bar_"
Jan Kratochvil 191ccfb
+    continue
Jan Kratochvil 191ccfb
+}
Jan Kratochvil 191ccfb
+
Jan Kratochvil 191ccfb
+gdb_test "bt" {foo \(string='hello'.*}
f637971
diff --git a/gdb/testsuite/gdb.fortran/dynamic-other-frame.f90 b/gdb/testsuite/gdb.fortran/dynamic-other-frame.f90
f637971
new file mode 100644
f637971
--- /dev/null
f637971
+++ b/gdb/testsuite/gdb.fortran/dynamic-other-frame.f90
Jan Kratochvil 191ccfb
@@ -0,0 +1,36 @@
Jan Kratochvil 191ccfb
+! Copyright 2010 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 foo (string)
Jan Kratochvil 191ccfb
+  interface
Jan Kratochvil 191ccfb
+    subroutine bar
Jan Kratochvil 191ccfb
+    end subroutine
Jan Kratochvil 191ccfb
+  end interface
Jan Kratochvil 191ccfb
+  character string*(*)
Jan Kratochvil 191ccfb
+  call bar                                ! stop-here
Jan Kratochvil 191ccfb
+end subroutine foo
Jan Kratochvil 191ccfb
+program test
Jan Kratochvil 191ccfb
+  interface
Jan Kratochvil 191ccfb
+    subroutine foo (string)
Jan Kratochvil 191ccfb
+    character string*(*)
Jan Kratochvil 191ccfb
+    end subroutine
Jan Kratochvil 191ccfb
+  end interface
Jan Kratochvil 191ccfb
+  call foo ('hello')
Jan Kratochvil 191ccfb
+end