This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: [patch:rfc] Invalidate ``current_gdbarch'' when createing a new
- From: Andrew Cagney <ac131313 at cygnus dot com>
- To: Andrew Cagney <ac131313 at cygnus dot com>
- Cc: gdb-patches at sources dot redhat dot com
- Date: Wed, 01 May 2002 18:05:00 -0400
- Subject: Re: [patch:rfc] Invalidate ``current_gdbarch'' when createing a new
- References: <3CC2355E.5000906@cygnus.com>
FYI,
> 2002-04-20 Andrew Cagney <ac131313@redhat.com>
>
> * gdbarch.sh (gdbarch_update_p): Swap out the old architecture
> before probing for a new one. Detect errorenous gdbarch_init
> functions.
> * gdbarch.c: Regenerate.
>
I've checked this in. If there is a mysterious core dump in gdbarch.c,
suspect this .....
Andrew
> Hello,
>
> The attached follows up the threads:
>
> [rfc] Swap out current when creating a new architecture
> http://sources.redhat.com/ml/gdb-patches/2001-09/msg00342.html
> http://sources.redhat.com/ml/gdb-patches/2001-10/msg00001.html
> and
>
> [rfc] Sort architectures M.R.U.; Was: swap out current when ...
> http://sources.redhat.com/ml/gdb-patches/2002-04/msg00609.html
>
> The original description is appended.
>
> With the attached patch (and the two just posted fixes) applied, I was able to rebuild and start all the GDB targets.
>
> Hopefully this can go in towards the end of the week.
>
> enjoy,
> Andrew
>
>
> 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?
> Andrew
>
>