This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[RFC 2/2] Test entry values in trace frame
- From: Yao Qi <yao at codesourcery dot com>
- To: <gdb-patches at sourceware dot org>
- Date: Tue, 13 Aug 2013 15:39:46 +0800
- Subject: [RFC 2/2] Test entry values in trace frame
- References: <1376379586-24150-1-git-send-email-yao at codesourcery dot com>
Hi,
This is the test for "entry-values" when GDB is examining trace
frames. In test, tracepoint action collects arguments i and j and
global variable global1. Variable global2 is not collected.
The GNU_call_site_parameter is faked that i's entry value is from
global1, j's entry value is from global2. When GDB is examining trace
frame, value of i, j and i@entry should be available, but value of
j@entry is not.
However, when I run this test, I find j@entry is something like,
j@entry=<error reading variable: Cannot access memory at address 0x8049788>
instead of unavailable.
I don't emit a fail for it because I am not very sure it is expected
to be "unavailable". I am fine to kfail it.
I looked into a little, and looks reading entry value doesn't use
value availability-aware API. It is not an easy fix to me.
gdb/testsuite:
2013-08-13 Yao Qi <yao@codesourcery.com>
* gdb.trace/entry-values.c (end): New
(main): Call end.
* gdb.trace/entry-values.exp: Load trace-support.exp. Set
tracepoint and collect data. Test entry value is unavailable.
---
gdb/testsuite/gdb.trace/entry-values.c | 5 +++
gdb/testsuite/gdb.trace/entry-values.exp | 49 ++++++++++++++++++++++++++++++
2 files changed, 54 insertions(+), 0 deletions(-)
diff --git a/gdb/testsuite/gdb.trace/entry-values.c b/gdb/testsuite/gdb.trace/entry-values.c
index 3f98615..e287203 100644
--- a/gdb/testsuite/gdb.trace/entry-values.c
+++ b/gdb/testsuite/gdb.trace/entry-values.c
@@ -32,6 +32,10 @@ bar (int i)
int global1 = 1;
int global2 = 2;
+static void
+end (void)
+{}
+
int
main (void)
{
@@ -41,5 +45,6 @@ main (void)
global2++;
ret = bar (0);
+ end ();
return ret;
}
diff --git a/gdb/testsuite/gdb.trace/entry-values.exp b/gdb/testsuite/gdb.trace/entry-values.exp
index ba95e4f..bf946c3 100644
--- a/gdb/testsuite/gdb.trace/entry-values.exp
+++ b/gdb/testsuite/gdb.trace/entry-values.exp
@@ -221,3 +221,52 @@ gdb_test_sequence "bt" "bt" {
"\[\r\n\]#1 .* bar \\(i=<optimized out>, i@entry=<optimized out>\\)"
"\[\r\n\]#2 .* main \\(\\)"
}
+
+# Restart GDB and trace.
+
+clean_restart $binfile
+
+load_lib "trace-support.exp"
+
+if ![runto_main] {
+ fail "Can't run to main to check for trace support"
+ return -1
+}
+
+if ![gdb_target_supports_trace] {
+ unsupported "target does not support trace"
+ return -1
+}
+
+gdb_test "trace foo" "Tracepoint $decimal at .*"
+
+if [is_amd64_regs_target] {
+ set spreg "\$rsp"
+} elseif [is_x86_like_target] {
+ set spreg "\$esp"
+} else {
+ set spreg "\$sp"
+}
+
+# Collect arguments i and j. Collect 'global1' which is entry value
+# of argument i. Don't collect 'global2' to test the entry value of
+# argument j.
+
+gdb_trace_setactions "set action for tracepoint 1" "" \
+ "collect i, j, global1, \(\*\(void \*\*\) \($spreg\)\) @ 64" "^$"
+
+gdb_test_no_output "tstart"
+
+gdb_breakpoint "end"
+gdb_continue_to_breakpoint "end"
+
+gdb_test_no_output "tstop"
+
+gdb_test "tfind" "Found trace frame 0, .*" "tfind start"
+
+# Since 'global2' is not collected, j@entry is expected to be 'unavailable',
+# however, the current output is like:
+# j@entry=<error reading variable: Cannot access memory at address 0x8049788>
+gdb_test "bt 1" "#0 .* foo \\(i=\[-\]?$decimal, i@entry=2, j=\[-\]?$decimal, j@entry=.*\\).*"
+
+gdb_test "tfind" "Target failed to find requested trace frame\..*"
--
1.7.7.6