diff options
author | Marcin KoĆcielnicki <koriakin@0x04.net> | 2016-02-18 09:21:38 +0100 |
---|---|---|
committer | Marcin KoĆcielnicki <koriakin@0x04.net> | 2016-02-18 17:21:22 +0100 |
commit | 5f034a78b986d30a90030b2409c61a8660b9b48c (patch) | |
tree | 312e005927c2673b81ad675d0e46e8b6ac5a5cd2 /gdb/gdbarch.c | |
parent | c304e18e5ca825f57963bd0c5f022fa8f5797b29 (diff) | |
download | gdb-5f034a78b986d30a90030b2409c61a8660b9b48c.zip gdb-5f034a78b986d30a90030b2409c61a8660b9b48c.tar.gz gdb-5f034a78b986d30a90030b2409c61a8660b9b48c.tar.bz2 |
gdb: Add guess_tracepoint_registers hook to gdbarch.
When we're looking at a tracefile trace frame where registers are not
available, and the tracepoint has only one location, we supply
the location's address as the PC register. However, this only works
if PC is not a pseudo register, and individual architectures may want
to guess more registers. Add a gdbarch hook that will handle that.
gdb/ChangeLog:
* arch-utils.c (default_guess_tracepoint_registers): New function.
* arch-utils.h (default_guess_tracepoint_registers): New prototype.
* gdbarch.c: Regenerate.
* gdbarch.h: Regenerate.
* gdbarch.sh: Add guess_tracepoint_registers hook.
* tracefile.c (tracefile_fetch_registers): Use the new gdbarch hook.
Diffstat (limited to 'gdb/gdbarch.c')
-rw-r--r-- | gdb/gdbarch.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c index 4143744..0136c75 100644 --- a/gdb/gdbarch.c +++ b/gdb/gdbarch.c @@ -312,6 +312,7 @@ struct gdbarch int has_global_breakpoints; gdbarch_has_shared_address_space_ftype *has_shared_address_space; gdbarch_fast_tracepoint_valid_at_ftype *fast_tracepoint_valid_at; + gdbarch_guess_tracepoint_registers_ftype *guess_tracepoint_registers; gdbarch_auto_charset_ftype *auto_charset; gdbarch_auto_wide_charset_ftype *auto_wide_charset; const char * solib_symbols_extension; @@ -419,6 +420,7 @@ gdbarch_alloc (const struct gdbarch_info *info, gdbarch->relocate_instruction = NULL; gdbarch->has_shared_address_space = default_has_shared_address_space; gdbarch->fast_tracepoint_valid_at = default_fast_tracepoint_valid_at; + gdbarch->guess_tracepoint_registers = default_guess_tracepoint_registers; gdbarch->auto_charset = default_auto_charset; gdbarch->auto_wide_charset = default_auto_wide_charset; gdbarch->gen_return_address = default_gen_return_address; @@ -658,6 +660,7 @@ verify_gdbarch (struct gdbarch *gdbarch) /* Skip verify of has_global_breakpoints, invalid_p == 0 */ /* Skip verify of has_shared_address_space, invalid_p == 0 */ /* Skip verify of fast_tracepoint_valid_at, invalid_p == 0 */ + /* Skip verify of guess_tracepoint_registers, invalid_p == 0 */ /* 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 */ @@ -1024,6 +1027,9 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) "gdbarch_dump: gnu_triplet_regexp = <%s>\n", host_address_to_string (gdbarch->gnu_triplet_regexp)); fprintf_unfiltered (file, + "gdbarch_dump: guess_tracepoint_registers = <%s>\n", + host_address_to_string (gdbarch->guess_tracepoint_registers)); + fprintf_unfiltered (file, "gdbarch_dump: half_bit = %s\n", plongest (gdbarch->half_bit)); fprintf_unfiltered (file, @@ -4450,6 +4456,23 @@ set_gdbarch_fast_tracepoint_valid_at (struct gdbarch *gdbarch, gdbarch->fast_tracepoint_valid_at = fast_tracepoint_valid_at; } +void +gdbarch_guess_tracepoint_registers (struct gdbarch *gdbarch, struct regcache *regcache, CORE_ADDR addr) +{ + gdb_assert (gdbarch != NULL); + gdb_assert (gdbarch->guess_tracepoint_registers != NULL); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_guess_tracepoint_registers called\n"); + gdbarch->guess_tracepoint_registers (gdbarch, regcache, addr); +} + +void +set_gdbarch_guess_tracepoint_registers (struct gdbarch *gdbarch, + gdbarch_guess_tracepoint_registers_ftype guess_tracepoint_registers) +{ + gdbarch->guess_tracepoint_registers = guess_tracepoint_registers; +} + const char * gdbarch_auto_charset (struct gdbarch *gdbarch) { |