]> git.pld-linux.org Git - packages/gdb.git/blame - gdb-vla-intel-stringbt-fix.patch
up to 11.1
[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
174fe25c
JP
30diff --git a/gdb/dwarf2/loc.c b/gdb/dwarf2/loc.c
31--- a/gdb/dwarf2/loc.c
32+++ b/gdb/dwarf2/loc.c
33@@ -2249,6 +2249,20 @@ dwarf2_evaluate_loc_desc_full (struct type *type, struct frame_info *frame,
140f8057
JR
34 ctx.per_cu = per_cu;
35 ctx.obj_address = 0;
aa964043 36
140f8057
JR
37+frame_id old_frame_id (get_frame_id (deprecated_safe_get_selected_frame ()));
38+class RestoreCall {
39+private:
40+ const std::function<void ()> func;
41+public:
42+ RestoreCall(std::function<void ()> func_):func(func_) {}
43+ ~RestoreCall() { func(); }
44+} restore_frame([=]() {
45+ frame_info *old_frame (frame_find_by_id (old_frame_id));
46+ if (old_frame != NULL)
47+ select_frame (old_frame);
48+});
49+if (frame != NULL) select_frame (frame);
50+
51 scoped_value_mark free_values;
b1b25d28 52
174fe25c 53 ctx.gdbarch = per_objfile->objfile->arch ();
4b0e5c1b
AM
54diff --git a/gdb/testsuite/gdb.fortran/dynamic-other-frame-stub.f90 b/gdb/testsuite/gdb.fortran/dynamic-other-frame-stub.f90
55new file mode 100644
4b0e5c1b
AM
56--- /dev/null
57+++ b/gdb/testsuite/gdb.fortran/dynamic-other-frame-stub.f90
aa964043
KK
58@@ -0,0 +1,24 @@
59+! Copyright 2010 Free Software Foundation, Inc.
60+!
61+! This program is free software; you can redistribute it and/or modify
62+! it under the terms of the GNU General Public License as published by
63+! the Free Software Foundation; either version 2 of the License, or
64+! (at your option) any later version.
65+!
66+! This program is distributed in the hope that it will be useful,
67+! but WITHOUT ANY WARRANTY; without even the implied warranty of
68+! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
69+! GNU General Public License for more details.
70+!
71+! You should have received a copy of the GNU General Public License
72+! along with this program; if not, write to the Free Software
73+! Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
74+!
75+! Ihis file is the Fortran source file for dynamic.exp.
76+! Original file written by Jakub Jelinek <jakub@redhat.com>.
77+! Modified for the GDB testcase by Jan Kratochvil <jan.kratochvil@redhat.com>.
78+
79+subroutine bar
80+ real :: dummy
81+ dummy = 1
82+end subroutine bar
4b0e5c1b
AM
83diff --git a/gdb/testsuite/gdb.fortran/dynamic-other-frame.exp b/gdb/testsuite/gdb.fortran/dynamic-other-frame.exp
84new file mode 100644
4b0e5c1b
AM
85--- /dev/null
86+++ b/gdb/testsuite/gdb.fortran/dynamic-other-frame.exp
aa964043
KK
87@@ -0,0 +1,39 @@
88+# Copyright 2010 Free Software Foundation, Inc.
89+
90+# This program is free software; you can redistribute it and/or modify
91+# it under the terms of the GNU General Public License as published by
92+# the Free Software Foundation; either version 2 of the License, or
93+# (at your option) any later version.
174fe25c 94+#
aa964043
KK
95+# This program is distributed in the hope that it will be useful,
96+# but WITHOUT ANY WARRANTY; without even the implied warranty of
97+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
98+# GNU General Public License for more details.
174fe25c 99+#
aa964043
KK
100+# You should have received a copy of the GNU General Public License
101+# along with this program; if not, write to the Free Software
174fe25c 102+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
aa964043
KK
103+
104+set testfile "dynamic-other-frame"
105+set srcfile1 ${testfile}.f90
106+set srcfile2 ${testfile}-stub.f90
107+set objfile2 [standard_output_file ${testfile}-stub.o]
108+set executable ${testfile}
109+set binfile [standard_output_file ${executable}]
110+
111+if { [gdb_compile "${srcdir}/${subdir}/${srcfile2}" "${objfile2}" object {f90}] != ""
112+ || [gdb_compile "${srcdir}/${subdir}/${srcfile1} ${objfile2}" "${binfile}" executable {debug f90}] != "" } {
113+ untested "Couldn't compile ${srcfile1} or ${srcfile2}"
114+ return -1
115+}
116+
117+clean_restart ${executable}
118+
119+gdb_test_no_output "set print frame-arguments all"
120+
121+if ![runto bar_] then {
122+ perror "couldn't run to bar_"
123+ continue
124+}
125+
126+gdb_test "bt" {foo \(string='hello'.*}
4b0e5c1b
AM
127diff --git a/gdb/testsuite/gdb.fortran/dynamic-other-frame.f90 b/gdb/testsuite/gdb.fortran/dynamic-other-frame.f90
128new file mode 100644
4b0e5c1b
AM
129--- /dev/null
130+++ b/gdb/testsuite/gdb.fortran/dynamic-other-frame.f90
aa964043
KK
131@@ -0,0 +1,36 @@
132+! Copyright 2010 Free Software Foundation, Inc.
133+!
134+! This program is free software; you can redistribute it and/or modify
135+! it under the terms of the GNU General Public License as published by
136+! the Free Software Foundation; either version 2 of the License, or
137+! (at your option) any later version.
138+!
139+! This program is distributed in the hope that it will be useful,
140+! but WITHOUT ANY WARRANTY; without even the implied warranty of
141+! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
142+! GNU General Public License for more details.
143+!
144+! You should have received a copy of the GNU General Public License
145+! along with this program; if not, write to the Free Software
146+! Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
147+!
148+! Ihis file is the Fortran source file for dynamic.exp.
149+! Original file written by Jakub Jelinek <jakub@redhat.com>.
150+! Modified for the GDB testcase by Jan Kratochvil <jan.kratochvil@redhat.com>.
151+
152+subroutine foo (string)
153+ interface
154+ subroutine bar
155+ end subroutine
156+ end interface
157+ character string*(*)
158+ call bar ! stop-here
159+end subroutine foo
160+program test
161+ interface
162+ subroutine foo (string)
163+ character string*(*)
164+ end subroutine
165+ end interface
166+ call foo ('hello')
167+end
This page took 0.128695 seconds and 4 git commands to generate.