From 6710bf39b7c037de481a4b351fb69cec6b48b138 Mon Sep 17 00:00:00 2001 From: Stan Shebs Date: Tue, 27 Sep 2011 13:09:37 +0000 Subject: 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. --- gdb/gdbarch.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'gdb/gdbarch.c') diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c index 600cce61a3e..2b892b65e4f 100644 --- a/gdb/gdbarch.c +++ b/gdb/gdbarch.c @@ -270,6 +270,7 @@ struct gdbarch gdbarch_auto_wide_charset_ftype *auto_wide_charset; const char * solib_symbols_extension; int has_dos_based_file_system; + gdbarch_gen_return_address_ftype *gen_return_address; }; @@ -423,6 +424,7 @@ struct gdbarch startup_gdbarch = default_auto_wide_charset, /* auto_wide_charset */ 0, /* solib_symbols_extension */ 0, /* has_dos_based_file_system */ + default_gen_return_address, /* gen_return_address */ /* startup_gdbarch() */ }; @@ -513,6 +515,7 @@ gdbarch_alloc (const struct gdbarch_info *info, gdbarch->fast_tracepoint_valid_at = default_fast_tracepoint_valid_at; gdbarch->auto_charset = default_auto_charset; gdbarch->auto_wide_charset = default_auto_wide_charset; + gdbarch->gen_return_address = default_gen_return_address; /* gdbarch_alloc() */ return gdbarch; @@ -707,6 +710,7 @@ verify_gdbarch (struct gdbarch *gdbarch) /* Skip verify of auto_charset, invalid_p == 0 */ /* Skip verify of auto_wide_charset, invalid_p == 0 */ /* Skip verify of has_dos_based_file_system, invalid_p == 0 */ + /* Skip verify of gen_return_address, invalid_p == 0 */ buf = ui_file_xstrdup (log, &length); make_cleanup (xfree, buf); if (length > 0) @@ -946,6 +950,9 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) fprintf_unfiltered (file, "gdbarch_dump: gcore_bfd_target = %s\n", gdbarch->gcore_bfd_target); + fprintf_unfiltered (file, + "gdbarch_dump: gen_return_address = <%s>\n", + host_address_to_string (gdbarch->gen_return_address)); fprintf_unfiltered (file, "gdbarch_dump: gdbarch_get_longjmp_target_p() = %d\n", gdbarch_get_longjmp_target_p (gdbarch)); @@ -3863,6 +3870,23 @@ set_gdbarch_has_dos_based_file_system (struct gdbarch *gdbarch, gdbarch->has_dos_based_file_system = has_dos_based_file_system; } +void +gdbarch_gen_return_address (struct gdbarch *gdbarch, struct agent_expr *ax, struct axs_value *value, CORE_ADDR scope) +{ + gdb_assert (gdbarch != NULL); + gdb_assert (gdbarch->gen_return_address != NULL); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_gen_return_address called\n"); + gdbarch->gen_return_address (gdbarch, ax, value, scope); +} + +void +set_gdbarch_gen_return_address (struct gdbarch *gdbarch, + gdbarch_gen_return_address_ftype gen_return_address) +{ + gdbarch->gen_return_address = gen_return_address; +} + /* Keep a registry of per-architecture data-pointers required by GDB modules. */ -- cgit v1.2.3-65-gdbad