From 7d00775ece9e2364da5cfd65ebbfce515859667f Mon Sep 17 00:00:00 2001 From: Antoine Tremblay Date: Thu, 19 Nov 2015 11:29:10 -0500 Subject: [PATCH] Refactor queries for hardware and software single stepping support in GDBServer. Before this patch there was only one call: can_hardware_single_step. Its implementation was a check on breakpoint_reinsert_addr if NULL it assumed that the target could hardware single step. This patch prepares for the case where this is not true anymore. In order to improve software single stepping in GDBServer the breakpoint_reinsert_addr operation of targets that had a very simple software implementation used only for stepping over thread creation events will be removed. This will create a case where a target does not support hardware single step and has the operation breakpoint_reinsert_addr set to NULL, thus can_hardware_single_step needs to be implemented another way. A new target operation supports_hardware_single_step is introduced and is to return true if the target does support such a feature, support for the feature is manually hardcoded. Note that the hardware single step support was enabled as per the current behavior, I did not check if tile for example really has ptrace singlestep support but since the current implementation assumed it had, I kept it that way. No regressions on Ubuntu 14.04 on ARMv7 and x86. With gdbserver-{native,extended} / { -marm -mthumb } Compilation tested on: aarch64,arm,bfind,crisv32,m32r,ppc,s390,tic6x,tile, xtensa. Not tested : sh. gdb/gdbserver/ChangeLog: * linux-aarch64-low.c (aarch64_supports_hardware_single_step): New function. (struct linux_target_ops) : Initialize. * linux-arm-low.c (arm_supports_hardware_single_step): New function. (struct linux_target_ops) : Initialize. * linux-bfin-low.c (bfin_supports_hardware_single_step): New function. (struct linux_target_ops) : Initialize. * linux-crisv32-low.c (cris_supports_hardware_single_step): New function. (struct linux_target_ops) : Initialize. * linux-low.c (can_hardware_single_step): Use supports_hardware_single_step. (can_software_single_step): New function. (start_step_over): Call can_software_single_step. (linux_supports_hardware_single_step): New function. (struct target_ops) : Initialize. * linux-low.h (struct linux_target_ops) : Initialize. * linux-m32r-low.c (m32r_supports_hardware_single_step): New function. (struct linux_target_ops) : Initialize. * linux-ppc-low.c (ppc_supports_hardware_single_step): New function. (struct linux_target_ops) Initialize. * linux-s390-low.c (s390_supports_hardware_single_step): New function. (struct linux_target_ops) : Initialize. * linux-sh-low.c (sh_supports_hardware_single_step): New function. (struct linux_target_ops) : Initialize. * linux-tic6x-low.c (tic6x_supports_hardware_single_step): New function. (struct linux_target_ops) : Initialize. * linux-tile-low.c (tile_supports_hardware_single_step): New function. (struct linux_target_ops) : Initialize. * linux-x86-low.c (x86_supports_hardware_single_step) New function. (struct linux_target_ops) : Initialize. * linux-xtensa-low.c (xtensa_supports_hardware_single_step): New function. (struct linux_target_ops) : Initialize. * target.h (struct target_ops): : New field. (target_supports_software_single_step): New macro. --- gdb/gdbserver/ChangeLog | 44 +++++++++++++++++++++++++++++++ gdb/gdbserver/linux-aarch64-low.c | 10 +++++++ gdb/gdbserver/linux-arm-low.c | 11 +++++++- gdb/gdbserver/linux-bfin-low.c | 29 ++++++++++++++++++++ gdb/gdbserver/linux-crisv32-low.c | 24 +++++++++++++++++ gdb/gdbserver/linux-low.c | 33 +++++++++++++++++++---- gdb/gdbserver/linux-low.h | 3 +++ gdb/gdbserver/linux-m32r-low.c | 29 ++++++++++++++++++++ gdb/gdbserver/linux-ppc-low.c | 22 ++++++++++++++++ gdb/gdbserver/linux-s390-low.c | 22 ++++++++++++++++ gdb/gdbserver/linux-sh-low.c | 29 ++++++++++++++++++++ gdb/gdbserver/linux-tic6x-low.c | 29 ++++++++++++++++++++ gdb/gdbserver/linux-tile-low.c | 29 ++++++++++++++++++++ gdb/gdbserver/linux-x86-low.c | 11 ++++++++ gdb/gdbserver/linux-xtensa-low.c | 29 ++++++++++++++++++++ gdb/gdbserver/target.h | 7 +++++ 16 files changed, 355 insertions(+), 6 deletions(-) diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog index f48d7f271e1..4f25205c93d 100644 --- a/gdb/gdbserver/ChangeLog +++ b/gdb/gdbserver/ChangeLog @@ -1,3 +1,47 @@ +2015-11-30 Antoine Tremblay + + * linux-aarch64-low.c (aarch64_supports_hardware_single_step): + New function. + (struct linux_target_ops) : Initialize. + * linux-arm-low.c (arm_supports_hardware_single_step): New function. + (struct linux_target_ops) : Initialize. + * linux-bfin-low.c (bfin_supports_hardware_single_step): New function. + (struct linux_target_ops) : + Initialize. + * linux-crisv32-low.c (cris_supports_hardware_single_step): + New function. + (struct linux_target_ops) : Initialize. + * linux-low.c (can_hardware_single_step): Use + supports_hardware_single_step. + (can_software_single_step): New function. + (start_step_over): Call can_software_single_step. + (linux_supports_hardware_single_step): New function. + (struct target_ops) : Initialize. + * linux-low.h (struct linux_target_ops) + : Initialize. + * linux-m32r-low.c (m32r_supports_hardware_single_step): New function. + (struct linux_target_ops) : Initialize. + * linux-ppc-low.c (ppc_supports_hardware_single_step): New function. + (struct linux_target_ops) Initialize. + * linux-s390-low.c (s390_supports_hardware_single_step): New function. + (struct linux_target_ops) : Initialize. + * linux-sh-low.c (sh_supports_hardware_single_step): New function. + (struct linux_target_ops) : Initialize. + * linux-tic6x-low.c (tic6x_supports_hardware_single_step): New function. + (struct linux_target_ops) : + Initialize. + * linux-tile-low.c (tile_supports_hardware_single_step): New function. + (struct linux_target_ops) : + Initialize. + * linux-x86-low.c (x86_supports_hardware_single_step) New function. + (struct linux_target_ops) : Initialize. + * linux-xtensa-low.c (xtensa_supports_hardware_single_step): + New function. + (struct linux_target_ops) : Initialize. + * target.h (struct target_ops): : + New field. + (target_supports_software_single_step): New macro. + 2015-11-30 Antoine Tremblay * linux-low.c (linux_wait_1): Fix pc advance condition. diff --git a/gdb/gdbserver/linux-aarch64-low.c b/gdb/gdbserver/linux-aarch64-low.c index cb786664627..17798ff24a3 100644 --- a/gdb/gdbserver/linux-aarch64-low.c +++ b/gdb/gdbserver/linux-aarch64-low.c @@ -2944,6 +2944,14 @@ aarch64_sw_breakpoint_from_kind (int kind, int *size) return aarch64_breakpoint; } +/* Support for hardware single step. */ + +static int +aarch64_supports_hardware_single_step (void) +{ + return 1; +} + struct linux_target_ops the_low_target = { aarch64_arch_setup, @@ -2977,6 +2985,8 @@ struct linux_target_ops the_low_target = aarch64_emit_ops, aarch64_get_min_fast_tracepoint_insn_len, aarch64_supports_range_stepping, + NULL, /* breakpoint_kind_from_current_state */ + aarch64_supports_hardware_single_step, }; void diff --git a/gdb/gdbserver/linux-arm-low.c b/gdb/gdbserver/linux-arm-low.c index 6f37f581096..0c788886159 100644 --- a/gdb/gdbserver/linux-arm-low.c +++ b/gdb/gdbserver/linux-arm-low.c @@ -902,6 +902,14 @@ arm_arch_setup (void) have_ptrace_getregset = 0; } +/* Support for hardware single step. */ + +static int +arm_supports_hardware_single_step (void) +{ + return 0; +} + /* Register sets without using PTRACE_GETREGSET. */ static struct regset_info arm_regsets[] = { @@ -1058,7 +1066,8 @@ struct linux_target_ops the_low_target = { NULL, /* emit_ops */ NULL, /* get_min_fast_tracepoint_insn_len */ NULL, /* supports_range_stepping */ - arm_breakpoint_kind_from_current_state + arm_breakpoint_kind_from_current_state, + arm_supports_hardware_single_step }; void diff --git a/gdb/gdbserver/linux-bfin-low.c b/gdb/gdbserver/linux-bfin-low.c index d3b83fc827e..912d253342c 100644 --- a/gdb/gdbserver/linux-bfin-low.c +++ b/gdb/gdbserver/linux-bfin-low.c @@ -105,6 +105,14 @@ bfin_arch_setup (void) current_process ()->tdesc = tdesc_bfin; } +/* Support for hardware single step. */ + +static int +bfin_supports_hardware_single_step (void) +{ + return 1; +} + static struct usrregs_info bfin_usrregs_info = { bfin_num_regs, @@ -136,6 +144,27 @@ struct linux_target_ops the_low_target = { NULL, /* breakpoint_reinsert_addr */ 2, bfin_breakpoint_at, + NULL, /* supports_z_point_type */ + NULL, /* insert_point */ + NULL, /* remove_point */ + NULL, /* stopped_by_watchpoint */ + NULL, /* stopped_data_address */ + NULL, /* collect_ptrace_register */ + NULL, /* supply_ptrace_register */ + NULL, /* siginfo_fixup */ + NULL, /* new_process */ + NULL, /* new_thread */ + NULL, /* new_fork */ + NULL, /* prepare_to_resume */ + NULL, /* process_qsupported */ + NULL, /* supports_tracepoints */ + NULL, /* get_thread_area */ + NULL, /* install_fast_tracepoint_jump_pad */ + NULL, /* emit_ops */ + NULL, /* get_min_fast_tracepoint_insn_len */ + NULL, /* supports_range_stepping */ + NULL, /* breakpoint_kind_from_current_state */ + bfin_supports_hardware_single_step, }; diff --git a/gdb/gdbserver/linux-crisv32-low.c b/gdb/gdbserver/linux-crisv32-low.c index 8d9ef04c576..4f9afa6d9f0 100644 --- a/gdb/gdbserver/linux-crisv32-low.c +++ b/gdb/gdbserver/linux-crisv32-low.c @@ -388,6 +388,14 @@ cris_arch_setup (void) current_process ()->tdesc = tdesc_crisv32; } +/* Support for hardware single step. */ + +static int +cris_supports_hardware_single_step (void) +{ + return 1; +} + static struct regset_info cris_regsets[] = { { PTRACE_GETREGS, PTRACE_SETREGS, 0, cris_num_regs * 4, GENERAL_REGS, cris_fill_gregset, cris_store_gregset }, @@ -439,6 +447,22 @@ struct linux_target_ops the_low_target = { cris_remove_point, cris_stopped_by_watchpoint, cris_stopped_data_address, + NULL, /* collect_ptrace_register */ + NULL, /* supply_ptrace_register */ + NULL, /* siginfo_fixup */ + NULL, /* new_process */ + NULL, /* new_thread */ + NULL, /* new_fork */ + NULL, /* prepare_to_resume */ + NULL, /* process_qsupported */ + NULL, /* supports_tracepoints */ + NULL, /* get_thread_area */ + NULL, /* install_fast_tracepoint_jump_pad */ + NULL, /* emit_ops */ + NULL, /* get_min_fast_tracepoint_insn_len */ + NULL, /* supports_range_stepping */ + NULL, /* breakpoint_kind_from_current_state */ + cris_supports_hardware_single_step, }; void diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c index b29f54e523d..cfc5987e092 100644 --- a/gdb/gdbserver/linux-low.c +++ b/gdb/gdbserver/linux-low.c @@ -269,13 +269,24 @@ static void complete_ongoing_step_over (void); being stepped. */ ptid_t step_over_bkpt; -/* True if the low target can hardware single-step. Such targets - don't need a BREAKPOINT_REINSERT_ADDR callback. */ +/* True if the low target can hardware single-step. */ static int can_hardware_single_step (void) { - return (the_low_target.breakpoint_reinsert_addr == NULL); + if (the_low_target.supports_hardware_single_step != NULL) + return the_low_target.supports_hardware_single_step (); + else + return 0; +} + +/* True if the low target can software single-step. Such targets + implement the BREAKPOINT_REINSERT_ADDR callback. */ + +static int +can_software_single_step (void) +{ + return (the_low_target.breakpoint_reinsert_addr != NULL); } /* True if the low target supports memory breakpoints. If so, we'll @@ -4509,12 +4520,17 @@ start_step_over (struct lwp_info *lwp) { step = 1; } - else + else if (can_software_single_step ()) { CORE_ADDR raddr = (*the_low_target.breakpoint_reinsert_addr) (); set_reinsert_breakpoint (raddr); step = 0; } + else + { + internal_error (__FILE__, __LINE__, + "stepping is not implemented on this target"); + } current_thread = saved_thread; @@ -5713,6 +5729,12 @@ linux_supports_hardware_single_step (void) return can_hardware_single_step (); } +static int +linux_supports_software_single_step (void) +{ + return can_software_single_step (); +} + static int linux_stopped_by_watchpoint (void) { @@ -7153,7 +7175,8 @@ static struct target_ops linux_target_ops = { linux_breakpoint_kind_from_pc, linux_sw_breakpoint_from_kind, linux_proc_tid_get_name, - linux_breakpoint_kind_from_current_state + linux_breakpoint_kind_from_current_state, + linux_supports_software_single_step }; static void diff --git a/gdb/gdbserver/linux-low.h b/gdb/gdbserver/linux-low.h index e2bfeb70c18..24ea2d35fbf 100644 --- a/gdb/gdbserver/linux-low.h +++ b/gdb/gdbserver/linux-low.h @@ -236,6 +236,9 @@ struct linux_target_ops /* See target.h. */ int (*breakpoint_kind_from_current_state) (CORE_ADDR *pcptr); + + /* See target.h. */ + int (*supports_hardware_single_step) (void); }; extern struct linux_target_ops the_low_target; diff --git a/gdb/gdbserver/linux-m32r-low.c b/gdb/gdbserver/linux-m32r-low.c index bb1002f9db4..c6d79b64feb 100644 --- a/gdb/gdbserver/linux-m32r-low.c +++ b/gdb/gdbserver/linux-m32r-low.c @@ -103,6 +103,14 @@ m32r_arch_setup (void) current_process ()->tdesc = tdesc_m32r; } +/* Support for hardware single step. */ + +static int +m32r_supports_hardware_single_step (void) +{ + return 1; +} + static struct usrregs_info m32r_usrregs_info = { m32r_num_regs, @@ -134,6 +142,27 @@ struct linux_target_ops the_low_target = { NULL, 0, m32r_breakpoint_at, + NULL, /* supports_z_point_type */ + NULL, /* insert_point */ + NULL, /* remove_point */ + NULL, /* stopped_by_watchpoint */ + NULL, /* stopped_data_address */ + NULL, /* collect_ptrace_register */ + NULL, /* supply_ptrace_register */ + NULL, /* siginfo_fixup */ + NULL, /* new_process */ + NULL, /* new_thread */ + NULL, /* new_fork */ + NULL, /* prepare_to_resume */ + NULL, /* process_qsupported */ + NULL, /* supports_tracepoints */ + NULL, /* get_thread_area */ + NULL, /* install_fast_tracepoint_jump_pad */ + NULL, /* emit_ops */ + NULL, /* get_min_fast_tracepoint_insn_len */ + NULL, /* supports_range_stepping */ + NULL, /* breakpoint_kind_from_current_state */ + m32r_supports_hardware_single_step, }; void diff --git a/gdb/gdbserver/linux-ppc-low.c b/gdb/gdbserver/linux-ppc-low.c index 995a725c536..decee86b1e6 100644 --- a/gdb/gdbserver/linux-ppc-low.c +++ b/gdb/gdbserver/linux-ppc-low.c @@ -547,6 +547,14 @@ ppc_store_evrregset (struct regcache *regcache, const void *buf) supply_register_by_name (regcache, "spefscr", ®set->spefscr); } +/* Support for hardware single step. */ + +static int +ppc_supports_hardware_single_step (void) +{ + return 1; +} + static struct regset_info ppc_regsets[] = { /* List the extra register sets before GENERAL_REGS. That way we will fetch them every time, but still fall back to PTRACE_PEEKUSER for the @@ -705,6 +713,20 @@ struct linux_target_ops the_low_target = { NULL, ppc_collect_ptrace_register, ppc_supply_ptrace_register, + NULL, /* siginfo_fixup */ + NULL, /* new_process */ + NULL, /* new_thread */ + NULL, /* new_fork */ + NULL, /* prepare_to_resume */ + NULL, /* process_qsupported */ + NULL, /* supports_tracepoints */ + NULL, /* get_thread_area */ + NULL, /* install_fast_tracepoint_jump_pad */ + NULL, /* emit_ops */ + NULL, /* get_min_fast_tracepoint_insn_len */ + NULL, /* supports_range_stepping */ + NULL, /* breakpoint_kind_from_current_state */ + ppc_supports_hardware_single_step, }; void diff --git a/gdb/gdbserver/linux-s390-low.c b/gdb/gdbserver/linux-s390-low.c index efede2de74b..7127373a147 100644 --- a/gdb/gdbserver/linux-s390-low.c +++ b/gdb/gdbserver/linux-s390-low.c @@ -609,6 +609,14 @@ s390_breakpoint_at (CORE_ADDR pc) return memcmp (c, s390_breakpoint, s390_breakpoint_len) == 0; } +/* Support for hardware single step. */ + +static int +s390_supports_hardware_single_step (void) +{ + return 1; +} + static struct usrregs_info s390_usrregs_info = { s390_num_regs, @@ -686,6 +694,20 @@ struct linux_target_ops the_low_target = { NULL, s390_collect_ptrace_register, s390_supply_ptrace_register, + NULL, /* siginfo_fixup */ + NULL, /* new_process */ + NULL, /* new_thread */ + NULL, /* new_fork */ + NULL, /* prepare_to_resume */ + NULL, /* process_qsupported */ + NULL, /* supports_tracepoints */ + NULL, /* get_thread_area */ + NULL, /* install_fast_tracepoint_jump_pad */ + NULL, /* emit_ops */ + NULL, /* get_min_fast_tracepoint_insn_len */ + NULL, /* supports_range_stepping */ + NULL, /* breakpoint_kind_from_current_state */ + s390_supports_hardware_single_step, }; void diff --git a/gdb/gdbserver/linux-sh-low.c b/gdb/gdbserver/linux-sh-low.c index 207e87e0281..1b3189b2448 100644 --- a/gdb/gdbserver/linux-sh-low.c +++ b/gdb/gdbserver/linux-sh-low.c @@ -100,6 +100,14 @@ sh_breakpoint_at (CORE_ADDR where) return 0; } +/* Support for hardware single step. */ + +static int +sh_supports_hardware_single_step (void) +{ + return 1; +} + /* Provide only a fill function for the general register set. ps_lgetregs will use this for NPTL support. */ @@ -162,6 +170,27 @@ struct linux_target_ops the_low_target = { NULL, 0, sh_breakpoint_at, + NULL, /* supports_z_point_type */ + NULL, /* insert_point */ + NULL, /* remove_point */ + NULL, /* stopped_by_watchpoint */ + NULL, /* stopped_data_address */ + NULL, /* collect_ptrace_register */ + NULL, /* supply_ptrace_register */ + NULL, /* siginfo_fixup */ + NULL, /* new_process */ + NULL, /* new_thread */ + NULL, /* new_fork */ + NULL, /* prepare_to_resume */ + NULL, /* process_qsupported */ + NULL, /* supports_tracepoints */ + NULL, /* get_thread_area */ + NULL, /* install_fast_tracepoint_jump_pad */ + NULL, /* emit_ops */ + NULL, /* get_min_fast_tracepoint_insn_len */ + NULL, /* supports_range_stepping */ + NULL, /* breakpoint_kind_from_current_state */ + sh_supports_hardware_single_step, }; void diff --git a/gdb/gdbserver/linux-tic6x-low.c b/gdb/gdbserver/linux-tic6x-low.c index cf8b5fb4615..e4aba15f393 100644 --- a/gdb/gdbserver/linux-tic6x-low.c +++ b/gdb/gdbserver/linux-tic6x-low.c @@ -341,6 +341,14 @@ tic6x_arch_setup (void) current_process ()->tdesc = tic6x_read_description (); } +/* Support for hardware single step. */ + +static int +tic6x_supports_hardware_single_step (void) +{ + return 1; +} + static struct regsets_info tic6x_regsets_info = { tic6x_regsets, /* regsets */ @@ -380,6 +388,27 @@ struct linux_target_ops the_low_target = { NULL, 0, tic6x_breakpoint_at, + NULL, /* supports_z_point_type */ + NULL, /* insert_point */ + NULL, /* remove_point */ + NULL, /* stopped_by_watchpoint */ + NULL, /* stopped_data_address */ + NULL, /* collect_ptrace_register */ + NULL, /* supply_ptrace_register */ + NULL, /* siginfo_fixup */ + NULL, /* new_process */ + NULL, /* new_thread */ + NULL, /* new_fork */ + NULL, /* prepare_to_resume */ + NULL, /* process_qsupported */ + NULL, /* supports_tracepoints */ + NULL, /* get_thread_area */ + NULL, /* install_fast_tracepoint_jump_pad */ + NULL, /* emit_ops */ + NULL, /* get_min_fast_tracepoint_insn_len */ + NULL, /* supports_range_stepping */ + NULL, /* breakpoint_kind_from_current_state */ + tic6x_supports_hardware_single_step, }; void diff --git a/gdb/gdbserver/linux-tile-low.c b/gdb/gdbserver/linux-tile-low.c index 47ca245215e..6f1635512e4 100644 --- a/gdb/gdbserver/linux-tile-low.c +++ b/gdb/gdbserver/linux-tile-low.c @@ -181,6 +181,14 @@ tile_arch_setup (void) current_process ()->tdesc = tdesc_tilegx; } +/* Support for hardware single step. */ + +static int +tile_supports_hardware_single_step (void) +{ + return 1; +} + struct linux_target_ops the_low_target = { @@ -196,6 +204,27 @@ struct linux_target_ops the_low_target = NULL, 0, tile_breakpoint_at, + NULL, /* supports_z_point_type */ + NULL, /* insert_point */ + NULL, /* remove_point */ + NULL, /* stopped_by_watchpoint */ + NULL, /* stopped_data_address */ + NULL, /* collect_ptrace_register */ + NULL, /* supply_ptrace_register */ + NULL, /* siginfo_fixup */ + NULL, /* new_process */ + NULL, /* new_thread */ + NULL, /* new_fork */ + NULL, /* prepare_to_resume */ + NULL, /* process_qsupported */ + NULL, /* supports_tracepoints */ + NULL, /* get_thread_area */ + NULL, /* install_fast_tracepoint_jump_pad */ + NULL, /* emit_ops */ + NULL, /* get_min_fast_tracepoint_insn_len */ + NULL, /* supports_range_stepping */ + NULL, /* breakpoint_kind_from_current_state */ + tile_supports_hardware_single_step, }; void diff --git a/gdb/gdbserver/linux-x86-low.c b/gdb/gdbserver/linux-x86-low.c index 7f0719401a5..18adf5ee7d1 100644 --- a/gdb/gdbserver/linux-x86-low.c +++ b/gdb/gdbserver/linux-x86-low.c @@ -3264,6 +3264,15 @@ x86_supports_range_stepping (void) return 1; } +/* Implementation of linux_target_ops method "supports_hardware_single_step". + */ + +static int +x86_supports_hardware_single_step (void) +{ + return 1; +} + /* This is initialized assuming an amd64 target. x86_arch_setup will correct it for i386 or amd64 targets. */ @@ -3304,6 +3313,8 @@ struct linux_target_ops the_low_target = x86_emit_ops, x86_get_min_fast_tracepoint_insn_len, x86_supports_range_stepping, + NULL, /* breakpoint_kind_from_current_state */ + x86_supports_hardware_single_step, }; void diff --git a/gdb/gdbserver/linux-xtensa-low.c b/gdb/gdbserver/linux-xtensa-low.c index 7c71631ad9d..b48e8dd83bb 100644 --- a/gdb/gdbserver/linux-xtensa-low.c +++ b/gdb/gdbserver/linux-xtensa-low.c @@ -229,6 +229,14 @@ xtensa_arch_setup (void) current_process ()->tdesc = tdesc_xtensa; } +/* Support for hardware single step. */ + +static int +xtensa_supports_hardware_single_step (void) +{ + return 1; +} + static const struct regs_info * xtensa_regs_info (void) { @@ -248,6 +256,27 @@ struct linux_target_ops the_low_target = { NULL, 0, xtensa_breakpoint_at, + NULL, /* supports_z_point_type */ + NULL, /* insert_point */ + NULL, /* remove_point */ + NULL, /* stopped_by_watchpoint */ + NULL, /* stopped_data_address */ + NULL, /* collect_ptrace_register */ + NULL, /* supply_ptrace_register */ + NULL, /* siginfo_fixup */ + NULL, /* new_process */ + NULL, /* new_thread */ + NULL, /* new_fork */ + NULL, /* prepare_to_resume */ + NULL, /* process_qsupported */ + NULL, /* supports_tracepoints */ + NULL, /* get_thread_area */ + NULL, /* install_fast_tracepoint_jump_pad */ + NULL, /* emit_ops */ + NULL, /* get_min_fast_tracepoint_insn_len */ + NULL, /* supports_range_stepping */ + NULL, /* breakpoint_kind_from_current_state */ + xtensa_supports_hardware_single_step, }; diff --git a/gdb/gdbserver/target.h b/gdb/gdbserver/target.h index d3fcb360333..9cd07bc2d94 100644 --- a/gdb/gdbserver/target.h +++ b/gdb/gdbserver/target.h @@ -463,6 +463,9 @@ struct target_ops PC. The PCPTR is adjusted to the real memory location in case a flag (e.g., the Thumb bit on ARM) is present in the PC. */ int (*breakpoint_kind_from_current_state) (CORE_ADDR *pcptr); + + /* Returns true if the target can software single step. */ + int (*supports_software_single_step) (void); }; extern struct target_ops *the_target; @@ -655,6 +658,10 @@ int kill_inferior (int); ? (*the_target->breakpoint_kind_from_current_state) (pcptr) \ : target_breakpoint_kind_from_pc (pcptr)) +#define target_supports_software_single_step() \ + (the_target->supports_software_single_step ? \ + (*the_target->supports_software_single_step) () : 0) + /* Start non-stop mode, returns 0 on success, -1 on failure. */ int start_non_stop (int nonstop); -- 2.30.2