public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Yao Qi <yao@codesourcery.com>
To: gdb-patches@sourceware.org
Subject: Re: [rfa] Update PC without side effect in displaced stepping
Date: Tue, 21 Dec 2010 16:19:00 -0000	[thread overview]
Message-ID: <4D10D377.8080100@codesourcery.com> (raw)
In-Reply-To: <4D0F5D36.2040909@codesourcery.com>

On 12/20/2010 09:42 PM, Yao Qi wrote:
> On 12/20/2010 04:04 PM, Mark Kettenis wrote:
>>
>> Sorry, no this isn't right.  On sparc and hppa for example, the
>> effects of write_pc() are needed here, since both the pc and the "next
>> pc" registers need to be updated to make sure all instructions in the
>> copy area get executed.
>>
> 
> I know very little on sparc and hppa.  Thanks for your explanation.

When writing the new patch, I re-consider this problem again.  GDB
doesn't support displaced stepping on sparc and hppa, so it is not
harmful to sparc and hppa when regcache_write_pc is replaced by
regcache_cooked_write_unsigned.
Currently, GDB supports displaced stepping on s390, rs6000 (including
ppc-linux, aix), i386, amd64 and arm.  AFAICS, this replacement in my
original patch is not harmful to these targets.

>> I think you'll have to make sure that if the displaced instructions
>> are Thumb instructions, the copy area gets properly marked as Thumb
>> such that write_pc() can do the right thing on arm as well.
> 
> That works.  If we do so, given an address of an instruction, we have to
> return the mode of original instruction in displaced stepping, and
> return real mode there otherwise.  However, current GDB dose not provide
> interfaces to target-dependent parts to query the state of displaced
> stepping.  Shall we refactor infrun.c a little bit to move some code to
> displace_step.[c|h], and expose them to target-dependent part?

My new patch is drafted in this way, but it looks not better than my
original one, because in my new patch, some state of displaced stepping
has to be exposed to arm-tdep.c in order to return the correct mode (ARM
or Thumb) according to the address of copy area.  Unless we make some
refactor to extract displaced stepping from infrun, this approach makes
code looks ugly.

Given my original patch is clean, and not harmful to existing targets
support displaced stepping, please consider my original patch again.
Comments on promising directions/approaches are welcome.

-- 
Yao (齐尧)

  reply	other threads:[~2010-12-21 16:19 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-20  7:50 Yao Qi
2010-12-20  8:06 ` Mark Kettenis
2010-12-20 13:42   ` Yao Qi
2010-12-21 16:19     ` Yao Qi [this message]
2010-12-23  4:54       ` Joel Brobecker
2010-12-23  8:45         ` Yao Qi
2011-01-06 14:19           ` [PING : rfa] " Yao Qi
2011-01-12  5:39           ` [try 3rd] arm_pc_is_thumb takes displaced stepping into account Yao Qi
2011-01-13 15:55             ` Matthew Gretton-Dann
2011-01-13 16:34               ` Yao Qi
2011-01-19 16:09             ` [Ping 1: try " Yao Qi
2011-01-30  3:21               ` [Ping 2: " Yao Qi
2011-01-31 15:40             ` [try " Ulrich Weigand
2011-02-10  6:42               ` Yao Qi
2011-02-15 21:15                 ` Ulrich Weigand
2010-12-23 12:04         ` [rfa] Update PC without side effect in displaced stepping Mark Kettenis

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=4D10D377.8080100@codesourcery.com \
    --to=yao@codesourcery.com \
    --cc=gdb-patches@sourceware.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).