aboutsummaryrefslogtreecommitdiff
path: root/gdb/gdbarch.c
diff options
context:
space:
mode:
authorStan Shebs <shebs@codesourcery.com>2011-09-27 13:09:37 +0000
committerStan Shebs <shebs@codesourcery.com>2011-09-27 13:09:37 +0000
commit6710bf39b7c037de481a4b351fb69cec6b48b138 (patch)
tree49c698293333f96658a7f2859051a433cdf21d7f /gdb/gdbarch.c
parent21eb9156ec61765732abe5e2b8b0e717452bf7f1 (diff)
downloadgdb-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/gdbarch.c')
-rw-r--r--gdb/gdbarch.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c
index 600cce6..2b892b6 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)
@@ -947,6 +951,9 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *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));
fprintf_unfiltered (file,
@@ -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. */