1 # This testcase is part of GDB, the GNU debugger. 2 # 3 # Copyright 2018-2024 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 gdb_start 19 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'\." \ 23 "show cpu $arg" 24 } 25 26 proc test_bad { arg current } { 27 gdb_test "set record btrace cpu $arg" \ 28 "Bad format\. See \"help set record btrace cpu\"\." \ 29 "set cpu $arg" 30 gdb_test "show record btrace cpu" "btrace cpu is '$current'\." \ 31 "show cpu $arg" 32 } 33 34 proc test_junk { arg junk current } { 35 gdb_test "set record btrace cpu $arg" \ 36 "Trailing junk: '$junk'\." \ 37 "set cpu $arg" 38 gdb_test "show record btrace cpu" "btrace cpu is '$current'\." \ 39 "show cpu $arg" 40 } 41 42 gdb_test "show record btrace cpu" "btrace cpu is 'auto'\." "default cpu" 43 44 gdb_test "set record" \ 45 "List of set record subcommands.*" 46 gdb_test "set record btrace" \ 47 "List of set record btrace subcommands.*" 48 test_bad "" "auto" 49 50 test_good "intel: 0/0" 51 test_good "intel: 0/0/1" 52 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" 58 59 test_good "auto" 60 test_good "none" 61 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" 69 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" 75