This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH 1/2] Test case: check traceframe_usage.
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