This is the mail archive of the
mailing list for the GDB project.
Re: [PATCH 2/2] Support single step by arch or target
- From: Antoine Tremblay <antoine dot tremblay at ericsson dot com>
- To: Yao Qi <qiyaoltc at gmail dot com>, <gdb-patches at sourceware dot org>
- Date: Tue, 1 Sep 2015 09:18:33 -0400
- Subject: Re: [PATCH 2/2] Support single step by arch or target
- Authentication-results: sourceware.org; auth=none
- References: <1441096915-23615-1-git-send-email-yao dot qi at linaro dot org> <1441096915-23615-3-git-send-email-yao dot qi at linaro dot org>
On 09/01/2015 04:41 AM, Yao Qi wrote:
Nowadays, GDB only knows whether architecture supports hardware single
step or software single step (through gdbarch hook software_single_step),
and for a given instruction or instruction sequence, GDB knows how to
do single step (hardware or software). However, GDB doesn't know whether
the target supports hardware single step. It is possible that the
architecture doesn't support hardware single step, such as arm, but
the target supports, such as simulator. This was discussed in this
thread https://www.sourceware.org/ml/gdb/2009-12/msg00033.html before.
I encounter this problem for aarch64 multi-arch support. When aarch64
debugs arm program, gdbarch is arm, so software single step is still
used. However, the underneath linux kernel does support hardware
single step, so IWBN to use it.
This patch is to add a new target_ops hook to_can_do_single_step, and
only use it in arm_linux_software_single_step to decide whether or not
to use hardware single step.
Could we name this can_hardware_single_step instead ? Since the target
may be able to software single step (in gdbserver). And thus it would be
confusing...It would also be more consistent with the
supports_hardware_single_step hook ?
@@ -917,6 +917,11 @@ arm_linux_software_single_step (struct frame_info *frame)
if (arm_deal_with_atomic_sequence (frame))
+ /* If the target does have hardware single step, GDB doesn't have
+ to bother software single step. */
+ if (target_can_do_single_step () == 1)
+ return 0;
next_pc = arm_get_next_pc (frame, get_frame_pc (frame));
/* The Linux kernel offers some user-mode helpers in a high page. We can
target_can_do_single_step () should be before