Re: [PATCH 03/10] Refactor queries for hardware and software single stepping support in GDBServer.

Pedro Alves
2015-11-04T18:47:18Z

On 10/29/2015 05:09 PM, Antoine Tremblay wrote:
> 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) <supports_hardware_single_step>: Initialize.
> * linux-arm-low.c (arm_supports_hardware_single_step): New function.
> (struct linux_target_ops) <supports_hardware_single_step>: Initialize.
> * linux-bfin-low.c (bfin_supports_hardware_single_step): New function.
> (struct linux_target_ops) <bfin_supports_hardware_single_step>:
> Initialize.
> * linux-crisv32-low.c (cris_supports_hardware_single_step):
> New function.
> (struct linux_target_ops) <supports_hardware_single_step>: 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) <supports_software_single_step>: Initialize.
> * linux-low.h (struct linux_target_ops)
> <supports_hardware_single_step>: Initialize.
> * linux-m32r-low.c (m32r_supports_hardware_single_step): New function.
> (struct linux_target_ops) <supports_hardware_single_step>: Initialize.
> * linux-ppc-low.c (ppc_supports_hardware_single_step): New function.
> (struct linux_target_ops) <supports_hardware_single_step> Initialize.
> * linux-s390-low.c (s390_supports_hardware_single_step): New function.
> (struct linux_target_ops) <supports_hardware_single_step>: Initialize.
> * linux-sh-low.c (sh_supports_hardware_single_step): New function.
> (struct linux_target_ops) <supports_hardware_single_step>: Initialize.
> * linux-tic6x-low.c (tic6x_supports_hardware_single_step): New function.
> (struct linux_target_ops) <tic6x_supports_hardware_single_step>:
> Initialize.
> * linux-tile-low.c (tile_supports_hardware_single_step): New function.
> (struct linux_target_ops) <tile_supports_hardware_single_step>:
> Initialize.
> * linux-x86-low.c (x86_supports_hardware_single_step) New function.
> (struct linux_target_ops) <supports_hardware_single_step>: Initialize.
> * linux-xtensa-low.c (xtensa_supports_hardware_single_step):
> New function.
> (struct linux_target_ops) <supports_hardware_single_step>: Initialize.
> * target.h (struct target_ops): <supports_software_single_step>:
> New field.
> (target_supports_software_single_step): New macro.

LGTM.

Thanks,
Pedro Alves