From: Yao Qi <yao@codesourcery.com>
To: <gdb-patches@sourceware.org>
Subject: [PATCH v3 13/15] Test on saving tracepoint defs.
Date: Sat, 09 Mar 2013 03:49:00 -0000 [thread overview]
Message-ID: <1362800844-27940-14-git-send-email-yao@codesourcery.com> (raw)
In-Reply-To: <1362800844-27940-1-git-send-email-yao@codesourcery.com>
Presently, we don't have a test on writing actions of tracepoints to
trace file, and read trace file back to see if any differences on
tracepoints actions. This is what this patch tries to do. This is
useful to exercise the code on saving actions and restoring actions
from trace file.
It also paves the way for test CTF in this area.
gdb/testsuite:
2013-03-08 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.
---
gdb/testsuite/gdb.trace/actions.exp | 82 ++++++++++++++++++++++++++++
gdb/testsuite/gdb.trace/while-stepping.exp | 42 ++++++++++++++
2 files changed, 124 insertions(+), 0 deletions(-)
diff --git a/gdb/testsuite/gdb.trace/actions.exp b/gdb/testsuite/gdb.trace/actions.exp
index f8a5266..7bbe6b6 100644
--- a/gdb/testsuite/gdb.trace/actions.exp
+++ b/gdb/testsuite/gdb.trace/actions.exp
@@ -235,3 +235,85 @@ 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" ""
+gdb_test "tsave ${testfile}.tf" \
+ "Trace data saved to file '${testfile}.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 ${testfile}.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..0f316eb 100644
--- a/gdb/testsuite/gdb.trace/while-stepping.exp
+++ b/gdb/testsuite/gdb.trace/while-stepping.exp
@@ -99,3 +99,45 @@ 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"
+gdb_test "tsave ${testfile}.tf" \
+ "Trace data saved to file '${testfile}.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 ${testfile}.tf" ".*" \
+ "change to tfile target"
+check_tracepoint "tfile"
--
1.7.7.6
next prev parent reply other threads:[~2013-03-09 3:49 UTC|newest]
Thread overview: 60+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-09 3:48 [PATCH v3 00/15] CTF Support Yao Qi
2013-03-09 3:49 ` [PATCH v3 06/15] Write status to CTF and read Yao Qi
2013-03-12 19:31 ` Tom Tromey
2013-03-14 18:06 ` Doug Evans
2013-03-29 14:46 ` Yao Qi
2013-03-29 16:47 ` Doug Evans
2013-03-09 3:49 ` Yao Qi [this message]
2013-03-12 20:10 ` [PATCH v3 13/15] Test on saving tracepoint defs Tom Tromey
2013-03-13 9:48 ` Yao Qi
2013-03-13 14:58 ` Tom Tromey
2013-03-09 3:49 ` [PATCH v3 01/15] Refactor 'tsave' Yao Qi
2013-03-12 18:30 ` Tom Tromey
2013-03-13 10:33 ` Yao Qi
2013-03-13 19:26 ` Tom Tromey
2013-03-14 9:17 ` Yao Qi
2013-03-09 3:49 ` [PATCH v3 11/15] Write tsv definition in CTF and read Yao Qi
2013-03-12 19:56 ` Tom Tromey
2013-03-09 3:49 ` [PATCH v3 07/15] Write trace notes and username into tfile Yao Qi
2013-03-12 19:35 ` Tom Tromey
2013-03-09 3:49 ` [PATCH v3 09/15] Check the tstatus output on tfile target Yao Qi
2013-03-12 19:45 ` Tom Tromey
2013-03-09 3:49 ` [PATCH v3 08/15] Write 'stop_desc' of trace status to tfile Yao Qi
2013-03-12 19:15 ` Tom Tromey
2013-03-09 3:49 ` [PATCH v3 05/15] ctf test: report.exp Yao Qi
2013-03-12 19:25 ` Tom Tromey
2013-03-09 3:49 ` [PATCH v3 15/15] MAINTAINERS Yao Qi
2013-03-09 3:49 ` [PATCH v3 14/15] Test on saving tracepoint defs: CTF Yao Qi
2013-03-12 20:23 ` Tom Tromey
2013-03-13 9:55 ` Yao Qi
2013-03-13 15:49 ` Tom Tromey
2013-03-09 3:49 ` [PATCH v3 02/15] Save trace into CTF format Yao Qi
2013-03-12 18:49 ` Tom Tromey
2013-03-13 10:33 ` Yao Qi
2013-03-13 19:30 ` Tom Tromey
2013-03-14 17:49 ` Doug Evans
2013-03-09 3:49 ` [PATCH v3 10/15] tstatus.exp: ctf Yao Qi
2013-03-12 19:48 ` Tom Tromey
2013-03-09 3:49 ` [PATCH v3 12/15] Write tracepoint definition in CTF and read Yao Qi
2013-03-12 20:02 ` Tom Tromey
2013-03-14 18:34 ` Doug Evans
2013-03-09 3:49 ` [PATCH v3 03/15] Read CTF by the ctf target Yao Qi
2013-03-13 20:09 ` Tom Tromey
2013-03-14 13:23 ` Yao Qi
2013-03-14 14:59 ` Tom Tromey
2013-03-14 16:57 ` Doug Evans
2013-03-14 17:39 ` Doug Evans
2013-03-25 13:33 ` Yao Qi
2013-03-25 17:14 ` Doug Evans
2013-03-26 16:16 ` Yao Qi
2013-03-29 17:56 ` Doug Evans
2013-04-08 14:19 ` Yao Qi
2013-04-08 21:48 ` Doug Evans
2013-04-09 15:23 ` Yao Qi
2013-04-09 18:41 ` Doug Evans
2013-03-09 3:49 ` [PATCH v3 04/15] ctf doc and NEWS Yao Qi
2013-04-10 19:16 ` [PATCH v3 00/15] CTF Support Yao Qi
2013-04-11 22:59 ` [patch] Regenerate config.in [Re: [PATCH v3 00/15] CTF Support] Jan Kratochvil
2013-04-12 22:27 ` [commit] " Jan Kratochvil
2014-08-04 18:59 ` Incorrect placement of babeltrace gdb/NEWS item " Jan Kratochvil
2014-08-06 1:30 ` Yao Qi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1362800844-27940-14-git-send-email-yao@codesourcery.com \
--to=yao@codesourcery.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox