diff options
Diffstat (limited to 'gdb/gdbarch-gen.c')
-rw-r--r-- | gdb/gdbarch-gen.c | 134 |
1 files changed, 83 insertions, 51 deletions
diff --git a/gdb/gdbarch-gen.c b/gdb/gdbarch-gen.c index fc570d3..7887b13 100644 --- a/gdb/gdbarch-gen.c +++ b/gdb/gdbarch-gen.c @@ -153,7 +153,7 @@ struct gdbarch gdbarch_set_memtags_ftype *set_memtags = default_set_memtags; gdbarch_get_memtag_ftype *get_memtag = default_get_memtag; CORE_ADDR memtag_granule_size = 0; - gdbarch_software_single_step_ftype *software_single_step = nullptr; + gdbarch_get_next_pcs_ftype *get_next_pcs = nullptr; gdbarch_single_step_through_delay_ftype *single_step_through_delay = nullptr; gdbarch_print_insn_ftype *print_insn = default_print_insn; gdbarch_skip_trampoline_code_ftype *skip_trampoline_code = generic_skip_trampoline_code; @@ -240,7 +240,6 @@ struct gdbarch gdbarch_gen_return_address_ftype *gen_return_address = default_gen_return_address; gdbarch_info_proc_ftype *info_proc = nullptr; gdbarch_core_info_proc_ftype *core_info_proc = nullptr; - gdbarch_iterate_over_objfiles_in_search_order_ftype *iterate_over_objfiles_in_search_order = default_iterate_over_objfiles_in_search_order; struct ravenscar_arch_ops * ravenscar_ops = NULL; gdbarch_insn_is_call_ftype *insn_is_call = default_insn_is_call; gdbarch_insn_is_ret_ftype *insn_is_ret = default_insn_is_ret; @@ -262,6 +261,8 @@ struct gdbarch gdbarch_read_core_file_mappings_ftype *read_core_file_mappings = default_read_core_file_mappings; gdbarch_use_target_description_from_corefile_notes_ftype *use_target_description_from_corefile_notes = default_use_target_description_from_corefile_notes; gdbarch_core_parse_exec_context_ftype *core_parse_exec_context = default_core_parse_exec_context; + gdbarch_shadow_stack_push_ftype *shadow_stack_push = nullptr; + gdbarch_get_shadow_stack_pointer_ftype *get_shadow_stack_pointer = default_get_shadow_stack_pointer; }; /* Create a new ``struct gdbarch'' based on information provided by @@ -421,7 +422,7 @@ verify_gdbarch (struct gdbarch *gdbarch) /* Skip verify of set_memtags, invalid_p == 0. */ /* Skip verify of get_memtag, invalid_p == 0. */ /* Skip verify of memtag_granule_size, invalid_p == 0. */ - /* Skip verify of software_single_step, has predicate. */ + /* Skip verify of get_next_pcs, has predicate. */ /* Skip verify of single_step_through_delay, has predicate. */ /* Skip verify of print_insn, invalid_p == 0. */ /* Skip verify of skip_trampoline_code, invalid_p == 0. */ @@ -513,7 +514,6 @@ verify_gdbarch (struct gdbarch *gdbarch) /* Skip verify of gen_return_address, invalid_p == 0. */ /* Skip verify of info_proc, has predicate. */ /* Skip verify of core_info_proc, has predicate. */ - /* Skip verify of iterate_over_objfiles_in_search_order, invalid_p == 0. */ /* Skip verify of ravenscar_ops, invalid_p == 0. */ /* Skip verify of insn_is_call, invalid_p == 0. */ /* Skip verify of insn_is_ret, invalid_p == 0. */ @@ -535,6 +535,8 @@ verify_gdbarch (struct gdbarch *gdbarch) /* Skip verify of read_core_file_mappings, invalid_p == 0. */ /* Skip verify of use_target_description_from_corefile_notes, invalid_p == 0. */ /* Skip verify of core_parse_exec_context, invalid_p == 0. */ + /* Skip verify of shadow_stack_push, has predicate. */ + /* Skip verify of get_shadow_stack_pointer, invalid_p == 0. */ if (!log.empty ()) internal_error (_("verify_gdbarch: the following are invalid ...%s"), log.c_str ()); @@ -948,11 +950,11 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) "gdbarch_dump: memtag_granule_size = %s\n", core_addr_to_string_nz (gdbarch->memtag_granule_size)); gdb_printf (file, - "gdbarch_dump: gdbarch_software_single_step_p() = %d\n", - gdbarch_software_single_step_p (gdbarch)); + "gdbarch_dump: gdbarch_get_next_pcs_p() = %d\n", + gdbarch_get_next_pcs_p (gdbarch)); gdb_printf (file, - "gdbarch_dump: software_single_step = <%s>\n", - host_address_to_string (gdbarch->software_single_step)); + "gdbarch_dump: get_next_pcs = <%s>\n", + host_address_to_string (gdbarch->get_next_pcs)); gdb_printf (file, "gdbarch_dump: gdbarch_single_step_through_delay_p() = %d\n", gdbarch_single_step_through_delay_p (gdbarch)); @@ -1338,9 +1340,6 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) "gdbarch_dump: core_info_proc = <%s>\n", host_address_to_string (gdbarch->core_info_proc)); gdb_printf (file, - "gdbarch_dump: iterate_over_objfiles_in_search_order = <%s>\n", - host_address_to_string (gdbarch->iterate_over_objfiles_in_search_order)); - gdb_printf (file, "gdbarch_dump: ravenscar_ops = %s\n", host_address_to_string (gdbarch->ravenscar_ops)); gdb_printf (file, @@ -1406,6 +1405,15 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) gdb_printf (file, "gdbarch_dump: core_parse_exec_context = <%s>\n", host_address_to_string (gdbarch->core_parse_exec_context)); + gdb_printf (file, + "gdbarch_dump: gdbarch_shadow_stack_push_p() = %d\n", + gdbarch_shadow_stack_push_p (gdbarch)); + gdb_printf (file, + "gdbarch_dump: shadow_stack_push = <%s>\n", + host_address_to_string (gdbarch->shadow_stack_push)); + gdb_printf (file, + "gdbarch_dump: get_shadow_stack_pointer = <%s>\n", + host_address_to_string (gdbarch->get_shadow_stack_pointer)); if (gdbarch->dump_tdep != NULL) gdbarch->dump_tdep (gdbarch, file); } @@ -3388,27 +3396,27 @@ set_gdbarch_memtag_granule_size (struct gdbarch *gdbarch, } bool -gdbarch_software_single_step_p (struct gdbarch *gdbarch) +gdbarch_get_next_pcs_p (struct gdbarch *gdbarch) { gdb_assert (gdbarch != NULL); - return gdbarch->software_single_step != NULL; + return gdbarch->get_next_pcs != NULL; } std::vector<CORE_ADDR> -gdbarch_software_single_step (struct gdbarch *gdbarch, struct regcache *regcache) +gdbarch_get_next_pcs (struct gdbarch *gdbarch, struct regcache *regcache) { gdb_assert (gdbarch != NULL); - gdb_assert (gdbarch->software_single_step != NULL); + gdb_assert (gdbarch->get_next_pcs != NULL); if (gdbarch_debug >= 2) - gdb_printf (gdb_stdlog, "gdbarch_software_single_step called\n"); - return gdbarch->software_single_step (regcache); + gdb_printf (gdb_stdlog, "gdbarch_get_next_pcs called\n"); + return gdbarch->get_next_pcs (regcache); } void -set_gdbarch_software_single_step (struct gdbarch *gdbarch, - gdbarch_software_single_step_ftype software_single_step) +set_gdbarch_get_next_pcs (struct gdbarch *gdbarch, + gdbarch_get_next_pcs_ftype get_next_pcs) { - gdbarch->software_single_step = software_single_step; + gdbarch->get_next_pcs = get_next_pcs; } bool @@ -3470,13 +3478,13 @@ set_gdbarch_skip_trampoline_code (struct gdbarch *gdbarch, } solib_ops_up -gdbarch_make_solib_ops (struct gdbarch *gdbarch) +gdbarch_make_solib_ops (struct gdbarch *gdbarch, program_space *pspace) { gdb_assert (gdbarch != NULL); gdb_assert (gdbarch->make_solib_ops != NULL); if (gdbarch_debug >= 2) gdb_printf (gdb_stdlog, "gdbarch_make_solib_ops called\n"); - return gdbarch->make_solib_ops (); + return gdbarch->make_solib_ops (pspace); } void @@ -3962,13 +3970,13 @@ gdbarch_core_xfer_shared_libraries_p (struct gdbarch *gdbarch) } ULONGEST -gdbarch_core_xfer_shared_libraries (struct gdbarch *gdbarch, gdb_byte *readbuf, ULONGEST offset, ULONGEST len) +gdbarch_core_xfer_shared_libraries (struct gdbarch *gdbarch, struct bfd &cbfd, gdb_byte *readbuf, ULONGEST offset, ULONGEST len) { gdb_assert (gdbarch != NULL); gdb_assert (gdbarch->core_xfer_shared_libraries != NULL); if (gdbarch_debug >= 2) gdb_printf (gdb_stdlog, "gdbarch_core_xfer_shared_libraries called\n"); - return gdbarch->core_xfer_shared_libraries (gdbarch, readbuf, offset, len); + return gdbarch->core_xfer_shared_libraries (gdbarch, cbfd, readbuf, offset, len); } void @@ -3986,13 +3994,13 @@ gdbarch_core_xfer_shared_libraries_aix_p (struct gdbarch *gdbarch) } ULONGEST -gdbarch_core_xfer_shared_libraries_aix (struct gdbarch *gdbarch, gdb_byte *readbuf, ULONGEST offset, ULONGEST len) +gdbarch_core_xfer_shared_libraries_aix (struct gdbarch *gdbarch, struct bfd &cbfd, gdb_byte *readbuf, ULONGEST offset, ULONGEST len) { gdb_assert (gdbarch != NULL); gdb_assert (gdbarch->core_xfer_shared_libraries_aix != NULL); if (gdbarch_debug >= 2) gdb_printf (gdb_stdlog, "gdbarch_core_xfer_shared_libraries_aix called\n"); - return gdbarch->core_xfer_shared_libraries_aix (gdbarch, readbuf, offset, len); + return gdbarch->core_xfer_shared_libraries_aix (gdbarch, cbfd, readbuf, offset, len); } void @@ -4034,13 +4042,13 @@ gdbarch_core_thread_name_p (struct gdbarch *gdbarch) } const char * -gdbarch_core_thread_name (struct gdbarch *gdbarch, struct thread_info *thr) +gdbarch_core_thread_name (struct gdbarch *gdbarch, struct bfd &cbfd, struct thread_info *thr) { gdb_assert (gdbarch != NULL); gdb_assert (gdbarch->core_thread_name != NULL); if (gdbarch_debug >= 2) gdb_printf (gdb_stdlog, "gdbarch_core_thread_name called\n"); - return gdbarch->core_thread_name (gdbarch, thr); + return gdbarch->core_thread_name (gdbarch, cbfd, thr); } void @@ -4058,13 +4066,13 @@ gdbarch_core_xfer_siginfo_p (struct gdbarch *gdbarch) } LONGEST -gdbarch_core_xfer_siginfo (struct gdbarch *gdbarch, gdb_byte *readbuf, ULONGEST offset, ULONGEST len) +gdbarch_core_xfer_siginfo (struct gdbarch *gdbarch, struct bfd &cbfd, gdb_byte *readbuf, ULONGEST offset, ULONGEST len) { gdb_assert (gdbarch != NULL); gdb_assert (gdbarch->core_xfer_siginfo != NULL); if (gdbarch_debug >= 2) gdb_printf (gdb_stdlog, "gdbarch_core_xfer_siginfo called\n"); - return gdbarch->core_xfer_siginfo (gdbarch, readbuf, offset, len); + return gdbarch->core_xfer_siginfo (gdbarch, cbfd, readbuf, offset, len); } void @@ -4082,13 +4090,13 @@ gdbarch_core_read_x86_xsave_layout_p (struct gdbarch *gdbarch) } bool -gdbarch_core_read_x86_xsave_layout (struct gdbarch *gdbarch, x86_xsave_layout &xsave_layout) +gdbarch_core_read_x86_xsave_layout (struct gdbarch *gdbarch, struct bfd &cbfd, x86_xsave_layout &xsave_layout) { gdb_assert (gdbarch != NULL); gdb_assert (gdbarch->core_read_x86_xsave_layout != NULL); if (gdbarch_debug >= 2) gdb_printf (gdb_stdlog, "gdbarch_core_read_x86_xsave_layout called\n"); - return gdbarch->core_read_x86_xsave_layout (gdbarch, xsave_layout); + return gdbarch->core_read_x86_xsave_layout (gdbarch, cbfd, xsave_layout); } void @@ -5155,13 +5163,13 @@ gdbarch_core_info_proc_p (struct gdbarch *gdbarch) } void -gdbarch_core_info_proc (struct gdbarch *gdbarch, const char *args, enum info_proc_what what) +gdbarch_core_info_proc (struct gdbarch *gdbarch, struct bfd *cbfd, const char *args, enum info_proc_what what) { gdb_assert (gdbarch != NULL); gdb_assert (gdbarch->core_info_proc != NULL); if (gdbarch_debug >= 2) gdb_printf (gdb_stdlog, "gdbarch_core_info_proc called\n"); - gdbarch->core_info_proc (gdbarch, args, what); + gdbarch->core_info_proc (gdbarch, cbfd, args, what); } void @@ -5171,23 +5179,6 @@ set_gdbarch_core_info_proc (struct gdbarch *gdbarch, gdbarch->core_info_proc = core_info_proc; } -void -gdbarch_iterate_over_objfiles_in_search_order (struct gdbarch *gdbarch, iterate_over_objfiles_in_search_order_cb_ftype cb, struct objfile *current_objfile) -{ - gdb_assert (gdbarch != NULL); - gdb_assert (gdbarch->iterate_over_objfiles_in_search_order != NULL); - if (gdbarch_debug >= 2) - gdb_printf (gdb_stdlog, "gdbarch_iterate_over_objfiles_in_search_order called\n"); - gdbarch->iterate_over_objfiles_in_search_order (gdbarch, cb, current_objfile); -} - -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) -{ - gdbarch->iterate_over_objfiles_in_search_order = iterate_over_objfiles_in_search_order; -} - struct ravenscar_arch_ops * gdbarch_ravenscar_ops (struct gdbarch *gdbarch) { @@ -5551,3 +5542,44 @@ set_gdbarch_core_parse_exec_context (struct gdbarch *gdbarch, { gdbarch->core_parse_exec_context = core_parse_exec_context; } + +bool +gdbarch_shadow_stack_push_p (struct gdbarch *gdbarch) +{ + gdb_assert (gdbarch != NULL); + return gdbarch->shadow_stack_push != NULL; +} + +void +gdbarch_shadow_stack_push (struct gdbarch *gdbarch, CORE_ADDR new_addr, regcache *regcache) +{ + gdb_assert (gdbarch != NULL); + gdb_assert (gdbarch->shadow_stack_push != NULL); + if (gdbarch_debug >= 2) + gdb_printf (gdb_stdlog, "gdbarch_shadow_stack_push called\n"); + gdbarch->shadow_stack_push (gdbarch, new_addr, regcache); +} + +void +set_gdbarch_shadow_stack_push (struct gdbarch *gdbarch, + gdbarch_shadow_stack_push_ftype shadow_stack_push) +{ + gdbarch->shadow_stack_push = shadow_stack_push; +} + +std::optional<CORE_ADDR> +gdbarch_get_shadow_stack_pointer (struct gdbarch *gdbarch, regcache *regcache, bool &shadow_stack_enabled) +{ + gdb_assert (gdbarch != NULL); + gdb_assert (gdbarch->get_shadow_stack_pointer != NULL); + if (gdbarch_debug >= 2) + gdb_printf (gdb_stdlog, "gdbarch_get_shadow_stack_pointer called\n"); + return gdbarch->get_shadow_stack_pointer (gdbarch, regcache, shadow_stack_enabled); +} + +void +set_gdbarch_get_shadow_stack_pointer (struct gdbarch *gdbarch, + gdbarch_get_shadow_stack_pointer_ftype get_shadow_stack_pointer) +{ + gdbarch->get_shadow_stack_pointer = get_shadow_stack_pointer; +} |