diff options
author | Stan Shebs <shebs@codesourcery.com> | 2011-11-02 23:44:21 +0000 |
---|---|---|
committer | Stan Shebs <shebs@codesourcery.com> | 2011-11-02 23:44:21 +0000 |
commit | 3065dfb6b4e2e605b3601c5f71fa25de5dd4970e (patch) | |
tree | ac641720c021164a841a9c669e88e599134191e6 /gdb/testsuite | |
parent | 39f4f51d8bf1d516a5cca652a1d9efe8f3ef9863 (diff) | |
download | gdb-3065dfb6b4e2e605b3601c5f71fa25de5dd4970e.zip gdb-3065dfb6b4e2e605b3601c5f71fa25de5dd4970e.tar.gz gdb-3065dfb6b4e2e605b3601c5f71fa25de5dd4970e.tar.bz2 |
2011-11-02 Stan Shebs <stan@codesourcery.com>
String collection for tracepoints.
* NEWS: Mention string collection.
* common/ax.def (tracenz): New bytecode.
* ax-gdb.h (trace_string_kludge): Declare.
* ax-gdb.c: Include valprint.h and c-lang.h.
(trace_string_kludge): New global.
(gen_traced_pop): Add string case.
(agent_command): Add string case.
* tracepoint.h (decode_agent_options): Declare.
* tracepoint.c: Include cli-utils.h.
(decode_agent_options): New function.
(validate_actionline): Call it.
(encode_actions_1): Ditto.
* target.h (struct target_ops): New method to_supports_string_tracing.
(target_supports_string_tracing): New macro.
* target.c (update_current_target): Add to_supports_string_tracing.
* remote.c (struct remote_state): New field string_tracing.
(remote_string_tracing_feature): New function.
(remote_protocol_features): New feature tracenz.
(remote_supports_string_tracing): New function.
(init_remote_ops): Set to_supports_string_tracing.
* tracepoint.c (agent_mem_read_string): New function.
(eval_agent_expr): Call it for tracenz.
* server.c (handle_query): Report support for tracenz.
* gdb.texinfo (Tracepoint Action Lists): Document collect/s.
(General Query Packets): Describe tracenz feature.
* agentexpr.texi (Bytecode Descriptions): Describe tracenz.
* gdb.trace/collection.c: Add code using strings.
* gdb.trace/collection.exp: Add tests of string collection.
Diffstat (limited to 'gdb/testsuite')
-rw-r--r-- | gdb/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gdb/testsuite/gdb.trace/collection.c | 16 | ||||
-rw-r--r-- | gdb/testsuite/gdb.trace/collection.exp | 50 |
3 files changed, 71 insertions, 0 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index af1be7b..01c7705 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2011-11-02 Stan Shebs <stan@codesourcery.com> + + * gdb.trace/collection.c: Add code using strings. + * gdb.trace/collection.exp: Add tests of string collection. + 2011-11-02 Jan Kratochvil <jan.kratochvil@redhat.com> * gdb.base/skip-solib.exp (executable_main): New variable. diff --git a/gdb/testsuite/gdb.trace/collection.c b/gdb/testsuite/gdb.trace/collection.c index 6c66637..5901baf 100644 --- a/gdb/testsuite/gdb.trace/collection.c +++ b/gdb/testsuite/gdb.trace/collection.c @@ -201,6 +201,21 @@ int globals_test_func () return i; /* Set_Tracepoint_Here */ } +int strings_test_func () +{ + int i = 0; + char *locstr, *longloc; + + locstr = "abcdef"; + longloc = malloc(500); + strcpy(longloc, "how now brown cow spam spam spam wonderful wonderful spam"); + + i += strlen (locstr); + i += strlen (longloc); + + return i; /* Set_Tracepoint_Here */ +} + int main (argc, argv, envp) int argc; @@ -263,6 +278,7 @@ main (argc, argv, envp) i += reglocal_test_func (); i += statlocal_test_func (); i += globals_test_func (); + i += strings_test_func (); /* Values of globals at end of test should be different from values that they had when trace data was captured. */ diff --git a/gdb/testsuite/gdb.trace/collection.exp b/gdb/testsuite/gdb.trace/collection.exp index 6b73184..b1ed30a 100644 --- a/gdb/testsuite/gdb.trace/collection.exp +++ b/gdb/testsuite/gdb.trace/collection.exp @@ -619,6 +619,49 @@ proc gdb_collect_return_test { } { "collect \$_ret: cease trace debugging" } +proc gdb_collect_strings_test { func mystr myrslt mylim msg } { + global hex + global cr + global gdb_prompt + + prepare_for_trace_test + + # Find the comment-identified line for setting this tracepoint. + set testline 0 + gdb_test_multiple "list $func, +30" "collect $msg: find tracepoint line" { + -re "\[\r\n\](\[0-9\]+)\[^\r\n\]+ Set_Tracepoint_Here .*$gdb_prompt" { + set testline $expect_out(1,string) + pass "collect $msg: find tracepoint line" + } + -re ".*$gdb_prompt " { + fail "collect $msg: find tracepoint line (skipping strings test)" + return + } + timeout { + fail "collect $msg: find tracepoint line (skipping strings test)" + return + } + } + + gdb_test "trace $testline" \ + "Tracepoint \[0-9\]+ at .*" \ + "collect $msg: set tracepoint" + gdb_trace_setactions "collect $msg: define actions" \ + "" \ + "collect/s$mylim $mystr" "^$" + + # Begin the test. + run_trace_experiment $msg $func + + gdb_test "print $mystr" \ + "\\$\[0-9\]+ = $hex \"$myrslt\".*$cr" \ + "collect $msg: collected local string" + + gdb_test "tfind none" \ + "#0 end .*" \ + "collect $msg: cease trace debugging" +} + proc gdb_trace_collection_test {} { global fpreg global spreg @@ -728,6 +771,13 @@ proc gdb_trace_collection_test {} { "globalarr\[\(l6, l7\)\]" "7" "a\[\(b, c\)\]" gdb_collect_return_test + + gdb_collect_strings_test strings_test_func "locstr" "abcdef" "" \ + "local string" + + gdb_collect_strings_test strings_test_func "longloc" "how now brown c" 15 \ + "long local string" + } clean_restart $executable |