From: Andrew Cagney <ac131313@cygnus.com>
To: gdb-patches@sources.redhat.com
Subject: [rfc/wip] More defensive gdbarch initialization
Date: Fri, 27 Jul 2001 15:50:00 -0000 [thread overview]
Message-ID: <3B61EFD6.1040900@cygnus.com> (raw)
Hello,
This is fallout from the sh-tdep.c bug Elena recently fixed.
I got curious as to how many multi-arch targets might unintentionally be
refering to the old ``current_gdbarch'' instead of the new gdbarch being
created.
For instance, code like:
set_gdbarch_double_bit (gdbarch, 8*TARGET_CHAR_BIT);
set_gdbarch_long_double_bit (gdbarch, 2*TARGET_DOUBLE_BIT);
would be wrong. TARGET_DOUBLE_BIT refers to the old
``current_gdbarch'''s double-bit and not ``gdbarch''. Did anyone
mention ``Macro's are bad, M'kay''?
So anyway, my idea was to, for the duration of the XXX_gdbarch_init()
call, invalidate ``current_gdbarch''. That way the target code couldn't
use it. The patch below is work-in-progress on that line.
The thing that makes this funny is that the first bug I found wasn't in
any target code. Rather it was in gdbarch.* proper. gdbarch_alloc()
contains:
gdbarch->long_long_bit = 2*TARGET_LONG_BIT;
gdbarch->long_double_bit = 2*TARGET_DOUBLE_BIT;
gdbarch->ptr_bit = TARGET_INT_BIT;
gdbarch->bfd_vma_bit = TARGET_ARCHITECTURE->bits_per_address;
Ulgh ...
You can expect some ``obvious fixes'' related to this over the next ew
days. I'll delay any decision to commit something like the change below
until after 5.1 has branched, it is proving a little too effective in
finding bugs :-)
Oh for the day when current_gdbarch isn't a global.
Andrew
From eliz@is.elta.co.il Sat Jul 28 00:31:00 2001
From: "Eli Zaretskii" <eliz@is.elta.co.il>
To: ac131313@cygnus.com
Cc: gdb-patches@sources.redhat.com
Subject: Re: [rfa] libgdb updates to doco
Date: Sat, 28 Jul 2001 00:31:00 -0000
Message-id: <1438-Sat28Jul2001103025+0300-eliz@is.elta.co.il>
References: <Pine.SUN.3.91.1010726095158.28739G-100000@is> <3B606479.2070205@cygnus.com> <5567-Fri27Jul2001123713+0300-eliz@is.elta.co.il> <3B61D09E.1000902@cygnus.com>
X-SW-Source: 2001-07/msg00685.html
Content-length: 635
> Date: Fri, 27 Jul 2001 16:35:42 -0400
> From: Andrew Cagney <ac131313@cygnus.com>
> >
> > How about documenting multi-arch so that I could understand how to
> > multi-arch a target without reading the code? ;-)
>
> Something based on:
>
> http://sources.redhat.com/gdb/papers/multi-arch/howto.html
That's just a cookbook. It's important to have that, but it is no
less important to understand how multi-arch works internally, to be
able to do something beyond blindly following the cookbook.
> still for the moment I'm just trying to fix bits of the documentation
> that are out-of-date or wrong :-)
Good plan, no doubt ;-)
next reply other threads:[~2001-07-27 15:50 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-07-27 15:50 Andrew Cagney [this message]
2001-07-29 12:29 ` Andrew Cagney
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=3B61EFD6.1040900@cygnus.com \
--to=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