aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorYao Qi <yao@codesourcery.com>2013-08-24 01:54:59 +0000
committerYao Qi <yao@codesourcery.com>2013-08-24 01:54:59 +0000
commitb122423813ed1cf2255243e21bd0a6229fcadef6 (patch)
tree26b69b8be11cd7e1c12adc061e595892c9f4a80b /gdb
parentb39a8faf7cc4901252a59b531074a092a80d2354 (diff)
downloadgdb-b122423813ed1cf2255243e21bd0a6229fcadef6.zip
gdb-b122423813ed1cf2255243e21bd0a6229fcadef6.tar.gz
gdb-b122423813ed1cf2255243e21bd0a6229fcadef6.tar.bz2
gdb/testsuite/
* 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.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/testsuite/ChangeLog7
-rw-r--r--gdb/testsuite/gdb.trace/entry-values.c5
-rw-r--r--gdb/testsuite/gdb.trace/entry-values.exp47
3 files changed, 59 insertions, 0 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 49d4b38..f1b114d 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,5 +1,12 @@
2013-08-24 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.
+
+2013-08-24 Yao Qi <yao@codesourcery.com>
+
* lib/dwarf.exp (_location): Handle DW_OP_deref_size.
* gdb.trace/entry-values.c: New.
* gdb.trace/entry-values.exp: New.
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 0fb060a..bb62e5d 100644
--- a/gdb/testsuite/gdb.trace/entry-values.exp
+++ b/gdb/testsuite/gdb.trace/entry-values.exp
@@ -230,3 +230,50 @@ gdb_test_sequence "bt" "bt (2)" {
"\[\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'.
+gdb_test "bt 1" "#0 .* foo \\(i=\[-\]?$decimal, i@entry=2, j=\[-\]?$decimal, j@entry=<unavailable>\\).*"
+
+gdb_test "tfind" "Target failed to find requested trace frame\..*"