gdb/testsuite/ChangeLog:
2016-07-13 Anton Kolesov <Anton.Kolesov@synopsys.com>
* gdb.base/callexit.exp: Expect an "exit()" only if
"exit_is_reliable" says so.
* gdb.base/commands.exp: Likewise.
* gdb.base/ena-dis-br.exp: Likewise.
* gdb.base/hook-stop.exp: Likewise.
* gdb.base/nextoverexit.exp: Likewise.
* gdb.mi/mi-break.exp: Likewise.
* gdb.mi/mi-exit-code.exp: Likewise.
* gdb.mi/mi-simplerun.exp: Likewise.
Signed-off-by: Anton Kolesov <Anton.Kolesov@synopsys.com>
---
gdb/testsuite/gdb.base/callexit.exp | 7 +++++++
gdb/testsuite/gdb.base/commands.exp | 14 ++++++++++++++
gdb/testsuite/gdb.base/ena-dis-br.exp | 18 +++++++++++-------
gdb/testsuite/gdb.base/hook-stop.exp | 12 +++++++++++-
gdb/testsuite/gdb.base/nextoverexit.exp | 7 +++++++
gdb/testsuite/gdb.mi/mi-break.exp | 5 +++++
gdb/testsuite/gdb.mi/mi-exit-code.exp | 5 +++++
gdb/testsuite/gdb.mi/mi-simplerun.exp | 5 +++++
8 files changed, 65 insertions(+), 8 deletions(-)
diff --git a/gdb/testsuite/gdb.base/callexit.exp b/gdb/testsuite/gdb.base/callexit.exp
index 67ff48283646..4fc2d5a2669a 100644
--- a/gdb/testsuite/gdb.base/callexit.exp
+++ b/gdb/testsuite/gdb.base/callexit.exp
@@ -28,6 +28,13 @@ if [target_info exists gdb,cannot_call_functions] {
continue
}
+# Some targets (for example baremetal ones) doesn't have exit() that actually
+# exits anywhere.
+if ![exit_is_reliable] {
+ unsupported "This target doesn't have reliable exit() function."
+ continue
+}
+
# Start with a fresh gdb.
clean_restart ${binfile}
diff --git a/gdb/testsuite/gdb.base/commands.exp b/gdb/testsuite/gdb.base/commands.exp
index 869d0a81a4a7..fd92b3fa3111 100644
--- a/gdb/testsuite/gdb.base/commands.exp
+++ b/gdb/testsuite/gdb.base/commands.exp
@@ -694,6 +694,13 @@ proc_with_prefix deprecated_command_test {} {
proc_with_prefix bp_deleted_in_command_test {} {
global gdb_prompt
+ # Flow of this test assumes that application will halt after reaching the
+ # exit() function.
+ if ![exit_is_reliable] {
+ unsupported "Function exit() is not reliable on this board."
+ return 0
+ }
+
delete_breakpoints
# Create a breakpoint, and associate a command-list to it, with
@@ -736,6 +743,13 @@ proc_with_prefix bp_deleted_in_command_test {} {
}
proc_with_prefix temporary_breakpoint_commands {} {
+ # Flow of this test assumes that application will halt after reaching the
+ # exit() function.
+ if ![exit_is_reliable] {
+ unsupported "Function exit() is not reliable on this board."
+ return 0
+ }
+
delete_breakpoints
# Create a temporary breakpoint, and associate a commands list to it.
diff --git a/gdb/testsuite/gdb.base/ena-dis-br.exp b/gdb/testsuite/gdb.base/ena-dis-br.exp
index c338a0d51fa9..bf670cbae948 100644
--- a/gdb/testsuite/gdb.base/ena-dis-br.exp
+++ b/gdb/testsuite/gdb.base/ena-dis-br.exp
@@ -295,13 +295,17 @@ gdb_test "continue 2" \
gdb_test "next" ".*$bp_location11\[ \t\]*marker1.*" \
"step after continue with ignore count"
-set test "continue with ignore count, not stopped at bpt"
-gdb_test_multiple "continue 2" "$test" {
- -re "Not stopped at any breakpoint; argument ignored.*$gdb_prompt $" {
- pass "$test"
- }
- -re "No breakpoint number -1.*$gdb_prompt $" {
- kfail gdb/1689 "$test"
+# Application is expected to reach an exit() here, so this can't be run if exit
+# is not working.
+if [exit_is_reliable] {
+ set test "continue with ignore count, not stopped at bpt"
+ gdb_test_multiple "continue 2" "$test" {
+ -re "Not stopped at any breakpoint; argument ignored.*$gdb_prompt $" {
+ pass "$test"
+ }
+ -re "No breakpoint number -1.*$gdb_prompt $" {
+ kfail gdb/1689 "$test"
+ }
}
}
diff --git a/gdb/testsuite/gdb.base/hook-stop.exp b/gdb/testsuite/gdb.base/hook-stop.exp
index 6b49e39b7380..c9bc3d3b6438 100644
--- a/gdb/testsuite/gdb.base/hook-stop.exp
+++ b/gdb/testsuite/gdb.base/hook-stop.exp
@@ -165,5 +165,15 @@ proc hook_stop_next {} {
hook_stop_before_frame
hook_stop_kill
hook_stop_continue_fg
-hook_stop_continue_bg
+
+# Tests that run in background will not run properly with targets that
+# doesn't have a proper "exit" function. For example, this particular
+# test expects that after hook will resume inferior in background, there
+# would be a message "exited normally", however such a message will
+# appear only for targets with a proper # exit(), while others will, for
+# example, spin in the infinite loop.
+if [exit_is_reliable] {
+ hook_stop_continue_bg
+}
+
hook_stop_next
diff --git a/gdb/testsuite/gdb.base/nextoverexit.exp b/gdb/testsuite/gdb.base/nextoverexit.exp
index 30eafef675ff..fcea35762b00 100644
--- a/gdb/testsuite/gdb.base/nextoverexit.exp
+++ b/gdb/testsuite/gdb.base/nextoverexit.exp
@@ -14,6 +14,13 @@
standard_testfile
+# This tests expects message "inferior exited normally", which is present only
+# when exit() actually halts the target.
+if ![exit_is_reliable] {
+ unsupported "Function exit() is not reliable on this board."
+ return 0
+}
+
if {[prepare_for_testing "failed to prepare" $testfile $testfile.c]} {
return -1
}
diff --git a/gdb/testsuite/gdb.mi/mi-break.exp b/gdb/testsuite/gdb.mi/mi-break.exp
index 1149bb34c8dc..acec246f52ee 100644
--- a/gdb/testsuite/gdb.mi/mi-break.exp
+++ b/gdb/testsuite/gdb.mi/mi-break.exp
@@ -244,6 +244,11 @@ proc test_disabled_creation {} {
proc test_breakpoint_commands {} {
global line_callee2_body
+ if ![exit_is_reliable] {
+ unsupported "This test requires working exit() function."
+ return 0
+ }
+
set bp_no_script \
[mi_create_breakpoint "basics.c:callee2" \
"breakpoint commands: insert breakpoint at basics.c:callee2" \
diff --git a/gdb/testsuite/gdb.mi/mi-exit-code.exp b/gdb/testsuite/gdb.mi/mi-exit-code.exp
index f10b49cee0f8..fb5c693597da 100644
--- a/gdb/testsuite/gdb.mi/mi-exit-code.exp
+++ b/gdb/testsuite/gdb.mi/mi-exit-code.exp
@@ -23,6 +23,11 @@ if [mi_gdb_start] {
standard_testfile
+if ![exit_is_reliable] {
+ unsupported "Function exit() is not reliable on this board."
+ return 0
+}
+
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
untested "failed to compile"
return -1
diff --git a/gdb/testsuite/gdb.mi/mi-simplerun.exp b/gdb/testsuite/gdb.mi/mi-simplerun.exp
index 20a079ead896..ce19122803da 100644
--- a/gdb/testsuite/gdb.mi/mi-simplerun.exp
+++ b/gdb/testsuite/gdb.mi/mi-simplerun.exp
@@ -177,6 +177,11 @@ proc test_program_termination {} {
# -exec-abort
# (normal termination of inferior)
+ if ![exit_is_reliable] {
+ unsupported "Function exit() is not reliable on this board."
+ return
+ }
+
mi_execute_to "exec-continue" "exited-normally" "" "" "" "" "" "continue to end"
}