From: Michael Snyder <msnyder@redhat.com>
To: GDB Patches <gdb-patches@sources.redhat.com>
Subject: Re: [PATCH]: Don't use deprecated regcache functions
Date: Wed, 12 Apr 2006 19:25:00 -0000 [thread overview]
Message-ID: <443D540D.2050902@redhat.com> (raw)
In-Reply-To: <20060411.141334.116677120.davem@davemloft.net>
David S. Miller wrote:
> From: Daniel Jacobowitz <drow@false.org>
> Date: Tue, 11 Apr 2006 09:00:57 -0400
>
>
>>On Tue, Apr 11, 2006 at 01:39:09AM -0700, David S. Miller wrote:
>>
>>>Otherwise, ok to apply?
>>
>>>- deprecated_read_register_gen (regno, raw);
>>>+ regcache_raw_collect (current_regcache, regno, raw);
>>> thread_db_fetch_registers (-1);
>>> regcache_raw_supply (current_regcache, regno, raw);
>>
>>I might be mistaken, but what the heck does the call to
>>thread_db_fetch_registers accomplish? I think nothing.
Daniel, David's got the right of it.
> The solaris thread support does the same thing. And that code
> uses the more correct regcache_raw_collect() which is partly how
> I noticed this.
>
> What's happening here is that if we're only writing one register
> we make sure to read in all the other registers first, then we
> write the changing register back into the regcache.
>
> This is interrelated with another piece of gdb code history I
> was researching last night when I ran across this. Several
> platforms used to define CHILD_PREPARE_TO_STORE in order to
> deal with interfaces, such as some ptrace() variants, that can
> only set the whole set of registers at once.
>
> There are some really nasty cases on Sparc for example, say you
> want to write just the stack pointer. We obtain the local and
> in registers from the on-stack save area, so if we were not careful
> just changing the stack or the frame pointer would cause all of
> those other registers to change even though that is not what we
> intended. So to do it right, you have to read all the registers
> into the regcache, then modify the stack or frame pointer.
>
> This CHILD_PREPARE_TO_STORE macro would get invoked by the
> target_prepare_to_store(). If you look at the regcache code it always
> does a sequence like this:
>
> target_prepare_to_store ();
> memcpy (register_buffer (regcache, regnum), buf,
> regcache->descr->sizeof_register[regnum]);
> regcache->register_valid_p[regnum] = 1;
> target_store_registers (regnum);
>
> So, if necessary, target_prepare_to_store() would make sure the
> regcache was fully read in if not already, then it would be safe to
> write into the register cache.
>
> But it seems that Mark Kettenis has been trying to transition
> away from this deprecated scheme, and instead handle this issue
> inside of the store register methods of the individual targets
> and native support modules.
>
> In fact, the only platform defining CHILD_PREPARE_TO_STORE is
> GNU Hurd on x86, and probably that will eventually be eliminated
> as well, and along with it target_prepare_to_store() and all
> assosciated hooks.
>
> In any event, the code we are discussing here in the Linux thread_db
> code really is needed and it's related to the issues I've discussed
> above.
>
> So I think it's ok to apply this :-)
>
next prev parent reply other threads:[~2006-04-12 19:25 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-04-11 8:39 David S. Miller
2006-04-11 13:01 ` Daniel Jacobowitz
2006-04-11 21:13 ` David S. Miller
2006-04-12 19:25 ` Michael Snyder [this message]
2006-04-13 1:09 ` David S. Miller
2006-04-13 2:41 ` Michael Snyder
2006-04-13 4:05 ` David S. Miller
2006-04-13 18:58 ` Michael Snyder
2006-04-20 17:02 ` Daniel Jacobowitz
2006-05-05 22:43 ` David S. Miller
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=443D540D.2050902@redhat.com \
--to=msnyder@redhat.com \
--cc=gdb-patches@sources.redhat.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