From: Yao Qi <yao@codesourcery.com>
To: <gdb-patches@sourceware.org>
Subject: [PATCH 1/2] Test case: check traceframe_usage.
Date: Wed, 12 Dec 2012 01:38:00 -0000 [thread overview]
Message-ID: <1355276266-23163-2-git-send-email-yao@codesourcery.com> (raw)
In-Reply-To: <1355276266-23163-1-git-send-email-yao@codesourcery.com>
Hi,
This patch adds a test to check the output of 'info tracepoint' for
traceframe_usage per tracepoint. Note that user has to type 'tstatus'
command first to get the latest tracepoint status in GDB side.
gdb/testsuite:
2012-12-11 Yao Qi <yao@codesourcery.com>
* gdb.trace/infotrace.exp: Check 'traceframe usage' in the
output of 'info tracepoints'.
* gdb.trace/disconnected-tracing.exp (disconnected_tracing):
Likewise.
* gdb.trace/disconnected-tracing.c (struct foo): New.
---
gdb/testsuite/gdb.trace/disconnected-tracing.c | 8 ++++++
gdb/testsuite/gdb.trace/disconnected-tracing.exp | 29 ++++++++++++++++++----
gdb/testsuite/gdb.trace/infotrace.exp | 27 ++++++++++++++++++++
3 files changed, 59 insertions(+), 5 deletions(-)
diff --git a/gdb/testsuite/gdb.trace/disconnected-tracing.c b/gdb/testsuite/gdb.trace/disconnected-tracing.c
index d4f54b2..13badec 100644
--- a/gdb/testsuite/gdb.trace/disconnected-tracing.c
+++ b/gdb/testsuite/gdb.trace/disconnected-tracing.c
@@ -19,6 +19,14 @@ void
end (void)
{}
+struct foo
+{
+ int bar1;
+ long bar2;
+};
+
+struct foo foo;
+
void
start (void)
{}
diff --git a/gdb/testsuite/gdb.trace/disconnected-tracing.exp b/gdb/testsuite/gdb.trace/disconnected-tracing.exp
index ed6bfd4..6640b50 100644
--- a/gdb/testsuite/gdb.trace/disconnected-tracing.exp
+++ b/gdb/testsuite/gdb.trace/disconnected-tracing.exp
@@ -47,6 +47,8 @@ if ![gdb_target_supports_trace] {
proc disconnected_tracing { } { with_test_prefix "trace" {
global executable
+ global decimal
+ global srcfile
# Start with a fresh gdb.
clean_restart ${executable}
@@ -57,10 +59,18 @@ proc disconnected_tracing { } { with_test_prefix "trace" {
gdb_test_no_output "set confirm off"
gdb_test_no_output "set disconnected-tracing on"
- gdb_test "trace main" ".*"
+ gdb_test "trace start" ".*"
+ gdb_trace_setactions "collect on tracepoint 2" "2" \
+ "collect foo" "^$"
+ gdb_test "break end" "Breakpoint ${decimal} at .*"
+
gdb_test_no_output "tstart"
- gdb_test "info tracepoints" ".*in main at.*" "first info tracepoints"
+ gdb_test "continue" "Continuing\\.\[ \r\n\]+Breakpoint.*"
+ gdb_test_no_output "tstop"
+
+ gdb_test "info tracepoints" ".*in start at.*" \
+ "first info tracepoints"
gdb_test "disconnect" "Ending remote debugging\\." "first disconnect"
if { [gdb_reconnect] == 0 } {
@@ -69,10 +79,12 @@ proc disconnected_tracing { } { with_test_prefix "trace" {
fail "first reconnect after unload"
return 0
}
- gdb_test "info tracepoints" ".*in main at.*" "second info tracepoints"
+ gdb_test "info tracepoints" ".*in start at.*" \
+ "second info tracepoints"
delete_breakpoints
- gdb_test "info tracepoints" ".*No tracepoints..*" "third info tracepoints"
+ gdb_test "info tracepoints" ".*No tracepoints..*" \
+ "third info tracepoints"
gdb_test "disconnect" "Ending remote debugging\\." "second disconnect"
if { [gdb_reconnect] == 0 } {
@@ -81,7 +93,14 @@ proc disconnected_tracing { } { with_test_prefix "trace" {
fail "second reconnect after unload"
return 0
}
- gdb_test "info tracepoints" ".*in main at.*" "fourth info tracepoints"
+ gdb_test "tstatus"
+ gdb_test "info tracepoints" \
+ "Num Type\[ \]+Disp Enb Address\[ \]+What.*
+\[0-9\]+\[\t \]+tracepoint keep y.* in start at .*$srcfile:\[0-9\]+.
+\[\t \]+tracepoint already hit 1 time.
+\[\t \]+trace buffer usage ${decimal} bytes.
+\[\t \]+collect foo.*" \
+ "fourth info tracepoints"
}}
disconnected_tracing
diff --git a/gdb/testsuite/gdb.trace/infotrace.exp b/gdb/testsuite/gdb.trace/infotrace.exp
index bdc3830..5cfa1e8 100644
--- a/gdb/testsuite/gdb.trace/infotrace.exp
+++ b/gdb/testsuite/gdb.trace/infotrace.exp
@@ -85,3 +85,30 @@ gdb_test "help info tracepoints" \
"Status of specified tracepoints .all tracepoints if no argument.*" \
"2.5: help info tracepoints"
+# 2.6 info tracepoints (check trace buffer usage). We need a live
+# tracing.
+gdb_breakpoint "main"
+gdb_trace_setactions "collect on tracepoint 1" "1" \
+ "collect gdb_struct1_test" "^$"
+gdb_run_cmd
+gdb_test "" "Breakpoint ${decimal}, main.*"
+
+if { ![gdb_target_supports_trace] } then {
+ unsupported "Current target does not support trace"
+ return 1;
+}
+
+gdb_test "break end" "Breakpoint \[0-9\] at .*"
+gdb_test_no_output "tstart"
+gdb_test "continue" "Continuing\\.\[ \r\n\]+Breakpoint.*" \
+ "continue to end"
+gdb_test_no_output "tstop"
+gdb_test "tstatus"
+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 \]+tracepoint already hit 1 time.
+\[\t \]+trace buffer usage ${decimal} bytes.
+\[\t \]+collect gdb_struct1_test.
+\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_asm_test at .*$srcfile:\[0-9\]+." \
+ "2.6: info tracepoints (trace buffer usage)"
--
1.7.7.6
next prev parent reply other threads:[~2012-12-12 1:38 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-12-12 1:37 [RFC 0/2 gdbserver] Compute 'traceframe usage' per tracepoint Yao Qi
2012-12-12 1:38 ` Yao Qi [this message]
2012-12-12 1:38 ` [PATCH 2/2] Compute traceframe usuage per tracepoint on demand Yao Qi
2012-12-17 9:21 ` Yao Qi
2013-01-07 15:39 ` Pedro Alves
2013-01-07 15:56 ` Pedro Alves
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=1355276266-23163-2-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