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