From: "Ulrich Weigand" <uweigand@de.ibm.com>
To: yao@codesourcery.com (Yao Qi)
Cc: gdb-patches@sourceware.org (gdb-patches@sourceware.org)
Subject: Re: [try 2nd 5/8] Displaced stepping for Thumb 32-bit insns
Date: Mon, 10 Oct 2011 14:39:00 -0000 [thread overview]
Message-ID: <201110101439.p9AEd1m3030933@d06av02.portsmouth.uk.ibm.com> (raw)
In-Reply-To: <4E924D2F.8020009@codesourcery.com> from "Yao Qi" at Oct 10, 2011 09:41:03 AM
Yao Qi wrote:
> I don't have much details on hand for problem #6, but I can explain
> problem #7 a little bit here. There are some kernel helpers on ARM in a
> high page (0xffffXXXX), and application can access them like this,
>
> (gdb) disassemble 0x400eaba4,+4
> Dump of assembler code from 0x400eaba4 to 0x400eaba8:
> => 0x400eaba4: sub pc, r0, #31
> End of assembler dump.
> (gdb) p/x $r0
> $2 = 0xffff0fff
>
> We have some bits in gdb to handle it
> (arm-linux-tdep.c:arm_catch_kernel_helper_return). The problem here is
> that when inferior stops at such high address, gdb stops stepping and
> inserts a step-resume breakpoint, as shown in this log below,
>
> displaced: stepping insn e240f01f at 40021ba4
> displaced: copying immediate ALU insn e240f01f
> displaced: read r0 value ffff0fff
> displaced: read r1 value 0d696914
> displaced: read r0 value ffff0fff
> displaced: read pc value 40021bac
> displaced: writing r0 value 40021bac
> displaced: writing r1 value ffff0fff
> displaced: writing insn e241001f at 000083ac
> displaced: copy 0x40021ba4->0x83ac: displaced: check mode of 40021ba4
> instead of 000083ac
> displaced: displaced pc to 0x83ac
> displaced: restored process 2067 0x83ac
> displaced: read r0 value ffff0fe0
> displaced: writing r0 value ffff0fff
> displaced: writing r1 value 0d696914
> displaced: writing pc ffff0fe0
> infrun: stop_pc = 0xffff0fe0
> infrun: stepped into undebuggable function
>
> Obviously, it is not what we want here. What we want here is to
> continue stepping, and then arm_catch_kernel_helper_return has the
> chance to handle PC at high address, and make everything correct.
I still don't quite understand what's wrong with the above sequence;
GDB displaced-stepped the "sub pc" command, recognized it was now in
an undebuggable function, and then inserted a step-resume breakpoint
to continue out of it. This should work just fine, and should in
fact work the same in ARM mode too ...
The special code in arm_catch_kernel_helper_return is only needed if
we actually step in code *in* the kernel helper (i.e. if we do a
"si" on the "sub pc", and then *another* "si"). If *that* happens,
we should run into arm_catch_kernel_helper_return -- b.t.w. it seems
this function is then not Thumb-safe:
dsc->modinsn[0] = 0xe59ef004; /* ldr pc, [lr, #4]. */
I guess this needs to check for Thumb mode and produce an appropiate
instruction in that case ...
Bye,
Ulrich
--
Dr. Ulrich Weigand
GNU Toolchain for Linux on System z and Cell BE
Ulrich.Weigand@de.ibm.com
next prev parent reply other threads:[~2011-10-10 14:39 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <201107151847.p6FIlJNm001180@d06av02.portsmouth.uk.ibm.com>
2011-08-06 4:32 ` Yao Qi
2011-08-09 18:46 ` Ulrich Weigand
2011-08-19 3:13 ` Yao Qi
2011-08-19 16:39 ` Ulrich Weigand
2011-08-30 15:53 ` Yao Qi
2011-09-14 14:25 ` Ulrich Weigand
2011-10-09 13:28 ` Yao Qi
2011-10-10 14:40 ` Ulrich Weigand
2011-10-10 1:41 ` Yao Qi
2011-10-10 14:39 ` Ulrich Weigand [this message]
2010-12-25 14:17 [patch 0/3] Displaced stepping for 16-bit Thumb instructions Yao Qi
2011-03-24 13:49 ` [try 2nd 0/8] Displaced stepping for " Yao Qi
2011-03-24 14:05 ` [try 2nd 5/8] Displaced stepping for Thumb 32-bit insns Yao Qi
2011-05-05 13:25 ` Yao Qi
2011-05-17 17:14 ` Ulrich Weigand
2011-05-23 11:32 ` Yao Qi
2011-05-27 22:11 ` Ulrich Weigand
2011-05-23 11:32 ` Yao Qi
2011-07-06 10:55 ` Yao Qi
2011-07-15 19:57 ` Ulrich Weigand
2011-07-18 9:26 ` 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=201110101439.p9AEd1m3030933@d06av02.portsmouth.uk.ibm.com \
--to=uweigand@de.ibm.com \
--cc=gdb-patches@sourceware.org \
--cc=yao@codesourcery.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