xref: /netbsd-src/external/gpl3/gdb.old/dist/gdb/testsuite/gdb.btrace/multi-inferior.exp (revision 70f7362772ba52b749c976fb5e86e39a8b2c9afc)
1# This testcase is part of GDB, the GNU debugger.
2#
3# Copyright 2020 Free Software Foundation, Inc.
4#
5# This program is free software; you can redistribute it and/or modify
6# it under the terms of the GNU General Public License as published by
7# the Free Software Foundation; either version 3 of the License, or
8# (at your option) any later version.
9#
10# This program is distributed in the hope that it will be useful,
11# but WITHOUT ANY WARRANTY; without even the implied warranty of
12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13# GNU General Public License for more details.
14#
15# You should have received a copy of the GNU General Public License
16# along with this program.  If not, see <http://www.gnu.org/licenses/>.
17
18# Test that recording is per-inferior.
19#
20# When recording an inferior, threads from other inferiors, both existing
21# and newly created, are not automatically recorded.
22#
23# Each inferior can be recorded separately.
24
25if { [skip_btrace_tests] } {
26    unsupported "target does not support record-btrace"
27    return -1
28}
29
30standard_testfile
31if [prepare_for_testing "failed to prepare" $testfile {} {debug}] {
32    return -1
33}
34
35with_test_prefix "inferior 1" {
36    if ![runto_main] {
37	untested "failed to run to main"
38	return -1
39    }
40}
41
42with_test_prefix "inferior 2" {
43    gdb_test "add-inferior -exec ${binfile}" "Added inferior 2.*" \
44	"add second inferior"
45    gdb_test "inferior 2" "Switching to inferior 2.*"
46
47    if ![runto_main] {
48	untested "inferior 2: failed to run to main"
49	return -1
50    }
51
52    gdb_test_no_output "record btrace" "record btrace"
53}
54
55with_test_prefix "inferior 1" {
56    gdb_test "inferior 1" "Switching to inferior 1.*"
57
58    gdb_test "info record" "No record target is currently active\\."
59    gdb_test_no_output "record btrace" "record btrace"
60}
61
62with_test_prefix "inferior 3" {
63    gdb_test "add-inferior -exec ${binfile}" "Added inferior 3.*" \
64	"add third inferior"
65    gdb_test "inferior 3" "Switching to inferior 3.*"
66
67    if ![runto_main] {
68	untested "inferior 3: failed to run to main"
69	return -1
70    }
71
72    gdb_test "info record" "No record target is currently active\\."
73    gdb_test_no_output "record btrace" "record btrace"
74}
75