diff options
author | Yao Qi <yao@codesourcery.com> | 2013-04-10 06:12:01 +0000 |
---|---|---|
committer | Yao Qi <yao@codesourcery.com> | 2013-04-10 06:12:01 +0000 |
commit | b7a273f8c632d5bc5005fb7ece063a5ed0091bc5 (patch) | |
tree | c7778f37261f7afd27e75a7b05e02799ab21f047 /gdb/testsuite | |
parent | f37867715f724282d197fb57dcad0764eb60e2e8 (diff) | |
download | gdb-b7a273f8c632d5bc5005fb7ece063a5ed0091bc5.zip gdb-b7a273f8c632d5bc5005fb7ece063a5ed0091bc5.tar.gz gdb-b7a273f8c632d5bc5005fb7ece063a5ed0091bc5.tar.bz2 |
gdb/testsuite/
* gdb.trace/actions.exp (check_tracepoint): New.
(top level): Start the tracing and check the actions of
tracepoints. Save trace data to tfile format. Restart GDB
and read trace file in tfile target. Check the actions of
tracepoints again.
* gdb.trace/while-stepping.exp: Likewise.
Diffstat (limited to 'gdb/testsuite')
-rw-r--r-- | gdb/testsuite/ChangeLog | 9 | ||||
-rw-r--r-- | gdb/testsuite/gdb.trace/actions.exp | 84 | ||||
-rw-r--r-- | gdb/testsuite/gdb.trace/while-stepping.exp | 46 |
3 files changed, 139 insertions, 0 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 7017475..574aff8 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,5 +1,14 @@ 2013-04-10 Yao Qi <yao@codesourcery.com> + * gdb.trace/actions.exp (check_tracepoint): New. + (top level): Start the tracing and check the actions of + tracepoints. Save trace data to tfile format. Restart GDB + and read trace file in tfile target. Check the actions of + tracepoints again. + * gdb.trace/while-stepping.exp: Likewise. + +2013-04-10 Yao Qi <yao@codesourcery.com> + * gdb.trace/report.exp: Use standard_output_file for saved trace file. diff --git a/gdb/testsuite/gdb.trace/actions.exp b/gdb/testsuite/gdb.trace/actions.exp index f8a5266..5fa1b97 100644 --- a/gdb/testsuite/gdb.trace/actions.exp +++ b/gdb/testsuite/gdb.trace/actions.exp @@ -235,3 +235,87 @@ gdb_test "info tracepoints" \ \[\t \]+not installed on target." \ "5.10a: verify teval actions set for two tracepoints" +gdb_test "break main" +gdb_run_cmd +gdb_test "" "Breakpoint .*" +if ![gdb_target_supports_trace] { + unsupported "target does not support trace" + return -1 +} + +gdb_trace_setactions "set actions for first tracepoint" \ + "$trcpt1" \ + "collect \$regs" "^$" \ + "end" "" + +# Check the definition of tracepoints. These tracepoints may have +# different number in different runs. + +proc check_tracepoint { data_source } { + with_test_prefix "$data_source" { + global gdb_prompt + global srcfile + + set tp_on_gdb_c_test 0 + set tp_on_gdb_asm_test 0 + set tp_on_gdb_recursion_test 0 + + # Since the three tracepoints may appear in different orders, so + # we can't do 'info tracepoints' to match the output. Instead, we + # show each tracepoint one by one and record the number of each + # tracepoint shown up the output. Check the number finally. + for {set i 1} {$i < 4} {incr i 1} { + set test "info tracepoints $i" + gdb_test_multiple "info tracepoints $i" $test { + -re "\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_c_test at .*$srcfile:\[0-9\]+\\r\\n\[\t \]+collect \\\$regs\\r\\n\[\t \]+installed on target" { + incr tp_on_gdb_c_test + exp_continue + } + -re "\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_asm_test at .*$srcfile:\[0-9\]+\\r\\n\[\t \]+teval \\\$tsv \\+= 1\\r\\n\[\t \]+installed on target" { + incr tp_on_gdb_asm_test + exp_continue + } + -re "\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_recursion_test at .*$srcfile:\[0-9\]+\\r\\n\[\t \]+collect gdb_long_test\\r\\n\[\t \]+installed on target" { + incr tp_on_gdb_recursion_test + exp_continue + } + -re "${gdb_prompt} $" { + } + } + } + + if {$tp_on_gdb_c_test == 1} { + pass "tracepoint on gdb_c_test" + } else { + fail "tracepoint on gdb_c_test" + } + if {$tp_on_gdb_asm_test == 1} { + pass "tracepoint on gdb_asm_test" + } else { + fail "tracepoint on gdb_asm_test" + } + if {$tp_on_gdb_recursion_test == 1} { + pass "tracepoint on gdb_recursion_test" + } else { + fail "tracepoint on gdb_recursion_test $tp_on_gdb_recursion_test" + } + } +} + +# Start and stop the tracing, so that we can save tracepoints +# definitions to trace file. +gdb_test_no_output "tstart" "" +check_tracepoint "live" +gdb_test_no_output "tstop" "" +set tracefile [standard_output_file ${testfile}] +gdb_test "tsave ${tracefile}.tf" \ + "Trace data saved to file '${tracefile}.tf'\.\\r" + +# Restart GDB and read the trace data in tfile target. +gdb_exit +gdb_start +gdb_reinitialize_dir $srcdir/$subdir +gdb_file_cmd $binfile +gdb_test "target tfile ${tracefile}.tf" ".*" \ + "change to tfile target" +check_tracepoint "tfile" diff --git a/gdb/testsuite/gdb.trace/while-stepping.exp b/gdb/testsuite/gdb.trace/while-stepping.exp index b80132b..0b823a4 100644 --- a/gdb/testsuite/gdb.trace/while-stepping.exp +++ b/gdb/testsuite/gdb.trace/while-stepping.exp @@ -99,3 +99,49 @@ gdb_test "info tracepoints" \ .*end.*" \ "5.16: confirm actions, step without collecting anything" +gdb_test "break main" +gdb_run_cmd +gdb_test "" "Breakpoint .*" +if ![gdb_target_supports_trace] { + unsupported "target does not support trace" + return -1 +} + +gdb_trace_setactions "set stepcount to $stepcount" \ + "" \ + "while-stepping $stepcount" "" \ + "collect \$regs " "^$" \ + "collect \$locals " "^$" \ + "end" "" + +proc check_tracepoint { data_source } { + with_test_prefix "$data_source" { + global srcfile + global stepcount + + gdb_test "info tracepoints" \ + "Num Type\[ \]+Disp Enb Address\[ \]+What.* +\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_c_test at .*$srcfile:\[0-9\]+. +\[\t \]+while-stepping $stepcount.* +\[\t \]+collect \\\$regs.* +\[\t \]+collect \\\$locals.* +\[\t \]+end.*" + } +} + +gdb_test_no_output "tstart" +check_tracepoint "live" +gdb_test_no_output "tstop" +set tracefile [standard_output_file ${testfile}] +gdb_test "tsave ${tracefile}.tf" \ + "Trace data saved to file '${tracefile}.tf'\.\\r" \ + "save tfile trace file" + +# Restart GDB and read the trace data in tfile target. +gdb_exit +gdb_start +gdb_reinitialize_dir $srcdir/$subdir +gdb_file_cmd $binfile +gdb_test "target tfile ${tracefile}.tf" ".*" \ + "change to tfile target" +check_tracepoint "tfile" |