[PATCH] Collect return addresses at tracepoints
Doug Evans
dje@google.com
Sat Sep 24 09:19:00 GMT 2011
On Wed, Sep 21, 2011 at 2:45 PM, Stan Shebs <stanshebs@earthlink.net> wrote:
> This patch introduces a new tracepoint collection directive $_ret, which
> asks for the collection of the return address stored in the current stack
> frame. It's not the complete solution for what users really want, which is
> to collect several frames of the stack, but that's hard to get right without
> adding a fancy unwinder to the tracepoint agent. This is much simpler,
> needing only an architecture-specific method to generate appropriate
> bytecodes.
>
> Not too much controversial here - the testsuite exercises the code, but it
> won't fail the test if the caller's name doesn't appear in the backtrace,
> since we can't guarantee that the method's heuristic will always work.
>
> I'll commit this in a few days if there are no objections.
>
> Stan
> stan@codesourcery.com
>
> 2011-09-21 Stan Shebs <stan@codesourcery.com>
>
> 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.
Hi. Nit:
+ void
+ amd64_gen_return_address (struct gdbarch *gdbarch,
+ struct agent_expr *ax, struct axs_value *value,
+ CORE_ADDR scope)
+ void
+ i386_gen_return_address (struct gdbarch *gdbarch,
+ struct agent_expr *ax, struct axs_value *value,
+ CORE_ADDR scope)
These should be static.
More information about the Gdb-patches
mailing list