diff options
Diffstat (limited to 'gdb/gdbarch-gen.h')
-rw-r--r-- | gdb/gdbarch-gen.h | 64 |
1 files changed, 40 insertions, 24 deletions
diff --git a/gdb/gdbarch-gen.h b/gdb/gdbarch-gen.h index 313a8f1..7171c42 100644 --- a/gdb/gdbarch-gen.h +++ b/gdb/gdbarch-gen.h @@ -792,11 +792,11 @@ extern void set_gdbarch_memtag_granule_size (struct gdbarch *gdbarch, CORE_ADDR the condition is true, so that we ensure forward progress when stepping past a conditional branch to self. */ -extern bool gdbarch_software_single_step_p (struct gdbarch *gdbarch); +extern bool gdbarch_get_next_pcs_p (struct gdbarch *gdbarch); -typedef std::vector<CORE_ADDR> (gdbarch_software_single_step_ftype) (struct regcache *regcache); -extern std::vector<CORE_ADDR> gdbarch_software_single_step (struct gdbarch *gdbarch, struct regcache *regcache); -extern void set_gdbarch_software_single_step (struct gdbarch *gdbarch, gdbarch_software_single_step_ftype *software_single_step); +typedef std::vector<CORE_ADDR> (gdbarch_get_next_pcs_ftype) (struct regcache *regcache); +extern std::vector<CORE_ADDR> gdbarch_get_next_pcs (struct gdbarch *gdbarch, struct regcache *regcache); +extern void set_gdbarch_get_next_pcs (struct gdbarch *gdbarch, gdbarch_get_next_pcs_ftype *get_next_pcs); /* Return non-zero if the processor is executing a delay slot and a further single-step is needed before the instruction finishes. */ @@ -818,10 +818,11 @@ typedef CORE_ADDR (gdbarch_skip_trampoline_code_ftype) (const frame_info_ptr &fr extern CORE_ADDR gdbarch_skip_trampoline_code (struct gdbarch *gdbarch, const frame_info_ptr &frame, CORE_ADDR pc); extern void set_gdbarch_skip_trampoline_code (struct gdbarch *gdbarch, gdbarch_skip_trampoline_code_ftype *skip_trampoline_code); -/* Vtable of solib operations functions. */ +/* Return a newly-allocated solib_ops object capable of providing the solibs for this architecture. */ -extern const solib_ops * gdbarch_so_ops (struct gdbarch *gdbarch); -extern void set_gdbarch_so_ops (struct gdbarch *gdbarch, const solib_ops * so_ops); +typedef solib_ops_up (gdbarch_make_solib_ops_ftype) (program_space *pspace); +extern solib_ops_up gdbarch_make_solib_ops (struct gdbarch *gdbarch, program_space *pspace); +extern void set_gdbarch_make_solib_ops (struct gdbarch *gdbarch, gdbarch_make_solib_ops_ftype *make_solib_ops); /* If in_solib_dynsym_resolve_code() returns true, and SKIP_SOLIB_RESOLVER evaluates non-zero, this is the address where the debugger will place @@ -1147,7 +1148,7 @@ extern void set_gdbarch_displaced_step_copy_insn (struct gdbarch *gdbarch, gdbar the displaced instruction buffer). The default implementation returns false on all targets that provide a - gdbarch_software_single_step routine, and true otherwise. */ + gdbarch_get_next_pcs routine, and true otherwise. */ typedef bool (gdbarch_displaced_step_hw_singlestep_ftype) (struct gdbarch *gdbarch); extern bool gdbarch_displaced_step_hw_singlestep (struct gdbarch *gdbarch); @@ -1625,27 +1626,14 @@ extern void set_gdbarch_info_proc (struct gdbarch *gdbarch, gdbarch_info_proc_ft /* Implement the "info proc" command for core files. Note that there are two "info_proc"-like methods on gdbarch -- one for core files, - one for live targets. */ + one for live targets. CBFD is the core file being read from. */ extern bool gdbarch_core_info_proc_p (struct gdbarch *gdbarch); -typedef void (gdbarch_core_info_proc_ftype) (struct gdbarch *gdbarch, const char *args, enum info_proc_what what); -extern void gdbarch_core_info_proc (struct gdbarch *gdbarch, const char *args, enum info_proc_what what); +typedef void (gdbarch_core_info_proc_ftype) (struct gdbarch *gdbarch, struct bfd *cbfd, const char *args, enum info_proc_what what); +extern void gdbarch_core_info_proc (struct gdbarch *gdbarch, struct bfd *cbfd, const char *args, enum info_proc_what what); extern void set_gdbarch_core_info_proc (struct gdbarch *gdbarch, gdbarch_core_info_proc_ftype *core_info_proc); -/* Iterate over all objfiles in the order that makes the most sense - for the architecture to make global symbol searches. - - CB is a callback function passed an objfile to be searched. The iteration stops - if this function returns nonzero. - - If not NULL, CURRENT_OBJFILE corresponds to the objfile being - inspected when the symbol search was requested. */ - -typedef void (gdbarch_iterate_over_objfiles_in_search_order_ftype) (struct gdbarch *gdbarch, iterate_over_objfiles_in_search_order_cb_ftype cb, struct objfile *current_objfile); -extern void gdbarch_iterate_over_objfiles_in_search_order (struct gdbarch *gdbarch, iterate_over_objfiles_in_search_order_cb_ftype cb, struct objfile *current_objfile); -extern void set_gdbarch_iterate_over_objfiles_in_search_order (struct gdbarch *gdbarch, gdbarch_iterate_over_objfiles_in_search_order_ftype *iterate_over_objfiles_in_search_order); - /* Ravenscar arch-dependent ops. */ extern struct ravenscar_arch_ops * gdbarch_ravenscar_ops (struct gdbarch *gdbarch); @@ -1801,3 +1789,31 @@ extern void set_gdbarch_use_target_description_from_corefile_notes (struct gdbar typedef core_file_exec_context (gdbarch_core_parse_exec_context_ftype) (struct gdbarch *gdbarch, bfd *cbfd); extern core_file_exec_context gdbarch_core_parse_exec_context (struct gdbarch *gdbarch, bfd *cbfd); extern void set_gdbarch_core_parse_exec_context (struct gdbarch *gdbarch, gdbarch_core_parse_exec_context_ftype *core_parse_exec_context); + +/* Some targets support special hardware-assisted control-flow protection + technologies. For example, the Intel Control-Flow Enforcement Technology + (Intel CET) on x86 provides a shadow stack and indirect branch tracking. + To enable shadow stack support for inferior calls the shadow_stack_push + gdbarch hook has to be provided. The get_shadow_stack_pointer gdbarch + hook has to be provided to enable displaced stepping. + + Push NEW_ADDR to the shadow stack and update the shadow stack pointer. */ + +extern bool gdbarch_shadow_stack_push_p (struct gdbarch *gdbarch); + +typedef void (gdbarch_shadow_stack_push_ftype) (struct gdbarch *gdbarch, CORE_ADDR new_addr, regcache *regcache); +extern void gdbarch_shadow_stack_push (struct gdbarch *gdbarch, CORE_ADDR new_addr, regcache *regcache); +extern void set_gdbarch_shadow_stack_push (struct gdbarch *gdbarch, gdbarch_shadow_stack_push_ftype *shadow_stack_push); + +/* If possible, return the shadow stack pointer. If the shadow stack + feature is enabled then set SHADOW_STACK_ENABLED to true, otherwise + set SHADOW_STACK_ENABLED to false. This hook has to be provided to enable + displaced stepping for shadow stack enabled programs. + On some architectures, the shadow stack pointer is available even if the + feature is disabled. So dependent on the target, an implementation of + this function may return a valid shadow stack pointer, but set + SHADOW_STACK_ENABLED to false. */ + +typedef std::optional<CORE_ADDR> (gdbarch_get_shadow_stack_pointer_ftype) (struct gdbarch *gdbarch, regcache *regcache, bool &shadow_stack_enabled); +extern std::optional<CORE_ADDR> gdbarch_get_shadow_stack_pointer (struct gdbarch *gdbarch, regcache *regcache, bool &shadow_stack_enabled); +extern void set_gdbarch_get_shadow_stack_pointer (struct gdbarch *gdbarch, gdbarch_get_shadow_stack_pointer_ftype *get_shadow_stack_pointer); |