Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Kevin Buettner <kevinb@cygnus.com>
To: Andrew Cagney <ac131313@cygnus.com>, gdb-patches@sources.redhat.com
Subject: Re: [rfc] Swap out current when creating a new architecture
Date: Wed, 26 Sep 2001 22:56:00 -0000	[thread overview]
Message-ID: <1010927055546.ZM3074@ocotillo.lan> (raw)
In-Reply-To: <3BB16441.30805@cygnus.com>

On Sep 26,  1:14am, Andrew Cagney wrote:

> The attached changes the run-time environment within which a new 
> architectures are created.  Briefly the simplified sequence:
> 
> - call XXX_gdbarch_init()
> - swap out old architecture
> - install new architecture
> 
> is changed to:
> 
> - swap out old architecture
> - call XX_gdbarch_init()
> - install new architecture
> 
> This has the effect of making current_gdbarch invalid for the lifetime 
> of the XXX_gdbarch_init() call.
> 
> The motivation behind this change is to stop XXXX_gdbarch_init() 
> functions refering (unintentionally I suspect) to the previous 
> architecture.  I think it is proving effective since it has so far 
> flushed out two bugs.
> 
> I can think of one additional tweek: add a ``gdb_assert (gdbarch != 
> NULL)'' to each architecture method.  Without it a XXX_gdbarch_init() 
> function that tries to use current_gdbarch will dump core :-/
> 
> thoughts?

I've read your patch and it looks okay to me.

I'm wondering though if it might be possible to set current_gdbarch
to the architecture currently getting defined.  This way, it would
be possible to do things like:

    gdbarch->target_long_bit = 8;
    gdbarch->target_long_long_bit = 2*TARGET_LONG_BIT;

It seems to me that the trick is to figure out a clean way to
set it.  It occurred to me that it could be set in gdbarch_alloc(),
but that doesn't really seem too clean... The only other thing I
can think of is to have (the various) <arch>_gdbarch_init() make
an explicit call which'd cause current_gdbarch to be set.  After
that, the <arch>_gdbarch_init() could refer to TARGET_LONG_BIT, etc.
if they wanted to.  Such a call would be optional; if this call
isn't made, then it's not permissible to refer to the macros...

My other thought on this matter is that all of what I just said
is complete nonsense and that we're better off with current_gdbarch
being NULL to avoid referring to a partially defined architecture...
if that's the case, then adding a NULL check to each architecture
method would indeed be a good thing.

Kevin


       reply	other threads:[~2001-09-26 22:56 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <3BB16441.30805@cygnus.com>
2001-09-26 22:56 ` Kevin Buettner [this message]
2001-09-26 23:06   ` Andrew Cagney
2001-09-30 12:25 ` Andrew Cagney
2001-10-01  4:34   ` Orjan Friberg
2001-10-14 17:07     ` Andrew Cagney
2001-10-15 18:41       ` Andrew Cagney
2001-10-16  1:59         ` Orjan Friberg

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=1010927055546.ZM3074@ocotillo.lan \
    --to=kevinb@cygnus.com \
    --cc=ac131313@cygnus.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