diff options
author | Stan Shebs <shebs@codesourcery.com> | 2011-09-27 13:09:37 +0000 |
---|---|---|
committer | Stan Shebs <shebs@codesourcery.com> | 2011-09-27 13:09:37 +0000 |
commit | 6710bf39b7c037de481a4b351fb69cec6b48b138 (patch) | |
tree | 49c698293333f96658a7f2859051a433cdf21d7f /gdb/tracepoint.c | |
parent | 21eb9156ec61765732abe5e2b8b0e717452bf7f1 (diff) | |
download | gdb-6710bf39b7c037de481a4b351fb69cec6b48b138.zip gdb-6710bf39b7c037de481a4b351fb69cec6b48b138.tar.gz gdb-6710bf39b7c037de481a4b351fb69cec6b48b138.tar.bz2 |
Add return address collection for tracepoints.
* tracepoint.c (encode_actions_1): Add case for $_ret.
(validate_actionline): Check for $_ret.
(trace_dump_actions): Ditto.
* ax-gdb.h (gen_trace_for_return_address): Declare.
* ax-gdb.c: Include arch-utils.h.
(gen_trace_for_return_address): New function.
(agent_command): Add return address special case.
* amd64-tdep.c: Include ax.h and ax-gdb.h.
(amd64_gen_return_address): New function.
(amd64_init_abi): Call it.
* i386-tdep.c: Include ax.h and ax-gdb.h.
(i386_gen_return_address): New function.
(i386_init_abi): Call it.
* arch-utils.h (default_gen_return_address): Declare.
* arch-utils.c (default_gen_return_address): New function.
* gdbarch.sh (gen_return_address): New method.
* gdbarch.h, gdbarch.c: Regenerate.
* gdb.texinfo (Tracepoint Action Lists): Document $_ret.
* gdb.trace/collection.exp: Test collection of $_ret.
Diffstat (limited to 'gdb/tracepoint.c')
-rw-r--r-- | gdb/tracepoint.c | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c index fc9a17a..d5c9a6d 100644 --- a/gdb/tracepoint.c +++ b/gdb/tracepoint.c @@ -667,6 +667,7 @@ validate_actionline (char **line, struct breakpoint *b) if (0 == strncasecmp ("reg", p + 1, 3) || 0 == strncasecmp ("arg", p + 1, 3) || 0 == strncasecmp ("loc", p + 1, 3) + || 0 == strncasecmp ("_ret", p + 1, 4) || 0 == strncasecmp ("_sdata", p + 1, 6)) { p = strchr (p, ','); @@ -1344,6 +1345,43 @@ encode_actions_1 (struct command_line *action, 'L'); action_exp = strchr (action_exp, ','); /* more? */ } + else if (0 == strncasecmp ("$_ret", action_exp, 5)) + { + struct cleanup *old_chain1 = NULL; + + aexpr = gen_trace_for_return_address (tloc->address, + t->gdbarch); + + old_chain1 = make_cleanup_free_agent_expr (aexpr); + + ax_reqs (aexpr); + report_agent_reqs_errors (aexpr); + + discard_cleanups (old_chain1); + add_aexpr (collect, aexpr); + + /* take care of the registers */ + if (aexpr->reg_mask_len > 0) + { + int ndx1, ndx2; + + for (ndx1 = 0; ndx1 < aexpr->reg_mask_len; ndx1++) + { + QUIT; /* allow user to bail out with ^C */ + if (aexpr->reg_mask[ndx1] != 0) + { + /* assume chars have 8 bits */ + for (ndx2 = 0; ndx2 < 8; ndx2++) + if (aexpr->reg_mask[ndx1] & (1 << ndx2)) + /* it's used -- record it */ + add_register (collect, + ndx1 * 8 + ndx2); + } + } + } + + action_exp = strchr (action_exp, ','); /* more? */ + } else if (0 == strncasecmp ("$_sdata", action_exp, 7)) { add_static_trace_data (collect); @@ -2555,6 +2593,8 @@ trace_dump_actions (struct command_line *action, if (0 == strncasecmp (action_exp, "$reg", 4)) registers_info (NULL, from_tty); + else if (0 == strncasecmp (action_exp, "$_ret", 5)) + ; else if (0 == strncasecmp (action_exp, "$loc", 4)) locals_info (NULL, from_tty); else if (0 == strncasecmp (action_exp, "$arg", 4)) |