1 # This testcase is part of GDB, the GNU debugger.
3 # Copyright 2018-2024 Free Software Foundation, Inc.
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.
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.
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/>.
20 proc test_good { arg } {
21 gdb_test_no_output "set record btrace cpu $arg" "set cpu $arg"
22 gdb_test "show record btrace cpu" "btrace cpu is '$arg'\." \
26 proc test_bad { arg current } {
27 gdb_test "set record btrace cpu $arg" \
28 "Bad format\. See \"help set record btrace cpu\"\." \
30 gdb_test "show record btrace cpu" "btrace cpu is '$current'\." \
34 proc test_junk { arg junk current } {
35 gdb_test "set record btrace cpu $arg" \
36 "Trailing junk: '$junk'\." \
38 gdb_test "show record btrace cpu" "btrace cpu is '$current'\." \
42 gdb_test "show record btrace cpu" "btrace cpu is 'auto'\." "default cpu"
44 gdb_test "set record" \
45 "List of \"set record\" subcommands.*"
46 gdb_test "set record btrace" \
47 "List of \"set record btrace\" subcommands.*"
50 test_good "intel: 0/0"
51 test_good "intel: 0/0/1"
53 # We omit a zero stepping in the output.
54 gdb_test_no_output "set record btrace cpu intel: 0/0/0" \
55 "set cpu intel: 0/0/0"
56 gdb_test "show record btrace cpu" "btrace cpu is 'intel: 0/0'\." \
57 "show cpu intel: 0/0/0"
62 test_bad "intel: foo" "none"
63 test_bad "intel: 0" "none"
64 test_bad "intel: 0/" "none"
65 test_bad "intel: 0/foo" "none"
66 test_bad "intel: foo/bar" "none"
67 test_bad "intel: foo/0" "none"
68 test_bad "intel: 0x0/0" "none"
70 test_junk "intel: 0/0 foo" " foo" "none"
71 test_junk "intel: 0/0x0" "x0" "none"
72 test_junk "intel: 0/0/foo" "/foo" "none"
73 test_junk "intel: 0/0/0 foo" " foo" "none"
74 test_junk "intel: 0/0/0x0" "x0" "none"