]> git.pld-linux.org Git - packages/gdb.git/blame - gdb-vla-intel-stringbt-fix.patch
- up to 8.3
[packages/gdb.git] / gdb-vla-intel-stringbt-fix.patch
CommitLineData
4b0e5c1b
AM
1From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
2From: Jan Kratochvil <jan.kratochvil@redhat.com>
3Date: Fri, 1 Aug 2014 23:02:17 +0200
ed003b1c 4Subject: gdb-vla-intel-stringbt-fix.patch
aa964043 5
4b0e5c1b 6;;=push+jan
aa964043 7
4b0e5c1b 8http://sourceware.org/ml/gdb-patches/2014-08/msg00025.html
aa964043
KK
9
10On Fri, 01 Aug 2014 09:20:19 +0200, Keven Boell wrote:
11> I just tried it on Fedora 20 i686. Applied the patch, you mentioned, on top of
12> the Fortran VLA series and executed your dynamic-other-frame test. Everything
13> is working fine here, I cannot reproduce the crash.
14
15I have it reproducible on Fedora 20 i686 with plain
16CFLAGS=-g ./configure;make;cd gdb/testsuite;make site.exp;runtest gdb.fortran/dynamic-other-frame.exp
17
18Besides that I have updated the testcase with
19 gdb_test_no_output "set print frame-arguments all"
20so that there is no longer needed the patch:
21 [patch] Display Fortran strings in backtraces
22 https://sourceware.org/ml/gdb-patches/2014-07/msg00709.html
23
24The fix below has no regressions for me. Unfortunately I do not see why you
25cannot reproduce it.
26
aa964043
KK
27Thanks,
28Jan
29
4b0e5c1b 30diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c
4b0e5c1b
AM
31--- a/gdb/dwarf2loc.c
32+++ b/gdb/dwarf2loc.c
140f8057
JR
33@@ -42,6 +42,7 @@
34 #include <algorithm>
35 #include <vector>
36 #include <unordered_set>
37+#include <functional>
38 #include "common/underlying.h"
4b0e5c1b 39 #include "common/byte-vector.h"
aa964043 40
77d10998 41@@ -2158,6 +2159,20 @@ dwarf2_evaluate_loc_desc_full (struct type *type, struct frame_info *frame,
140f8057
JR
42 ctx.per_cu = per_cu;
43 ctx.obj_address = 0;
aa964043 44
140f8057
JR
45+frame_id old_frame_id (get_frame_id (deprecated_safe_get_selected_frame ()));
46+class RestoreCall {
47+private:
48+ const std::function<void ()> func;
49+public:
50+ RestoreCall(std::function<void ()> func_):func(func_) {}
51+ ~RestoreCall() { func(); }
52+} restore_frame([=]() {
53+ frame_info *old_frame (frame_find_by_id (old_frame_id));
54+ if (old_frame != NULL)
55+ select_frame (old_frame);
56+});
57+if (frame != NULL) select_frame (frame);
58+
59 scoped_value_mark free_values;
b1b25d28 60
140f8057 61 ctx.gdbarch = get_objfile_arch (objfile);
4b0e5c1b
AM
62diff --git a/gdb/testsuite/gdb.fortran/dynamic-other-frame-stub.f90 b/gdb/testsuite/gdb.fortran/dynamic-other-frame-stub.f90
63new file mode 100644
4b0e5c1b
AM
64--- /dev/null
65+++ b/gdb/testsuite/gdb.fortran/dynamic-other-frame-stub.f90
aa964043
KK
66@@ -0,0 +1,24 @@
67+! Copyright 2010 Free Software Foundation, Inc.
68+!
69+! This program is free software; you can redistribute it and/or modify
70+! it under the terms of the GNU General Public License as published by
71+! the Free Software Foundation; either version 2 of the License, or
72+! (at your option) any later version.
73+!
74+! This program is distributed in the hope that it will be useful,
75+! but WITHOUT ANY WARRANTY; without even the implied warranty of
76+! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
77+! GNU General Public License for more details.
78+!
79+! You should have received a copy of the GNU General Public License
80+! along with this program; if not, write to the Free Software
81+! Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
82+!
83+! Ihis file is the Fortran source file for dynamic.exp.
84+! Original file written by Jakub Jelinek <jakub@redhat.com>.
85+! Modified for the GDB testcase by Jan Kratochvil <jan.kratochvil@redhat.com>.
86+
87+subroutine bar
88+ real :: dummy
89+ dummy = 1
90+end subroutine bar
4b0e5c1b
AM
91diff --git a/gdb/testsuite/gdb.fortran/dynamic-other-frame.exp b/gdb/testsuite/gdb.fortran/dynamic-other-frame.exp
92new file mode 100644
4b0e5c1b
AM
93--- /dev/null
94+++ b/gdb/testsuite/gdb.fortran/dynamic-other-frame.exp
aa964043
KK
95@@ -0,0 +1,39 @@
96+# Copyright 2010 Free Software Foundation, Inc.
97+
98+# This program is free software; you can redistribute it and/or modify
99+# it under the terms of the GNU General Public License as published by
100+# the Free Software Foundation; either version 2 of the License, or
101+# (at your option) any later version.
102+#
103+# This program is distributed in the hope that it will be useful,
104+# but WITHOUT ANY WARRANTY; without even the implied warranty of
105+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
106+# GNU General Public License for more details.
107+#
108+# You should have received a copy of the GNU General Public License
109+# along with this program; if not, write to the Free Software
110+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
111+
112+set testfile "dynamic-other-frame"
113+set srcfile1 ${testfile}.f90
114+set srcfile2 ${testfile}-stub.f90
115+set objfile2 [standard_output_file ${testfile}-stub.o]
116+set executable ${testfile}
117+set binfile [standard_output_file ${executable}]
118+
119+if { [gdb_compile "${srcdir}/${subdir}/${srcfile2}" "${objfile2}" object {f90}] != ""
120+ || [gdb_compile "${srcdir}/${subdir}/${srcfile1} ${objfile2}" "${binfile}" executable {debug f90}] != "" } {
121+ untested "Couldn't compile ${srcfile1} or ${srcfile2}"
122+ return -1
123+}
124+
125+clean_restart ${executable}
126+
127+gdb_test_no_output "set print frame-arguments all"
128+
129+if ![runto bar_] then {
130+ perror "couldn't run to bar_"
131+ continue
132+}
133+
134+gdb_test "bt" {foo \(string='hello'.*}
4b0e5c1b
AM
135diff --git a/gdb/testsuite/gdb.fortran/dynamic-other-frame.f90 b/gdb/testsuite/gdb.fortran/dynamic-other-frame.f90
136new file mode 100644
4b0e5c1b
AM
137--- /dev/null
138+++ b/gdb/testsuite/gdb.fortran/dynamic-other-frame.f90
aa964043
KK
139@@ -0,0 +1,36 @@
140+! Copyright 2010 Free Software Foundation, Inc.
141+!
142+! This program is free software; you can redistribute it and/or modify
143+! it under the terms of the GNU General Public License as published by
144+! the Free Software Foundation; either version 2 of the License, or
145+! (at your option) any later version.
146+!
147+! This program is distributed in the hope that it will be useful,
148+! but WITHOUT ANY WARRANTY; without even the implied warranty of
149+! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
150+! GNU General Public License for more details.
151+!
152+! You should have received a copy of the GNU General Public License
153+! along with this program; if not, write to the Free Software
154+! Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
155+!
156+! Ihis file is the Fortran source file for dynamic.exp.
157+! Original file written by Jakub Jelinek <jakub@redhat.com>.
158+! Modified for the GDB testcase by Jan Kratochvil <jan.kratochvil@redhat.com>.
159+
160+subroutine foo (string)
161+ interface
162+ subroutine bar
163+ end subroutine
164+ end interface
165+ character string*(*)
166+ call bar ! stop-here
167+end subroutine foo
168+program test
169+ interface
170+ subroutine foo (string)
171+ character string*(*)
172+ end subroutine
173+ end interface
174+ call foo ('hello')
175+end
This page took 0.049081 seconds and 4 git commands to generate.