-# Copyright 2009-2016 Free Software Foundation, Inc.
+# Copyright 2009-2019 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
set testfile "multi-arch"
# The plain remote target can't do multiple inferiors.
-if [target_info exists use_gdb_stub] {
+if [use_gdb_stub] {
return
}
set march2 "-m32"
}
-if { [prepare_for_testing ${testfile}.exp ${exec1} "${srcfile1}" \
+if { [prepare_for_testing "failed to prepare" ${exec1} "${srcfile1}" \
[list debug additional_flags=${march1}]] } {
return -1
}
lappend options "additional_flags=${march2}"
}
-if { [prepare_for_testing ${testfile}.exp ${exec2} "${srcfile2}" \
+if { [prepare_for_testing "failed to prepare" ${exec2} "${srcfile2}" \
$options]} {
return -1
}
gdb_test "info inferiors" \
"Executable.*${exec1}.*${exec2}.*"
+
+# Now select inferior 2, and trigger an event in inferior 1. This
+# tries to check that GDB doesn't incorrectly uses the architecture of
+# inferior 2 when parsing the expedited registers in a stop reply for
+# inferior 1 (when remote debugging).
+
+gdb_test_no_output "set schedule-multiple on"
+
+with_test_prefix "inf1 event with inf2 selected" {
+ gdb_test "inferior 2" "Switching to inferior 2.*thread 2\.1.*main.*${srcfile2}.*"
+ gdb_test "b hello_loop" "Breakpoint .* at .*${srcfile1}.*"
+ gdb_test "c" " hello_loop.*" "continue to hello_loop"
+}
+
+delete_breakpoints
+
+# Same, but the other way around: select inferior 1 and trigger an
+# event in inferior 2.
+
+with_test_prefix "inf2 event with inf1 selected" {
+ gdb_test "inferior 1" "Switching to inferior 1.*thread 1\.1.*hello_loop.*${srcfile1}.*"
+ gdb_test "b hangout_loop" "Breakpoint .* at .*${srcfile2}.*"
+ gdb_test "c" " hangout_loop.*" "continue to hangout_loop"
+}