-# Copyright 2008, 2010 Free Software Foundation, Inc.
+# Copyright 2008-2016 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# 2) Inferior is stopped at a signal. Upon resumption it should continue
# with that signal, regardless of whatever the hand-called function did.
-if $tracelevel then {
- strace $tracelevel
-}
-
-if [target_info exists gdb,noinferiorio] {
- verbose "Skipping call-signal-resume.exp because of no fileio capabilities."
- continue
-}
-
if [target_info exists gdb,nosignals] {
verbose "Skipping call-signal-resume.exp because of nosignals."
continue
}
-set testfile "call-signals"
-set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
+standard_testfile call-signals.c
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
untested call-signal-resume.exp
# Some targets can't do function calls, so don't even bother with this
# test.
if [target_info exists gdb,cannot_call_functions] {
- setup_xfail "*-*-*" 2416
- fail "This target can not call functions"
+ unsupported "This target can not call functions"
continue
}
proc get_dummy_frame_number { } {
- global gdb_prompt
-
- send_gdb "bt\n"
- gdb_expect {
- -re "#(\[0-9\]*) *<function called from gdb>.*$gdb_prompt $"
- {
- return $expect_out(1,string)
- }
- -re "$gdb_prompt $"
- {
- return ""
- }
- timeout
- {
- return ""
- }
- }
- return ""
+ global gdb_prompt
+
+ gdb_test_multiple "bt" "backtrace" {
+ -re "#(\[0-9\]*) *<function called from gdb>.*$gdb_prompt $" {
+ return $expect_out(1,string)
+ }
+ }
+ return ""
}
# Start with a fresh gdb.
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
+clean_restart ${binfile}
if { ![runto_main] } {
fail "Can't run to main"
# Call function (causing the program to get a signal), and see if gdb handles
# it properly.
-gdb_test_multiple "call gen_signal ()" \
- "inferior function call signaled" {
- -re "\[\r\n\]*no signal\[\r\n\]+$gdb_prompt $" {
- unsupported "inferior function call signaled"
- return 0
- }
- -re "\[\r\n\]*The program being debugged was signaled.*\[\r\n\]+$gdb_prompt $" {
- pass "inferior function call signaled"
- }
+if {[gdb_test "call gen_signal ()" \
+ "\[\r\n\]*The program being debugged was signaled.*" \
+ "inferior function call signaled"] != 0} {
+ return 0
}
set frame_number [get_dummy_frame_number]
}
# Pop the dummy frame.
-gdb_test "frame $frame_number" ""
-gdb_test "set confirm off" ""
+gdb_test "frame $frame_number" ".*"
+gdb_test_no_output "set confirm off"
gdb_test "return" ""
+# Verify there are no remains of the dummy frame.
+gdb_test_no_output "maintenance print dummy-frames"
+set test "maintenance info breakpoints"
+gdb_test_multiple $test $test {
+ -re " call dummy .*\r\n$gdb_prompt $" {
+ fail $test
+ }
+ -re "\r\n$gdb_prompt $" {
+ pass $test
+ }
+}
+
# Resume execution, the program should continue without any signal.
gdb_test "break stop_two" "Breakpoint \[0-9\]* at .*"
}
# Pop the dummy frame.
-gdb_test "frame $frame_number" ""
-gdb_test "set confirm off" ""
+gdb_test "frame $frame_number" ".*"
+gdb_test_no_output "set confirm off"
gdb_test "return" ""
# Continue again, this time we should get to the signal handler.
# Continue one last time, the program should exit normally.
-gdb_test "continue" "Program exited normally." \
+gdb_test "continue" "$inferior_exited_re normally." \
"continue to program exit"
return 0