From: timo.lindfors@iki.fi (Timo Juhani Lindfors)
To: linux-arm-kernel@lists.infradead.org
Subject: [RFC][PATCH] ARM: ptrace: remove single-step emulation code
Date: Mon, 24 Jan 2011 11:50:43 +0200 [thread overview]
Message-ID: <84r5c2hbpo.fsf@sauna.l.org> (raw)
In-Reply-To: <1295449635-4292-1-git-send-email-will.deacon@arm.com> (Will Deacon's message of "Wed\, 19 Jan 2011 15\:07\:15 +0000")
Will Deacon <will.deacon@arm.com> writes:
> We could try to fix this code, but it turns out that nobody uses it anyway.
Very few people use it since it does not work :-)
I tried to use PTRACE_SINGLESTEP on ARM last year but pretty soon
noticed that it doesn't work with user helpers. I sent a patch
http://lists.infradead.org/pipermail/linux-arm-kernel/2010-November/030832.html
and added ARM support to my really simple instruction level execution
tracing tool
http://iki.fi/lindi/git/itrace.git/
originally written mainly for my own debugging needs. The major
limitation of valgrind is that it can't attach to an already running
process and I guess it's too resource intensive to run my processes
constantly under valgrind on an embedded system.
I agree that decoding ARM instruction in kernel space is really
funky. Perhaps my best be would be to copy the old kernel code to my
own userland tool and use PTRACE_POKETEXT to set breakpoints? The only
drawbacks I see are:
1) I need more syscalls per instruction: PTRACE_GETREGS +
PTRACE_SINGLESTEP vs. PTRACE_GETREGS + PTRACE_PEEKTEXT +
PTRACE_POKETEXT * (number of potential branch targets) +
PTRACE_CONTINUE but I guess I can live with this.
2) itrace does not know where user helpers are. Parsing
/proc/config.gz at runtime for CONFIG_VECTORS_BASE is probably not a
good idea. If this location does not change often it is not a problem
to hardcode it in itrace.
> GDB, for example, uses PTRACE_POKETEXT and PTRACE_PEEKTEXT to manage
> breakpoints itself and does not require any kernel assistance.
I was going to say that GDB does not work either with user helpers but
it seems that in
commit 52d6c8167d4e91d89bc5c26cf0bacc2200272f96
Author: Julian Brown <julian@codesourcery.com>
Date: Thu Jul 30 23:05:00 2009 +0000
the function arm_catch_kernel_helper_return was added to GDB. They
hard code 0xffff0000 but I guess that is ok?
next prev parent reply other threads:[~2011-01-24 9:50 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-01-19 15:07 [RFC][PATCH] ARM: ptrace: remove single-step emulation code Will Deacon
2011-01-19 15:19 ` Russell King - ARM Linux
2011-01-19 15:37 ` Will Deacon
2011-01-19 22:06 ` Arnaud Patard (Rtp)
2011-01-20 9:23 ` Will Deacon
2011-01-24 9:50 ` Timo Juhani Lindfors [this message]
2011-01-24 16:18 ` 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=84r5c2hbpo.fsf@sauna.l.org \
--to=timo.lindfors@iki.fi \
--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.