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: Wed, 14 Sep 2011 14:25:00 -0000 [thread overview]
Message-ID: <201109141339.p8EDddLk024568@d06av02.portsmouth.uk.ibm.com> (raw)
In-Reply-To: <4E5D0705.7020504@codesourcery.com> from "Yao Qi" at Aug 30, 2011 11:51:33 PM
Yao Qi wrote:
> Yes, I run gdb testsuite with can_use_displaced_stepping set to
> can_use_displaced_stepping_on, and it does expose more problems in
> current patches.
OK, thanks for verifying!
> Three patches attached here to address these problems
> found so far. I don't combine them into one patch, because they belongs
> to different groups (thumb 16bit, thumb 32bit).
The three patches look good to me.
> After applied these three patches, there are still some failures, which
> are caused by some reasons, so these three patches here can be regarded
> as WIP patches.
>
> 1. Failures in gdb.arch/thumb2-it.exp and gdb.base/gdb1555.exp.
> These failures are caused by missing IT support in thumb displaced stepping.
Ah, right. Fortunately, I think IT support should be relatively easy to
add, in fact we should be able to just completely emulate it:
- The first thing we do when we're about to displaced-step a Thumb insn
is to check the itstate and see whether we're in an IT block.
- If so, we check whether the condition is true, given the current state
of the flags.
- If the condition is false, we always use a NOP as the displaced
instruction; otherwise, compute the displaced instruction as usual.
- In either case, set the CSPR register as if we're outside of any
IT block while actually executing the displaced instruction. (This
also makes sure that the breakpoint at the end will always be
executed.)
- During fixup after execution is done, re-set IT state in the CSPR
to the proper value (advanced by one instruction).
See also thumb_get_next_pc_raw for how to manipulate IT state ...
Does this look good to you?
> 2. Failures in gdb.base/break-interp.exp and gdb.base/nostdlib.exp.
> They are appeared on i686-pc-linux-gnu as well.
>
> 3. Failures (timeout) in gdb.base/sigstep.exp. IIUC, it is
> incorrect to displaced step instructions in signal handler, so failures
> are expected.
>
> 4. Failures in gdb.base/watch-vfork.exp. Displaced stepping is not
> completed due to a VFORK event. Current displaced stepping
> infrastructure or infrun logic doesn't consider the case that executing
> instruction in scratch can be "interrupted". When displaced stepping an
> vfork syscall, VFORK event comes out earlier than TRAP event. GDB will
> be confused.
>
> 5. Timeout failures in gdb.threads/*.exp. Similarly to #4, when
> execution instructions in scratch, thread context switch may happen, and
> GDB will be confused as well. #4 and #5 are not arm-specific problem.
So these are apparently all common-code problems. While those ought to
be fixed, of course, IMO they should not prevent the ARM support patches
from going forward at this point ...
> 6. Failures in gdb.base/watchpoint-solib.exp gdb.mi/mi-simplerun.exp.
> They are caused by displaced stepping instruction `mov r12, #imm`.
> This instruction should be unmodified-copied to scratch, and execute,
> but experiment shows we can't. I have a local patch that can control
> displaced stepping on instructions' level. Once I turn it on for `mov
> r12, #imm`, these tests will fail. The reason is still unknown to me.
>
> 7. Accessing some high addresses. Some instructions (alu_imm) may
> set PC to a hight address, such as 0xffffxxxx, and displaced stepping of
> this kind instruction should be handled differently.
I'm afraid I don't quite understand those last two points. Could you
elaborate what exactly is going wrong?
> If my analysis above makes sense and is correct, we still have to fix #1
> at least, to make displaced stepping really works. On the other hand,
> if current patches can be approved, I am happy as well, and can carry
> less local patches to move on. :)
Agreed, I think we should fix IT support before the patches go in.
> gdb/
> * arm-tdep.c (thumb_copy_b): Extract correct offset.
> (thumb_copy_16bit_ldr_literal): Extract correct value for rt and imm8.
> Set pc 4-byte aligned.
> Set branch dest address correctly.
The last line refers to thumb_copy_cbnz_cbz, I think.
> + fprintf_unfiltered (gdb_stdlog,
> + "displaced: copying thumb ldr r%d [pc #%d]\n"
> + , rt, imm8);
Comma at the end of the previous line, please.
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-09-14 13:40 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 [this message]
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
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=201109141339.p8EDddLk024568@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