stale-infcall.exp revision 1.7
1# Copyright (C) 2012-2017 Free Software Foundation, Inc.
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
16standard_testfile .c
17
18if { [prepare_for_testing "failed to prepare" $testfile $srcfile] } {
19    return -1
20}
21
22if ![runto_main] {
23    return -1
24}
25
26gdb_breakpoint [gdb_get_line_number "test-next"] temporary
27gdb_continue_to_breakpoint "test-next" ".* test-next .*"
28gdb_breakpoint [gdb_get_line_number "test-fail"]
29gdb_test_no_output {set $test_fail_bpnum=$bpnum}
30
31set test "test system longjmp tracking support"
32gdb_test_multiple "next" $test {
33    -re " test-pass .*\r\n$gdb_prompt $" {
34	pass $test
35    }
36    -re "( test-fail .*|\r\nCannot insert breakpoint 0\\.\r\n.*)\r\n$gdb_prompt $" {
37	xfail $test
38	untested "system lacks support for tracking longjmps"
39	return -1
40    }
41}
42gdb_test_no_output {delete $test_fail_bpnum}
43
44gdb_breakpoint [gdb_get_line_number "break-run1"]
45gdb_breakpoint [gdb_get_line_number "break-run2"]
46gdb_breakpoint [gdb_get_line_number "break-exit"]
47gdb_breakpoint [gdb_get_line_number "break-fail"]
48
49gdb_continue_to_breakpoint "break-run1" ".* break-run1 .*"
50
51gdb_test "print infcall ()" " break-run2 .*The program being debugged stopped while in a function called from GDB\\..*When the function is done executing, GDB will silently stop\\."
52
53set test "stack corrupted"
54gdb_test_multiple "continue" $test {
55    -re " break-exit .*\r\n$gdb_prompt $" {
56	pass $test
57    }
58    -re " break-fail .*\r\n$gdb_prompt $" {
59	fail $test
60    }
61}
62
63gdb_test "bt" "#0 \[^\r\n\]* main \[^\r\n\]*"
64
65# Verify there are no remains of the dummy frame.
66gdb_test_no_output "maintenance print dummy-frames"
67set test "maintenance info breakpoints"
68gdb_test_multiple $test $test {
69    -re " call dummy .*\r\n$gdb_prompt $" {
70	fail $test
71    }
72    -re "\r\n$gdb_prompt $" {
73	pass $test
74    }
75}
76