-# Copyright 1998-2013 Free Software Foundation, Inc.
+# Copyright 1998-2020 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
# This file was written by Michael Snyder (msnyder@cygnus.com)
-load_lib "trace-support.exp";
+load_lib "trace-support.exp"
gdb_exit
gdb_start
standard_testfile actions.c
+if ![gdb_trace_common_supports_arch] {
+ unsupported "no trace-common.h support for arch"
+ return -1
+}
if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile \
- executable {debug nowarnings}] != "" } {
- untested report.exp
+ executable {debug nowarnings nopie}] != "" } {
+ untested "failed to compile"
return -1
}
gdb_load $binfile
gdb_reinitialize_dir $srcdir/$subdir
if { ![gdb_target_supports_trace] } then {
- unsupported "Current target does not support trace"
+ unsupported "current target does not support trace"
return 1
}
set arg5 5
set arg6 6
-set gdb_recursion_test_baseline [gdb_find_recursion_test_baseline $srcfile];
+set gdb_recursion_test_baseline [gdb_find_recursion_test_baseline $srcfile]
if { $gdb_recursion_test_baseline == -1 } {
- fail "Could not find gdb_recursion_test function"
- return;
+ fail "could not find gdb_recursion_test function"
+ return
}
set return_me 0
}
-re ".*$gdb_prompt $" {
if { ($testline1 == 0) || ($testline2 == 0) || ($testline3 == 0) || ($testline4 == 0) || ($testline5 == 0) || ($testline6 == 0) } {
- untested report.exp
+ untested "unexpected testline values"
set return_me 1
all tests in this module will fail."
}
}
default {
- untested report.exp
+ untested "couldn't match pattern"
set return_me 1
all tests in this module will fail."
}
if { $tdp1 <= 0 || $tdp2 <= 0 || $tdp3 <= 0 || \
$tdp4 <= 0 || $tdp5 <= 0 || $tdp6 <= 0 } then {
fail "setting tracepoints failed"
- return;
+ return
}
gdb_trace_setactions "9.x: setup TP to collect regs" \
"$tdp4" \
"collect \$locs" "^$"
-if [is_amd64_regs_target] {
- set fpreg "rbp"
- set spreg "rsp"
- set pcreg "rip"
-} elseif [is_x86_like_target] {
- set fpreg "ebp"
- set spreg "esp"
- set pcreg "eip"
-} else {
- set fpreg "fp"
- set spreg "sp"
- set pcreg "pc"
-}
-
gdb_trace_setactions "9.x: setup TP to collect stack memory" \
"$tdp5" \
"collect \$$fpreg, \*\(void \*\*\) \$$spreg @ 64" "^$"
gdb_test "tstart" ".*" ""
-gdb_test "break end" ".*" ""
+gdb_breakpoint "end" qualified
gdb_test "continue" \
"Continuing.*Breakpoint $decimal, end.*" \
"run trace experiment"
global tdp1 tdp2 tdp3 tdp4 tdp5 tdp6
global testline1 testline2 testline3 testline4 testline5 testline6
global pcreg fpreg spreg
- global srcfile srcdir subdir
+ global srcfile srcdir subdir binfile
global arg1 arg3
global decimal hex gdb_prompt
#
}
}
}
+
+ # There is always a thread of an inferior, either a live one or
+ # a faked one.
+ gdb_test "info threads" "\\* ${decimal} (process|Thread) \[0-9\.\]+\[ \t\].*"
+ gdb_test "info inferiors" "\\* 1 process ${decimal} \[ \t\]+\[^\r\n\]*\[ \t\]+${binfile}.*"
}
}
"none" "-1"
# Save trace frames to tfile.
-gdb_test "tsave report.tf" "Trace data saved to file 'report.tf'.*"
+set tracefile [standard_output_file ${testfile}]
+gdb_test "tsave ${tracefile}.tf" \
+ "Trace data saved to file '${tracefile}.tf'.*" \
+ "save tfile trace file"
+
+# Save trace frames to ctf.
+gdb_test "tsave -ctf ${tracefile}.ctf" \
+ "Trace data saved to directory '${tracefile}.ctf'.*" \
+ "save ctf trace file"
# Change target to tfile.
set test "change to tfile target"
-gdb_test_multiple "target tfile report.tf" "$test" {
+gdb_test_multiple "target tfile ${tracefile}.tf" "$test" {
-re "A program is being debugged already. Kill it. .y or n. " {
send_gdb "y\n"
exp_continue
}
# Test the collected trace frames from tfile.
use_collected_data "tfile"
+
+# Try to read ctf data if GDB supports.
+gdb_test_multiple "target ctf ${tracefile}.ctf" "" {
+ -re "Undefined target command: \"ctf ${tracefile}.ctf\"\. Try \"help target\"\.\r\n$gdb_prompt $" {
+ }
+ -re ".*\r\n$gdb_prompt $" {
+ use_collected_data "ctf"
+ }
+}