gdb: add target_ops::supports_displaced_step
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.base / call-signal-resume.exp
index 58a12c0afbefdc205b42b94e7e2bc56a897533ad..ab9eed6c86d7cd04e96543b5f1aad66f1b29f72e 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright 2008, 2010 Free Software Foundation, Inc.
+# Copyright 2008-2020 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
+     untested "failed to compile"
      return -1
 }
 
 # 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"
+    fail "can't run to main"
     return 0
 }
 
@@ -91,15 +66,10 @@ gdb_test "continue" "Continuing.*Breakpoint \[0-9\]*, stop_one.*" \
 
 # 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]
@@ -111,10 +81,22 @@ if { "$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 .*"
@@ -144,8 +126,8 @@ if { "$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" ""
 
 # Continue again, this time we should get to the signal handler.
@@ -156,7 +138,7 @@ gdb_test "continue" "Breakpoint \[0-9\]*, handle_signal.*" \
 
 # 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
This page took 0.043582 seconds and 4 git commands to generate.