Automatic Copyright Year update after running gdb/copyright.py
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.base / premature-dummy-frame-removal.exp
CommitLineData
88b9d363 1# Copyright 2021-2022 Free Software Foundation, Inc.
b4b3e2de
AB
2
3# This program is free software; you can redistribute it and/or modify
4# it under the terms of the GNU General Public License as published by
5# the Free Software Foundation; either version 3 of the License, or
6# (at your option) any later version.
7#
8# This program is distributed in the hope that it will be useful,
9# but WITHOUT ANY WARRANTY; without even the implied warranty of
10# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11# GNU General Public License for more details.
12#
13# You should have received a copy of the GNU General Public License
14# along with this program. If not, see <http://www.gnu.org/licenses/>.
15
16# Make an inferior call to a function which uses longjmp. However,
17# the backtrace for the function that is called is broken at the point
18# where the longjmp is handled. This test is checking to see if the
19# inferior call still completes successfully.
20#
21# This test forces a broken backtrace using Python, but in real life a
22# broken backtrace can easily occur when calling through code for
23# which there is no debug information if the prologue unwinder fails,
24# which can often happen if the code has been optimized.
25#
26# The problem was that, due to the broken backtrace, GDB failed to
27# find the inferior call's dummy frame. GDB then concluded that the
28# inferior had longjmp'd backward past the dummy frame and so garbage
29# collected the dummy frame, this causes the breakpoint within the
30# dummy frame to be deleted.
31#
32# When the inferior continued, and eventually returned to the dummy
33# frame, it would try to execute instruction from the dummy frame
34# (which for most, or even all, targets, is on the stack), and then
35# experience undefined behaviuor, often a SIGSEGV.
36
37standard_testfile .c
38
39if { [prepare_for_testing "failed to prepare" $testfile $srcfile] } {
40 return -1
41}
42
43if ![runto_main] then {
44 return 0
45}
46
47# Skip this test if Python scripting is not enabled.
48if { [skip_python_tests] } { continue }
49
50set pyfile [gdb_remote_download host ${srcdir}/${subdir}/${testfile}.py]
51gdb_test_no_output "source ${pyfile}" "load python file"
52
53gdb_test "p some_func ()" " = 0"
This page took 0.065772 seconds and 4 git commands to generate.