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]
6 Content-Type: text/plain; charset=us-ascii
7 Content-Disposition: inline
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.
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
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
23 The fix below has no regressions for me. Unfortunately I do not see why you
30 Index: gdb-7.99.90.20170420/gdb/dwarf2loc.c
31 ===================================================================
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
37 #include <unordered_set>
38 +#include <functional>
39 #include "common/underlying.h"
41 extern int dwarf_always_disassemble;
42 @@ -2366,6 +2367,20 @@
46 +frame_id old_frame_id (get_frame_id (deprecated_safe_get_selected_frame ()));
49 + const std::function<void ()> func;
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);
58 +if (frame != NULL) select_frame (frame);
60 scoped_value_mark free_values;
62 ctx.gdbarch = get_objfile_arch (objfile);
63 Index: gdb-7.99.90.20170420/gdb/testsuite/gdb.fortran/dynamic-other-frame-stub.f90
64 ===================================================================
65 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
66 +++ gdb-7.99.90.20170420/gdb/testsuite/gdb.fortran/dynamic-other-frame-stub.f90 2017-04-20 22:29:00.673496899 +0200
68 +! Copyright 2010 Free Software Foundation, Inc.
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.
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.
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.
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>.
92 Index: gdb-7.99.90.20170420/gdb/testsuite/gdb.fortran/dynamic-other-frame.exp
93 ===================================================================
94 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
95 +++ gdb-7.99.90.20170420/gdb/testsuite/gdb.fortran/dynamic-other-frame.exp 2017-04-20 22:29:00.673496899 +0200
97 +# Copyright 2010 Free Software Foundation, Inc.
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.
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.
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.
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}]
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}"
126 +clean_restart ${executable}
128 +gdb_test_no_output "set print frame-arguments all"
130 +if ![runto bar_] then {
131 + perror "couldn't run to bar_"
135 +gdb_test "bt" {foo \(string='hello'.*}
136 Index: gdb-7.99.90.20170420/gdb/testsuite/gdb.fortran/dynamic-other-frame.f90
137 ===================================================================
138 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
139 +++ gdb-7.99.90.20170420/gdb/testsuite/gdb.fortran/dynamic-other-frame.f90 2017-04-20 22:29:00.673496899 +0200
141 +! Copyright 2010 Free Software Foundation, Inc.
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.
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.
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.
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>.
161 +subroutine foo (string)
166 + character string*(*)
167 + call bar ! stop-here
171 + subroutine foo (string)
172 + character string*(*)