]> git.pld-linux.org Git - packages/gdb.git/blob - gdb-vla-intel-stringbt-fix.patch
b2170f4c5493048a5342018b32e975663c0ddf04
[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: gdb-vla-intel-stringbt-fix.patch
5
6 ;;=push+jan
7
8 http://sourceware.org/ml/gdb-patches/2014-08/msg00025.html
9
10 On 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
15 I have it reproducible on Fedora 20 i686 with plain
16 CFLAGS=-g ./configure;make;cd gdb/testsuite;make site.exp;runtest gdb.fortran/dynamic-other-frame.exp
17
18 Besides that I have updated the testcase with
19         gdb_test_no_output "set print frame-arguments all"
20 so 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
24 The fix below has no regressions for me.  Unfortunately I do not see why you
25 cannot reproduce it.
26
27 Thanks,
28 Jan
29
30 diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c
31 --- a/gdb/dwarf2loc.c
32 +++ b/gdb/dwarf2loc.c
33 @@ -42,6 +42,7 @@
34  #include <algorithm>
35  #include <vector>
36  #include <unordered_set>
37 +#include <functional>
38  #include "common/underlying.h"
39  #include "common/byte-vector.h"
40  
41 @@ -2348,6 +2349,20 @@ dwarf2_evaluate_loc_desc_full (struct type *type, struct frame_info *frame,
42    ctx.per_cu = per_cu;
43    ctx.obj_address = 0;
44  
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;
60  
61    ctx.gdbarch = get_objfile_arch (objfile);
62 diff --git a/gdb/testsuite/gdb.fortran/dynamic-other-frame-stub.f90 b/gdb/testsuite/gdb.fortran/dynamic-other-frame-stub.f90
63 new file mode 100644
64 --- /dev/null
65 +++ b/gdb/testsuite/gdb.fortran/dynamic-other-frame-stub.f90
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
91 diff --git a/gdb/testsuite/gdb.fortran/dynamic-other-frame.exp b/gdb/testsuite/gdb.fortran/dynamic-other-frame.exp
92 new file mode 100644
93 --- /dev/null
94 +++ b/gdb/testsuite/gdb.fortran/dynamic-other-frame.exp
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'.*}
135 diff --git a/gdb/testsuite/gdb.fortran/dynamic-other-frame.f90 b/gdb/testsuite/gdb.fortran/dynamic-other-frame.f90
136 new file mode 100644
137 --- /dev/null
138 +++ b/gdb/testsuite/gdb.fortran/dynamic-other-frame.f90
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.028232 seconds and 2 git commands to generate.