]> git.pld-linux.org Git - packages/gdb.git/blob - gdb-vla-intel-stringbt-fix.patch
20cb3fe3b9d17e9e741fff9d860be1dcb48a68c9
[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/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,
34    ctx.per_cu = per_cu;
35    ctx.obj_address = 0;
36  
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;
52  
53    ctx.gdbarch = per_objfile->objfile->arch ();
54 diff --git a/gdb/testsuite/gdb.fortran/dynamic-other-frame-stub.f90 b/gdb/testsuite/gdb.fortran/dynamic-other-frame-stub.f90
55 new file mode 100644
56 --- /dev/null
57 +++ b/gdb/testsuite/gdb.fortran/dynamic-other-frame-stub.f90
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
83 diff --git a/gdb/testsuite/gdb.fortran/dynamic-other-frame.exp b/gdb/testsuite/gdb.fortran/dynamic-other-frame.exp
84 new file mode 100644
85 --- /dev/null
86 +++ b/gdb/testsuite/gdb.fortran/dynamic-other-frame.exp
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.
94 +#
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.
99 +#
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
102 +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
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'.*}
127 diff --git a/gdb/testsuite/gdb.fortran/dynamic-other-frame.f90 b/gdb/testsuite/gdb.fortran/dynamic-other-frame.f90
128 new file mode 100644
129 --- /dev/null
130 +++ b/gdb/testsuite/gdb.fortran/dynamic-other-frame.f90
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.0859 seconds and 2 git commands to generate.