Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Yao Qi <yao@codesourcery.com>
To: Ulrich Weigand <uweigand@de.ibm.com>
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 01:41:00 -0000	[thread overview]
Message-ID: <4E924D2F.8020009@codesourcery.com> (raw)
In-Reply-To: <201109141339.p8EDddLk024568@d06av02.portsmouth.uk.ibm.com>

On 09/14/2011 09:39 PM, Ulrich Weigand wrote:
>> >    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?
> 

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.

-- 
Yao (齐尧)


  parent reply	other threads:[~2011-10-10  1:41 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 [this message]
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=4E924D2F.8020009@codesourcery.com \
    --to=yao@codesourcery.com \
    --cc=gdb-patches@sourceware.org \
    --cc=uweigand@de.ibm.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