public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
To: Yao Qi <yao@codesourcery.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [try 3rd] arm_pc_is_thumb takes displaced stepping into account
Date: Thu, 13 Jan 2011 15:55:00 -0000	[thread overview]
Message-ID: <1294931747.9907.137.camel@e102319-lin.cambridge.arm.com> (raw)
In-Reply-To: <4D2D27F2.7050303@codesourcery.com>

On Tue, 2011-01-11 at 22:02 -0600, Yao Qi wrote:
> On 12/23/2010 01:00 AM, Yao Qi wrote:
> > OK.  I have to try the second approach, which is 1) exposing displaced
> > stepping state to tdep, and 2) take displaced stepping state into
> > account when determining the mode.
> >
> 
> After talked with Ulrich, I realize that it is *not* a good idea to 
> expose displaced stepping outside of infrun, and my patch is a little 
> bit too intrusive.
> 
> > 2010-12-23  Yao Qi<yao@codesourcery.com>
> >
> > 	* arm-tdep.c: (arm_pc_is_thumb):  Adjust MEMADDR if it is within
> > 	copy area of displaced stepping.
> > 	* infrun.c (struct displaced_step_inferior_state): Move to ...
> > 	Expose get_displaced_stepping_state.
> > 	* inferior.h: ... here.
> > 	Declare get_displaced_stepping_state.
> 
> This time, instead of exposing displaced_step_inferior_state to tdep, we 
> return displaced_step_closure, which is defined by each tdep, instance 
> to tdep appropriately.
> 
> OK to mainline?

I agree with Ulrich, and prefer this latest patch to your previous ones
- but I am still not 100% happy with it, as I think it would be better
not to need anything from infrun.c at all here.

What could be done instead is to have the displaced stepping routines
maintain a list of the areas of memory that are being used as scratch
space, and the instruction set state of the instructions in those areas.

Then arm_pc_is_thumb should check this list to see if the PC falls into
one of these areas, and return the appropriate value.

This keeps these changes wholly within the ARM backend for GDB, and
doesn't require changes to GDB globally.

However, this will impact performance and memory more than your patch -
so I am not completely opposed to your patch.

This is yet another instance of a problem Ulrich and I discussed last
year, which is: How do you tell what instruction-set state you are in
when you just have a CORE_ADDR, which is insufficient information on
ARM.  See the thread starting at:
http://sourceware.org/ml/gdb-patches/2010-08/msg00271.html

The long-term solution is probably either to implement multiple address
spaces for code, or to treat ARM & Thumb as different gdbarch's and use
multiarch support.  However, this is a much more difficult problem to
solve in general and shouldn't stop this patch going in.

[Note again that I am not a maintainer and so do not have approval
rights].

Thanks,

Matt

-- 
Matthew Gretton-Dann
Principal Engineer - PDSW Tools
ARM Ltd


  reply	other threads:[~2011-01-13 15:16 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-20  7:50 [rfa] Update PC without side effect in displaced stepping Yao Qi
2010-12-20  8:06 ` Mark Kettenis
2010-12-20 13:42   ` Yao Qi
2010-12-21 16:19     ` Yao Qi
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 [this message]
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=1294931747.9907.137.camel@e102319-lin.cambridge.arm.com \
    --to=matthew.gretton-dann@arm.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).