Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <palves@redhat.com>
To: Yao Qi <qiyaoltc@gmail.com>, gdb-patches@sourceware.org
Subject: Re: [PATCH 2/2] Remove gdbarch method displaced_step_hw_singlestep
Date: Wed, 23 Mar 2016 17:26:00 -0000	[thread overview]
Message-ID: <56F2D1BF.5070005@redhat.com> (raw)
In-Reply-To: <1458742206-622-3-git-send-email-yao.qi@linaro.org>

On 03/23/2016 02:10 PM, Yao Qi wrote:
> displaced_step_hw_singlestep was added for some targets, which can do
> hardware single step, but need software single step for some special
> instructions.  After we change gdbarch method software_single_step,
> displaced_step_hw_singlestep is no longer necessary, because we can
> get the same information from software_single_step.  

I wasn't sure whether this is safe, but I convinced myself it is.
I'd have been nice if there had been a note in the log about the below:

Currently, when stepping past an instruction in the scratch pad, these
archs won't ever reach the software_single_step method, always forcing a
hardware single-step, even if the software_single_step method would
insert some breakpoint.  The question is: is it safe now for them to
analyse the instruction copied to the scratch pad, and potentially insert
a software single-step?

I think it is safe, because we won't ever use displaced stepping
for the cases where the software_single_step method would return
something non-NULL.  software_single_step returns non-NULL _only_
for atomic regions, while OTOH, displaced_step_copy_insn always returns
NULL for atomic regions.  E.g., notice how ppc_displaced_step_copy_insn
vs ppc_deal_with_atomic_sequence.

> --- a/gdb/infrun.c
> +++ b/gdb/infrun.c
> @@ -2611,8 +2611,25 @@ resume (enum gdb_signal sig)
>   	  pc = regcache_read_pc (get_thread_regcache (inferior_ptid));
>   
>   	  displaced = get_displaced_stepping_state (ptid_get_pid (inferior_ptid));
> -	  step = gdbarch_displaced_step_hw_singlestep (gdbarch,
> -						       displaced->step_closure);
> +
> +	  if (gdbarch_software_single_step_p (gdbarch))
> +	    {
> +	      VEC (CORE_ADDR) * next_pcs = NULL;

No need to initialize.

> +
> +	      next_pcs = gdbarch_software_single_step (gdbarch,
> +						       get_current_frame ());
> +
> +	      if (next_pcs != 0)

next_pcs != NULL.

Thanks,
Pedro Alves


  reply	other threads:[~2016-03-23 17:26 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-23 14:10 [PATCH 0/2] gdbarch software_single_step returns VEC (CORE_ADDR) * Yao Qi
2016-03-23 14:10 ` [PATCH 1/2] " Yao Qi
2016-03-23 17:25   ` Pedro Alves
2016-03-30 14:14     ` Yao Qi
2016-04-27 15:19       ` Pedro Alves
2016-04-29 14:48         ` Yao Qi
2016-05-02 10:21           ` Pedro Alves
2016-03-23 14:10 ` [PATCH 2/2] Remove gdbarch method displaced_step_hw_singlestep Yao Qi
2016-03-23 17:26   ` Pedro Alves [this message]
2016-05-09 11:05     ` Yao Qi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=56F2D1BF.5070005@redhat.com \
    --to=palves@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=qiyaoltc@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox