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]
7 FileName: gdb-vla-intel-stringbt-fix.patch
11 http://sourceware.org/ml/gdb-patches/2014-08/msg00025.html
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.
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
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
27 The fix below has no regressions for me. Unfortunately I do not see why you
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
42 diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c
43 index 5105c8d23a..5486e4dc12 100644
49 #include <unordered_set>
50 +#include <functional>
51 #include "common/underlying.h"
52 #include "common/byte-vector.h"
54 @@ -2348,6 +2349,20 @@ dwarf2_evaluate_loc_desc_full (struct type *type, struct frame_info *frame,
58 +frame_id old_frame_id (get_frame_id (deprecated_safe_get_selected_frame ()));
61 + const std::function<void ()> func;
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);
70 +if (frame != NULL) select_frame (frame);
72 scoped_value_mark free_values;
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
77 index 0000000000..261ce17ae5
79 +++ b/gdb/testsuite/gdb.fortran/dynamic-other-frame-stub.f90
81 +! Copyright 2010 Free Software Foundation, Inc.
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.
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.
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.
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>.
105 diff --git a/gdb/testsuite/gdb.fortran/dynamic-other-frame.exp b/gdb/testsuite/gdb.fortran/dynamic-other-frame.exp
107 index 0000000000..570a28ca65
109 +++ b/gdb/testsuite/gdb.fortran/dynamic-other-frame.exp
111 +# Copyright 2010 Free Software Foundation, Inc.
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.
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.
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.
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}]
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}"
140 +clean_restart ${executable}
142 +gdb_test_no_output "set print frame-arguments all"
144 +if ![runto bar_] then {
145 + perror "couldn't run to bar_"
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
152 index 0000000000..2bc637db49
154 +++ b/gdb/testsuite/gdb.fortran/dynamic-other-frame.f90
156 +! Copyright 2010 Free Software Foundation, Inc.
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.
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.
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.
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>.
176 +subroutine foo (string)
181 + character string*(*)
182 + call bar ! stop-here
186 + subroutine foo (string)
187 + character string*(*)