All of lore.kernel.org
 help / color / mirror / Atom feed
From: will.deacon@arm.com (Will Deacon)
To: linux-arm-kernel@lists.infradead.org
Subject: A issue about ptrace/SINGLESTEP on arm64
Date: Mon, 16 Oct 2017 16:30:56 +0100	[thread overview]
Message-ID: <20171016153055.GD10500@arm.com> (raw)
In-Reply-To: <8ad32f6b-e04d-98f8-d944-7ec3582fbdf4@huawei.com>

On Mon, Oct 16, 2017 at 12:27:17PM +0800, chengjian (D) wrote:
> Hi
> I write demo use ptrace/SINGLESTEP to count the number of instructions
> executed by the process
> The parent process fork+exec a child process, and trace(SINGLESTEP) it,
> 
> It works fine under the x86_64 architecture but has an exception under
> arm64.

My guess is that you are getting stuck in an LDXR/STXR loop, which cannot
be stepped. Can you jump the PC once the child appears to be "stuck"?

IIRC, GDB has special heuristics to step through LDXR/STXR critical
sections.

Will

WARNING: multiple messages have this Message-ID (diff)
From: Will Deacon <will.deacon@arm.com>
To: "chengjian (D)" <cj.chengjian@huawei.com>
Cc: catalin.marinas@arm.com, oleg@redhat.com, linux@armlinux.org.uk,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org,
	"Xiexiuqi (Xie XiuQi)" <xiexiuqi@huawei.com>,
	Li Bin <huawei.libin@huawei.com>
Subject: Re: A issue about ptrace/SINGLESTEP on arm64
Date: Mon, 16 Oct 2017 16:30:56 +0100	[thread overview]
Message-ID: <20171016153055.GD10500@arm.com> (raw)
In-Reply-To: <8ad32f6b-e04d-98f8-d944-7ec3582fbdf4@huawei.com>

On Mon, Oct 16, 2017 at 12:27:17PM +0800, chengjian (D) wrote:
> Hi
> I write demo use ptrace/SINGLESTEP to count the number of instructions
> executed by the process
> The parent process fork+exec a child process, and trace(SINGLESTEP) it,
> 
> It works fine under the x86_64 architecture but has an exception under
> arm64.

My guess is that you are getting stuck in an LDXR/STXR loop, which cannot
be stepped. Can you jump the PC once the child appears to be "stuck"?

IIRC, GDB has special heuristics to step through LDXR/STXR critical
sections.

Will

  reply	other threads:[~2017-10-16 15:30 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-16  4:27 A issue about ptrace/SINGLESTEP on arm64 chengjian (D)
2017-10-16  4:27 ` chengjian (D)
2017-10-16 15:30 ` Will Deacon [this message]
2017-10-16 15:30   ` Will Deacon
2017-10-17  2:04   ` chengjian (D)
2017-10-17  2:04     ` chengjian (D)
2017-10-17  9:23     ` Will Deacon
2017-10-17  9:23       ` Will Deacon

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=20171016153055.GD10500@arm.com \
    --to=will.deacon@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.