1 # This testcase is part of GDB, the GNU debugger.
3 # Copyright 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/>.
18 # Test basic Intel PT event tracing
20 require allow_btrace_pt_event_trace_tests
22 standard_testfile null-deref.c
24 if {[prepare_for_testing "failed to prepare" $testfile $srcfile]} {
32 gdb_test_no_output "set record btrace pt event-tracing on"
33 gdb_test_no_output "record btrace pt"
35 gdb_test "continue" "Program received signal SIGSEGV, Segmentation fault.*"
37 # Test printing of at least one INTERRUPT and one IRET event.
38 # This uses test_sequence to avoid random events failing the tests.
39 gdb_test_sequence "record function-call-history" "function-call-history" {
41 "\t \\\[iret(: ip = $hex)?\\\]"
42 "\t \\\[interrupt: vector = 0xe \\\(#pf\\\)(, cr2 = 0x0)?(, ip = 0x\[0-9a-fA-F\]+)?\\\]"
45 # Test the instruction-history. Assembly can differ between compilers. To
46 # avoid creating a .S file for this test we just check the event at the end.
47 gdb_test "record instruction-history" \
48 "$decimal\t \\\[interrupt: vector = 0xe \\\(#pf\\\)(, cr2 = 0x0)?(, ip = $hex)?\\\]"
50 # Test reverse stepping and replay stepping
51 gdb_test "reverse-stepi" "\\\[interrupt: vector = 0xe \\\(#pf\\\)(, cr2 = 0x0)?(, ip = $hex)?\\\].*"
52 gdb_test "stepi" "\\\[interrupt: vector = 0xe \\\(#pf\\\)(, cr2 = 0x0)?(, ip = $hex)?\\\].*"