|
|
190f2a |
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
|
|
190f2a |
From: Jan Kratochvil <jan.kratochvil@redhat.com>
|
|
|
190f2a |
Date: Fri, 1 Aug 2014 23:02:17 +0200
|
|
|
190f2a |
Subject: gdb-vla-intel-stringbt-fix.patch
|
|
|
190f2a |
|
|
|
190f2a |
;;=push+jan
|
|
|
190f2a |
|
|
|
190f2a |
http://sourceware.org/ml/gdb-patches/2014-08/msg00025.html
|
|
|
190f2a |
|
|
|
190f2a |
On Fri, 01 Aug 2014 09:20:19 +0200, Keven Boell wrote:
|
|
|
190f2a |
> I just tried it on Fedora 20 i686. Applied the patch, you mentioned, on top of
|
|
|
190f2a |
> the Fortran VLA series and executed your dynamic-other-frame test. Everything
|
|
|
190f2a |
> is working fine here, I cannot reproduce the crash.
|
|
|
190f2a |
|
|
|
190f2a |
I have it reproducible on Fedora 20 i686 with plain
|
|
|
190f2a |
CFLAGS=-g ./configure;make;cd gdb/testsuite;make site.exp;runtest gdb.fortran/dynamic-other-frame.exp
|
|
|
190f2a |
|
|
|
190f2a |
Besides that I have updated the testcase with
|
|
|
190f2a |
gdb_test_no_output "set print frame-arguments all"
|
|
|
190f2a |
so that there is no longer needed the patch:
|
|
|
190f2a |
[patch] Display Fortran strings in backtraces
|
|
|
190f2a |
https://sourceware.org/ml/gdb-patches/2014-07/msg00709.html
|
|
|
190f2a |
|
|
|
190f2a |
The fix below has no regressions for me. Unfortunately I do not see why you
|
|
|
190f2a |
cannot reproduce it.
|
|
|
190f2a |
|
|
|
190f2a |
Thanks,
|
|
|
190f2a |
Jan
|
|
|
190f2a |
|
|
|
190f2a |
diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c
|
|
|
190f2a |
--- a/gdb/dwarf2loc.c
|
|
|
190f2a |
+++ b/gdb/dwarf2loc.c
|
|
|
190f2a |
@@ -42,6 +42,7 @@
|
|
|
190f2a |
#include <algorithm>
|
|
|
190f2a |
#include <vector>
|
|
|
190f2a |
#include <unordered_set>
|
|
|
190f2a |
+#include <functional>
|
|
|
190f2a |
#include "common/underlying.h"
|
|
|
190f2a |
#include "common/byte-vector.h"
|
|
|
190f2a |
|
|
|
190f2a |
@@ -2348,6 +2349,20 @@ dwarf2_evaluate_loc_desc_full (struct type *type, struct frame_info *frame,
|
|
|
190f2a |
ctx.per_cu = per_cu;
|
|
|
190f2a |
ctx.obj_address = 0;
|
|
|
190f2a |
|
|
|
190f2a |
+frame_id old_frame_id (get_frame_id (deprecated_safe_get_selected_frame ()));
|
|
|
190f2a |
+class RestoreCall {
|
|
|
190f2a |
+private:
|
|
|
190f2a |
+ const std::function<void ()> func;
|
|
|
190f2a |
+public:
|
|
|
190f2a |
+ RestoreCall(std::function<void ()> func_):func(func_) {}
|
|
|
190f2a |
+ ~RestoreCall() { func(); }
|
|
|
190f2a |
+} restore_frame([=]() {
|
|
|
190f2a |
+ frame_info *old_frame (frame_find_by_id (old_frame_id));
|
|
|
190f2a |
+ if (old_frame != NULL)
|
|
|
190f2a |
+ select_frame (old_frame);
|
|
|
190f2a |
+});
|
|
|
190f2a |
+if (frame != NULL) select_frame (frame);
|
|
|
190f2a |
+
|
|
|
190f2a |
scoped_value_mark free_values;
|
|
|
190f2a |
|
|
|
190f2a |
ctx.gdbarch = get_objfile_arch (objfile);
|
|
|
190f2a |
diff --git a/gdb/testsuite/gdb.fortran/dynamic-other-frame-stub.f90 b/gdb/testsuite/gdb.fortran/dynamic-other-frame-stub.f90
|
|
|
190f2a |
new file mode 100644
|
|
|
190f2a |
--- /dev/null
|
|
|
190f2a |
+++ b/gdb/testsuite/gdb.fortran/dynamic-other-frame-stub.f90
|
|
|
190f2a |
@@ -0,0 +1,24 @@
|
|
|
190f2a |
+! Copyright 2010 Free Software Foundation, Inc.
|
|
|
190f2a |
+!
|
|
|
190f2a |
+! This program is free software; you can redistribute it and/or modify
|
|
|
190f2a |
+! it under the terms of the GNU General Public License as published by
|
|
|
190f2a |
+! the Free Software Foundation; either version 2 of the License, or
|
|
|
190f2a |
+! (at your option) any later version.
|
|
|
190f2a |
+!
|
|
|
190f2a |
+! This program is distributed in the hope that it will be useful,
|
|
|
190f2a |
+! but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
190f2a |
+! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
190f2a |
+! GNU General Public License for more details.
|
|
|
190f2a |
+!
|
|
|
190f2a |
+! You should have received a copy of the GNU General Public License
|
|
|
190f2a |
+! along with this program; if not, write to the Free Software
|
|
|
190f2a |
+! Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
190f2a |
+!
|
|
|
190f2a |
+! Ihis file is the Fortran source file for dynamic.exp.
|
|
|
190f2a |
+! Original file written by Jakub Jelinek <jakub@redhat.com>.
|
|
|
190f2a |
+! Modified for the GDB testcase by Jan Kratochvil <jan.kratochvil@redhat.com>.
|
|
|
190f2a |
+
|
|
|
190f2a |
+subroutine bar
|
|
|
190f2a |
+ real :: dummy
|
|
|
190f2a |
+ dummy = 1
|
|
|
190f2a |
+end subroutine bar
|
|
|
190f2a |
diff --git a/gdb/testsuite/gdb.fortran/dynamic-other-frame.exp b/gdb/testsuite/gdb.fortran/dynamic-other-frame.exp
|
|
|
190f2a |
new file mode 100644
|
|
|
190f2a |
--- /dev/null
|
|
|
190f2a |
+++ b/gdb/testsuite/gdb.fortran/dynamic-other-frame.exp
|
|
|
190f2a |
@@ -0,0 +1,39 @@
|
|
|
190f2a |
+# Copyright 2010 Free Software Foundation, Inc.
|
|
|
190f2a |
+
|
|
|
190f2a |
+# This program is free software; you can redistribute it and/or modify
|
|
|
190f2a |
+# it under the terms of the GNU General Public License as published by
|
|
|
190f2a |
+# the Free Software Foundation; either version 2 of the License, or
|
|
|
190f2a |
+# (at your option) any later version.
|
|
|
190f2a |
+#
|
|
|
190f2a |
+# This program is distributed in the hope that it will be useful,
|
|
|
190f2a |
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
190f2a |
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
190f2a |
+# GNU General Public License for more details.
|
|
|
190f2a |
+#
|
|
|
190f2a |
+# You should have received a copy of the GNU General Public License
|
|
|
190f2a |
+# along with this program; if not, write to the Free Software
|
|
|
190f2a |
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
190f2a |
+
|
|
|
190f2a |
+set testfile "dynamic-other-frame"
|
|
|
190f2a |
+set srcfile1 ${testfile}.f90
|
|
|
190f2a |
+set srcfile2 ${testfile}-stub.f90
|
|
|
190f2a |
+set objfile2 [standard_output_file ${testfile}-stub.o]
|
|
|
190f2a |
+set executable ${testfile}
|
|
|
190f2a |
+set binfile [standard_output_file ${executable}]
|
|
|
190f2a |
+
|
|
|
190f2a |
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile2}" "${objfile2}" object {f90}] != ""
|
|
|
190f2a |
+ || [gdb_compile "${srcdir}/${subdir}/${srcfile1} ${objfile2}" "${binfile}" executable {debug f90}] != "" } {
|
|
|
190f2a |
+ untested "Couldn't compile ${srcfile1} or ${srcfile2}"
|
|
|
190f2a |
+ return -1
|
|
|
190f2a |
+}
|
|
|
190f2a |
+
|
|
|
190f2a |
+clean_restart ${executable}
|
|
|
190f2a |
+
|
|
|
190f2a |
+gdb_test_no_output "set print frame-arguments all"
|
|
|
190f2a |
+
|
|
|
190f2a |
+if ![runto bar_] then {
|
|
|
190f2a |
+ perror "couldn't run to bar_"
|
|
|
190f2a |
+ continue
|
|
|
190f2a |
+}
|
|
|
190f2a |
+
|
|
|
190f2a |
+gdb_test "bt" {foo \(string='hello'.*}
|
|
|
190f2a |
diff --git a/gdb/testsuite/gdb.fortran/dynamic-other-frame.f90 b/gdb/testsuite/gdb.fortran/dynamic-other-frame.f90
|
|
|
190f2a |
new file mode 100644
|
|
|
190f2a |
--- /dev/null
|
|
|
190f2a |
+++ b/gdb/testsuite/gdb.fortran/dynamic-other-frame.f90
|
|
|
190f2a |
@@ -0,0 +1,36 @@
|
|
|
190f2a |
+! Copyright 2010 Free Software Foundation, Inc.
|
|
|
190f2a |
+!
|
|
|
190f2a |
+! This program is free software; you can redistribute it and/or modify
|
|
|
190f2a |
+! it under the terms of the GNU General Public License as published by
|
|
|
190f2a |
+! the Free Software Foundation; either version 2 of the License, or
|
|
|
190f2a |
+! (at your option) any later version.
|
|
|
190f2a |
+!
|
|
|
190f2a |
+! This program is distributed in the hope that it will be useful,
|
|
|
190f2a |
+! but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
190f2a |
+! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
190f2a |
+! GNU General Public License for more details.
|
|
|
190f2a |
+!
|
|
|
190f2a |
+! You should have received a copy of the GNU General Public License
|
|
|
190f2a |
+! along with this program; if not, write to the Free Software
|
|
|
190f2a |
+! Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
190f2a |
+!
|
|
|
190f2a |
+! Ihis file is the Fortran source file for dynamic.exp.
|
|
|
190f2a |
+! Original file written by Jakub Jelinek <jakub@redhat.com>.
|
|
|
190f2a |
+! Modified for the GDB testcase by Jan Kratochvil <jan.kratochvil@redhat.com>.
|
|
|
190f2a |
+
|
|
|
190f2a |
+subroutine foo (string)
|
|
|
190f2a |
+ interface
|
|
|
190f2a |
+ subroutine bar
|
|
|
190f2a |
+ end subroutine
|
|
|
190f2a |
+ end interface
|
|
|
190f2a |
+ character string*(*)
|
|
|
190f2a |
+ call bar ! stop-here
|
|
|
190f2a |
+end subroutine foo
|
|
|
190f2a |
+program test
|
|
|
190f2a |
+ interface
|
|
|
190f2a |
+ subroutine foo (string)
|
|
|
190f2a |
+ character string*(*)
|
|
|
190f2a |
+ end subroutine
|
|
|
190f2a |
+ end interface
|
|
|
190f2a |
+ call foo ('hello')
|
|
|
190f2a |
+end
|