X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=gdb%2Fgdbarch.c;h=597e10735cb83ef14ba398f2be431dae46ea04dd;hb=refs%2Fheads%2Fconcurrent-displaced-stepping-2020-04-01;hp=cc8569f5c95954593e6804c78e8fa6e9a024f8f7;hpb=6c2659886f7018fcca26ee0fc813bc9748fb8513;p=deliverable%2Fbinutils-gdb.git diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c index cc8569f5c9..597e10735c 100644 --- a/gdb/gdbarch.c +++ b/gdb/gdbarch.c @@ -20,17 +20,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ -/* This file was created with the aid of ``gdbarch.sh''. - - The Bourne shell script ``gdbarch.sh'' creates the files - ``new-gdbarch.c'' and ``new-gdbarch.h and then compares them - against the existing ``gdbarch.[hc]''. Any differences found - being reported. - - If editing this file, please also run gdbarch.sh and merge any - changes into that script. Conversely, when making sweeping changes - to this file, modifying gdbarch.sh and using its output may prove - easier. */ +/* This file was created with the aid of ``gdbarch.sh''. */ #include "defs.h" @@ -298,7 +288,8 @@ struct gdbarch gdbarch_displaced_step_copy_insn_ftype *displaced_step_copy_insn; gdbarch_displaced_step_hw_singlestep_ftype *displaced_step_hw_singlestep; gdbarch_displaced_step_fixup_ftype *displaced_step_fixup; - gdbarch_displaced_step_location_ftype *displaced_step_location; + gdbarch_displaced_step_prepare_ftype *displaced_step_prepare; + gdbarch_displaced_step_finish_ftype *displaced_step_finish; gdbarch_relocate_instruction_ftype *relocate_instruction; gdbarch_overlay_update_ftype *overlay_update; gdbarch_core_read_description_ftype *core_read_description; @@ -345,6 +336,7 @@ struct gdbarch gdbarch_insn_is_call_ftype *insn_is_call; gdbarch_insn_is_ret_ftype *insn_is_ret; gdbarch_insn_is_jump_ftype *insn_is_jump; + gdbarch_program_breakpoint_here_p_ftype *program_breakpoint_here_p; gdbarch_auxv_parse_ftype *auxv_parse; gdbarch_print_auxv_entry_ftype *print_auxv_entry; gdbarch_vsyscall_range_ftype *vsyscall_range; @@ -451,7 +443,7 @@ gdbarch_alloc (const struct gdbarch_info *info, gdbarch->skip_permanent_breakpoint = default_skip_permanent_breakpoint; gdbarch->displaced_step_hw_singlestep = default_displaced_step_hw_singlestep; gdbarch->displaced_step_fixup = NULL; - gdbarch->displaced_step_location = NULL; + gdbarch->displaced_step_finish = NULL; gdbarch->relocate_instruction = NULL; gdbarch->has_shared_address_space = default_has_shared_address_space; gdbarch->fast_tracepoint_valid_at = default_fast_tracepoint_valid_at; @@ -464,6 +456,7 @@ gdbarch_alloc (const struct gdbarch_info *info, gdbarch->insn_is_call = default_insn_is_call; gdbarch->insn_is_ret = default_insn_is_ret; gdbarch->insn_is_jump = default_insn_is_jump; + gdbarch->program_breakpoint_here_p = default_program_breakpoint_here_p; gdbarch->print_auxv_entry = default_print_auxv_entry; gdbarch->vsyscall_range = default_vsyscall_range; gdbarch->infcall_mmap = default_infcall_mmap; @@ -661,8 +654,9 @@ verify_gdbarch (struct gdbarch *gdbarch) /* Skip verify of displaced_step_copy_insn, has predicate. */ /* Skip verify of displaced_step_hw_singlestep, invalid_p == 0 */ /* Skip verify of displaced_step_fixup, has predicate. */ - if ((! gdbarch->displaced_step_location) != (! gdbarch->displaced_step_copy_insn)) - log.puts ("\n\tdisplaced_step_location"); + /* Skip verify of displaced_step_prepare, has predicate. */ + if ((! gdbarch->displaced_step_finish) != (! gdbarch->displaced_step_prepare)) + log.puts ("\n\tdisplaced_step_finish"); /* Skip verify of relocate_instruction, has predicate. */ /* Skip verify of overlay_update, has predicate. */ /* Skip verify of core_read_description, has predicate. */ @@ -708,6 +702,7 @@ verify_gdbarch (struct gdbarch *gdbarch) /* Skip verify of insn_is_call, invalid_p == 0 */ /* Skip verify of insn_is_ret, invalid_p == 0 */ /* Skip verify of insn_is_jump, invalid_p == 0 */ + /* Skip verify of program_breakpoint_here_p, invalid_p == 0 */ /* Skip verify of auxv_parse, has predicate. */ /* Skip verify of print_auxv_entry, invalid_p == 0 */ /* Skip verify of vsyscall_range, invalid_p == 0 */ @@ -918,6 +913,9 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) fprintf_unfiltered (file, "gdbarch_dump: displaced_step_copy_insn = <%s>\n", host_address_to_string (gdbarch->displaced_step_copy_insn)); + fprintf_unfiltered (file, + "gdbarch_dump: displaced_step_finish = <%s>\n", + host_address_to_string (gdbarch->displaced_step_finish)); fprintf_unfiltered (file, "gdbarch_dump: gdbarch_displaced_step_fixup_p() = %d\n", gdbarch_displaced_step_fixup_p (gdbarch)); @@ -928,8 +926,11 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) "gdbarch_dump: displaced_step_hw_singlestep = <%s>\n", host_address_to_string (gdbarch->displaced_step_hw_singlestep)); fprintf_unfiltered (file, - "gdbarch_dump: displaced_step_location = <%s>\n", - host_address_to_string (gdbarch->displaced_step_location)); + "gdbarch_dump: gdbarch_displaced_step_prepare_p() = %d\n", + gdbarch_displaced_step_prepare_p (gdbarch)); + fprintf_unfiltered (file, + "gdbarch_dump: displaced_step_prepare = <%s>\n", + host_address_to_string (gdbarch->displaced_step_prepare)); fprintf_unfiltered (file, "gdbarch_dump: double_bit = %s\n", plongest (gdbarch->double_bit)); @@ -1248,6 +1249,9 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) fprintf_unfiltered (file, "gdbarch_dump: process_record_signal = <%s>\n", host_address_to_string (gdbarch->process_record_signal)); + fprintf_unfiltered (file, + "gdbarch_dump: program_breakpoint_here_p = <%s>\n", + host_address_to_string (gdbarch->program_breakpoint_here_p)); fprintf_unfiltered (file, "gdbarch_dump: ps_regnum = %s\n", plongest (gdbarch->ps_regnum)); @@ -3930,7 +3934,7 @@ gdbarch_displaced_step_copy_insn_p (struct gdbarch *gdbarch) return gdbarch->displaced_step_copy_insn != NULL; } -struct displaced_step_closure * +displaced_step_copy_insn_closure_up gdbarch_displaced_step_copy_insn (struct gdbarch *gdbarch, CORE_ADDR from, CORE_ADDR to, struct regcache *regs) { gdb_assert (gdbarch != NULL); @@ -3948,7 +3952,7 @@ set_gdbarch_displaced_step_copy_insn (struct gdbarch *gdbarch, } int -gdbarch_displaced_step_hw_singlestep (struct gdbarch *gdbarch, struct displaced_step_closure *closure) +gdbarch_displaced_step_hw_singlestep (struct gdbarch *gdbarch, struct displaced_step_copy_insn_closure *closure) { gdb_assert (gdbarch != NULL); gdb_assert (gdbarch->displaced_step_hw_singlestep != NULL); @@ -3972,7 +3976,7 @@ gdbarch_displaced_step_fixup_p (struct gdbarch *gdbarch) } void -gdbarch_displaced_step_fixup (struct gdbarch *gdbarch, struct displaced_step_closure *closure, CORE_ADDR from, CORE_ADDR to, struct regcache *regs) +gdbarch_displaced_step_fixup (struct gdbarch *gdbarch, struct displaced_step_copy_insn_closure *closure, CORE_ADDR from, CORE_ADDR to, struct regcache *regs) { gdb_assert (gdbarch != NULL); gdb_assert (gdbarch->displaced_step_fixup != NULL); @@ -3989,21 +3993,45 @@ set_gdbarch_displaced_step_fixup (struct gdbarch *gdbarch, gdbarch->displaced_step_fixup = displaced_step_fixup; } -CORE_ADDR -gdbarch_displaced_step_location (struct gdbarch *gdbarch) +int +gdbarch_displaced_step_prepare_p (struct gdbarch *gdbarch) +{ + gdb_assert (gdbarch != NULL); + return gdbarch->displaced_step_prepare != NULL; +} + +displaced_step_prepare_status +gdbarch_displaced_step_prepare (struct gdbarch *gdbarch, thread_info *thread) +{ + gdb_assert (gdbarch != NULL); + gdb_assert (gdbarch->displaced_step_prepare != NULL); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_displaced_step_prepare called\n"); + return gdbarch->displaced_step_prepare (gdbarch, thread); +} + +void +set_gdbarch_displaced_step_prepare (struct gdbarch *gdbarch, + gdbarch_displaced_step_prepare_ftype displaced_step_prepare) +{ + gdbarch->displaced_step_prepare = displaced_step_prepare; +} + +displaced_step_finish_status +gdbarch_displaced_step_finish (struct gdbarch *gdbarch, thread_info *thread, gdb_signal sig) { gdb_assert (gdbarch != NULL); - gdb_assert (gdbarch->displaced_step_location != NULL); + gdb_assert (gdbarch->displaced_step_finish != NULL); if (gdbarch_debug >= 2) - fprintf_unfiltered (gdb_stdlog, "gdbarch_displaced_step_location called\n"); - return gdbarch->displaced_step_location (gdbarch); + fprintf_unfiltered (gdb_stdlog, "gdbarch_displaced_step_finish called\n"); + return gdbarch->displaced_step_finish (gdbarch, thread, sig); } void -set_gdbarch_displaced_step_location (struct gdbarch *gdbarch, - gdbarch_displaced_step_location_ftype displaced_step_location) +set_gdbarch_displaced_step_finish (struct gdbarch *gdbarch, + gdbarch_displaced_step_finish_ftype displaced_step_finish) { - gdbarch->displaced_step_location = displaced_step_location; + gdbarch->displaced_step_finish = displaced_step_finish; } int @@ -4928,6 +4956,23 @@ set_gdbarch_insn_is_jump (struct gdbarch *gdbarch, gdbarch->insn_is_jump = insn_is_jump; } +bool +gdbarch_program_breakpoint_here_p (struct gdbarch *gdbarch, CORE_ADDR address) +{ + gdb_assert (gdbarch != NULL); + gdb_assert (gdbarch->program_breakpoint_here_p != NULL); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_program_breakpoint_here_p called\n"); + return gdbarch->program_breakpoint_here_p (gdbarch, address); +} + +void +set_gdbarch_program_breakpoint_here_p (struct gdbarch *gdbarch, + gdbarch_program_breakpoint_here_p_ftype program_breakpoint_here_p) +{ + gdbarch->program_breakpoint_here_p = program_breakpoint_here_p; +} + int gdbarch_auxv_parse_p (struct gdbarch *gdbarch) {