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