mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-03 05:12:28 +08:00
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.
This commit is contained in:
@ -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 */
|
||||
@ -1023,6 +1026,9 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
|
||||
fprintf_unfiltered (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));
|
||||
@ -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)
|
||||
{
|
||||
|
Reference in New Issue
Block a user