aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.base/corefile.exp
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/testsuite/gdb.base/corefile.exp')
-rw-r--r--gdb/testsuite/gdb.base/corefile.exp115
1 files changed, 71 insertions, 44 deletions
diff --git a/gdb/testsuite/gdb.base/corefile.exp b/gdb/testsuite/gdb.base/corefile.exp
index 61c13c4..6eb1f02 100644
--- a/gdb/testsuite/gdb.base/corefile.exp
+++ b/gdb/testsuite/gdb.base/corefile.exp
@@ -185,35 +185,41 @@ gdb_test "core" "No core file now."
# Test a run (start) command will clear any loaded core file.
-gdb_test "core-file $corefile" "Core was generated by .*" "run: load core again"
-gdb_test "info files" "\r\nLocal core dump file:\r\n.*" "run: sanity check we see the core file"
-
-set test "run: with core"
-if [runto_main] {
- pass $test
-} else {
- fail $test
-}
+proc corefile_test_run {} {
+ global corefile gdb_prompt
+
+ gdb_test "core-file $corefile" "Core was generated by .*" "run: load core again"
+ gdb_test "info files" "\r\nLocal core dump file:\r\n.*" "run: sanity check we see the core file"
-set test "run: core file is cleared"
-gdb_test_multiple "info files" $test {
- -re "\r\nLocal core dump file:\r\n.*\r\n$gdb_prompt $" {
+ set test "run: with core"
+ if [runto_main] {
+ pass $test
+ } else {
fail $test
}
- -re "\r\n$gdb_prompt $" {
- pass $test
+
+ set test "run: core file is cleared"
+ gdb_test_multiple "info files" $test {
+ -re "\r\nLocal core dump file:\r\n.*\r\n$gdb_prompt $" {
+ fail $test
+ }
+ -re "\r\n$gdb_prompt $" {
+ pass $test
+ }
}
-}
-set test "quit with a process"
-gdb_test_multiple "quit" $test {
- -re "A debugging session is active.\r\n.*\r\nQuit anyway\\? \\(y or n\\) $" {
- pass $test
- gdb_test "n" {Not confirmed\.} "quit with processes: n"
+ set test "quit with a process"
+ gdb_test_multiple "quit" $test {
+ -re "A debugging session is active.\r\n.*\r\nQuit anyway\\? \\(y or n\\) $" {
+ pass $test
+ gdb_test "n" {Not confirmed\.} "quit with processes: n"
+ }
}
+
+ gdb_exit
}
-gdb_exit
+corefile_test_run
# Verify there is no question if only a core file is loaded.
@@ -235,37 +241,48 @@ gdb_exit
# Test an attach command will clear any loaded core file.
-if ![is_remote target] {
- set test "attach: spawn sleep"
- set res [remote_spawn host "$binfile sleep"]
- if { $res < 0 || $res == "" } {
- fail $test
- return
- }
- set pid [exp_pid -i $res]
- # We don't care whether the program is still in the startup phase when we
- # attach.
-
- gdb_start
+proc corefile_test_attach {{async 0}} {
+ global binfile corefile gdb_prompt
- gdb_test "core-file $corefile" "Core was generated by .*" "attach: load core again"
- gdb_test "info files" "\r\nLocal core dump file:\r\n.*" "attach: sanity check we see the core file"
+ if ![is_remote target] {
+ set test "attach: spawn sleep"
+ set res [remote_spawn host "$binfile sleep"]
+ if { $res < 0 || $res == "" } {
+ fail $test
+ return
+ }
+ set pid [exp_pid -i $res]
+ # We don't care whether the program is still in the startup phase when we
+ # attach.
- gdb_test "attach $pid" "Attaching to process $pid\r\n.*" "attach: with core"
+ gdb_start
- set test "attach: core file is cleared"
- gdb_test_multiple "info files" $test {
- -re "\r\nLocal core dump file:\r\n.*\r\n$gdb_prompt $" {
- fail $test
+ if {$async} {
+ gdb_test_no_output "set target-async on" \
+ "enable target-async for attach tests"
}
- -re "\r\n$gdb_prompt $" {
- pass $test
+
+ gdb_test "core-file $corefile" "Core was generated by .*" "attach: load core again"
+ gdb_test "info files" "\r\nLocal core dump file:\r\n.*" "attach: sanity check we see the core file"
+
+ gdb_test "attach $pid" "Attaching to process $pid\r\n.*" "attach: with core"
+
+ set test "attach: core file is cleared"
+ gdb_test_multiple "info files" $test {
+ -re "\r\nLocal core dump file:\r\n.*\r\n$gdb_prompt $" {
+ fail $test
+ }
+ -re "\r\n$gdb_prompt $" {
+ pass $test
+ }
}
- }
- gdb_exit
+ gdb_exit
+ }
}
+corefile_test_attach
+
# Test warning-free core file load. E.g., a Linux vDSO used to
# trigger this warning:
# warning: Can't read pathname for load map: Input/output error.
@@ -281,3 +298,13 @@ gdb_test_multiple "core-file $corefile" $test {
pass $test
}
}
+
+
+# Try a couple tests again with target-async.
+with_test_prefix "target-async" {
+ clean_restart ${testfile}
+
+ gdb_test_no_output "set target-async on"
+ corefile_test_run
+ corefile_test_attach 1
+}