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/amd64-tdep.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/amd64-tdep.c')
-rw-r--r-- | gdb/amd64-tdep.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/gdb/amd64-tdep.c b/gdb/amd64-tdep.c index 55bedab..b85f255 100644 --- a/gdb/amd64-tdep.c +++ b/gdb/amd64-tdep.c @@ -45,6 +45,9 @@ #include "features/i386/amd64.c" #include "features/i386/amd64-avx.c" +#include "ax.h" +#include "ax-gdb.h" + /* Note that the AMD64 architecture was previously known as x86-64. The latter is (forever) engraved into the canonical system name as returned by config.guess, and used as the name for the AMD64 port @@ -2165,6 +2168,22 @@ static const struct frame_unwind amd64_frame_unwind = default_frame_sniffer }; +/* Generate a bytecode expression to get the value of the saved PC. */ + +static void +amd64_gen_return_address (struct gdbarch *gdbarch, + struct agent_expr *ax, struct axs_value *value, + CORE_ADDR scope) +{ + /* The following sequence assumes the traditional use of the base + register. */ + ax_reg (ax, AMD64_RBP_REGNUM); + ax_const_l (ax, 8); + ax_simple (ax, aop_add); + value->type = register_type (gdbarch, AMD64_RIP_REGNUM); + value->kind = axs_lvalue_memory; +} + /* Signal trampolines. */ @@ -2669,6 +2688,8 @@ amd64_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) set_gdbarch_get_longjmp_target (gdbarch, amd64_get_longjmp_target); set_gdbarch_relocate_instruction (gdbarch, amd64_relocate_instruction); + + set_gdbarch_gen_return_address (gdbarch, amd64_gen_return_address); } /* Provide a prototype to silence -Wmissing-prototypes. */ |