Blob Blame History Raw
diff -Naurp insight-7.12.50.20170416.orig/gdb/dwarf2loc.c insight-7.12.50.20170416.new/gdb/dwarf2loc.c
--- insight-7.12.50.20170416.orig/gdb/dwarf2loc.c	2017-04-16 13:23:04.683298600 +0100
+++ insight-7.12.50.20170416.new/gdb/dwarf2loc.c	2017-04-16 13:24:55.140258427 +0100
@@ -42,6 +42,7 @@
 #include <algorithm>
 #include <vector>
 #include <unordered_set>
+#include <functional>
 #include "common/underlying.h"
 
 extern int dwarf_always_disassemble;
@@ -2369,6 +2370,18 @@ dwarf2_evaluate_loc_desc_full (struct ty
   ctx.per_cu = per_cu;
   ctx.obj_address = 0;
 
+struct frame_info *old_frame (deprecated_safe_get_selected_frame ());
+class RestoreCall {
+private:
+  const std::function<void ()> func;
+public:
+  RestoreCall(std::function<void ()> func_):func(func_) {}
+  ~RestoreCall() { func(); }
+} restore_frame([&]() {
+  select_frame (old_frame);
+});
+if (frame != NULL) select_frame (frame);
+
   scoped_value_mark free_values;
 
   ctx.gdbarch = get_objfile_arch (objfile);
diff -Naurp insight-7.12.50.20170416.orig/gdb/testsuite/gdb.fortran/dynamic-other-frame.exp insight-7.12.50.20170416.new/gdb/testsuite/gdb.fortran/dynamic-other-frame.exp
--- insight-7.12.50.20170416.orig/gdb/testsuite/gdb.fortran/dynamic-other-frame.exp	1970-01-01 01:00:00.000000000 +0100
+++ insight-7.12.50.20170416.new/gdb/testsuite/gdb.fortran/dynamic-other-frame.exp	2017-04-16 13:23:54.445731016 +0100
@@ -0,0 +1,39 @@
+# Copyright 2010 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  
+
+set testfile "dynamic-other-frame"
+set srcfile1 ${testfile}.f90
+set srcfile2 ${testfile}-stub.f90
+set objfile2 [standard_output_file ${testfile}-stub.o]
+set executable ${testfile}
+set binfile [standard_output_file ${executable}]
+
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile2}" "${objfile2}" object {f90}] != ""
+     || [gdb_compile "${srcdir}/${subdir}/${srcfile1} ${objfile2}" "${binfile}" executable {debug f90}] != "" } {
+    untested "Couldn't compile ${srcfile1} or ${srcfile2}"
+    return -1
+}
+
+clean_restart ${executable}
+
+gdb_test_no_output "set print frame-arguments all"
+
+if ![runto bar_] then {
+    perror "couldn't run to bar_"
+    continue
+}
+
+gdb_test "bt" {foo \(string='hello'.*}
diff -Naurp insight-7.12.50.20170416.orig/gdb/testsuite/gdb.fortran/dynamic-other-frame.f90 insight-7.12.50.20170416.new/gdb/testsuite/gdb.fortran/dynamic-other-frame.f90
--- insight-7.12.50.20170416.orig/gdb/testsuite/gdb.fortran/dynamic-other-frame.f90	1970-01-01 01:00:00.000000000 +0100
+++ insight-7.12.50.20170416.new/gdb/testsuite/gdb.fortran/dynamic-other-frame.f90	2017-04-16 13:23:54.445731016 +0100
@@ -0,0 +1,36 @@
+! Copyright 2010 Free Software Foundation, Inc.
+!
+! This program is free software; you can redistribute it and/or modify
+! it under the terms of the GNU General Public License as published by
+! the Free Software Foundation; either version 2 of the License, or
+! (at your option) any later version.
+!
+! This program is distributed in the hope that it will be useful,
+! but WITHOUT ANY WARRANTY; without even the implied warranty of
+! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+! GNU General Public License for more details.
+!
+! You should have received a copy of the GNU General Public License
+! along with this program; if not, write to the Free Software
+! Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+!
+! Ihis file is the Fortran source file for dynamic.exp.
+! Original file written by Jakub Jelinek <jakub@redhat.com>.
+! Modified for the GDB testcase by Jan Kratochvil <jan.kratochvil@redhat.com>.
+
+subroutine foo (string)
+  interface
+    subroutine bar
+    end subroutine
+  end interface
+  character string*(*)
+  call bar                                ! stop-here
+end subroutine foo
+program test
+  interface
+    subroutine foo (string)
+    character string*(*)
+    end subroutine
+  end interface
+  call foo ('hello')
+end
diff -Naurp insight-7.12.50.20170416.orig/gdb/testsuite/gdb.fortran/dynamic-other-frame-stub.f90 insight-7.12.50.20170416.new/gdb/testsuite/gdb.fortran/dynamic-other-frame-stub.f90
--- insight-7.12.50.20170416.orig/gdb/testsuite/gdb.fortran/dynamic-other-frame-stub.f90	1970-01-01 01:00:00.000000000 +0100
+++ insight-7.12.50.20170416.new/gdb/testsuite/gdb.fortran/dynamic-other-frame-stub.f90	2017-04-16 13:23:54.444731007 +0100
@@ -0,0 +1,24 @@
+! Copyright 2010 Free Software Foundation, Inc.
+!
+! This program is free software; you can redistribute it and/or modify
+! it under the terms of the GNU General Public License as published by
+! the Free Software Foundation; either version 2 of the License, or
+! (at your option) any later version.
+!
+! This program is distributed in the hope that it will be useful,
+! but WITHOUT ANY WARRANTY; without even the implied warranty of
+! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+! GNU General Public License for more details.
+!
+! You should have received a copy of the GNU General Public License
+! along with this program; if not, write to the Free Software
+! Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+!
+! Ihis file is the Fortran source file for dynamic.exp.
+! Original file written by Jakub Jelinek <jakub@redhat.com>.
+! Modified for the GDB testcase by Jan Kratochvil <jan.kratochvil@redhat.com>.
+
+subroutine bar
+  real :: dummy
+  dummy = 1
+end subroutine bar