From: "Ulrich Weigand" <uweigand@de.ibm.com>
To: xdje42@gmail.com (Doug Evans)
Cc: gdb-patches@sourceware.org
Subject: Re: Cell multi-arch type resolution broken (Re: [PATCH 5/6] [PR 17684] add support for primitive types as symbols)
Date: Mon, 31 Aug 2015 13:55:00 -0000 [thread overview]
Message-ID: <20150831135446.B63D68126@oc7340732750.ibm.com> (raw)
In-Reply-To: <m3oahoccuc.fsf@sspiff.org> from "Doug Evans" at Aug 30, 2015 09:15:55 PM
Doug Evans wrote:
> > I'd be ok with adding a gdbarch parameter to lookup_symbol,
> > and require at least one of block or gdbarch to be non-NULL.
> >
> > The symbol lookup code is a lot simpler when block == NULL,
> > and handling all the different cases in one set of functions
> > makes things more complex than they could otherwise be.
> > One might then split things up into two paths underneath
> > (one for block, one for arch).
>
> I went through and played with adding gdbarch to the
> symbol lookup routines. I pushed into some places that I didn't
> I need to, just to see the effect.
> I'll clean this up and resubmit in a bit.
Thanks!
> This patch also allows block == NULL and gdbarch == NULL
> in the call to lookup_symbol. Sometimes the caller doesn't have either
> one and doesn't need either one. I'd prefer something else though:
> It'd be cleaner to remove the choice and require the caller to use
> routines that are more explicit.
> Otherwise I suspect a subtle bug or two will creep in.
> [IOW, if the lookup may be for an arch-specific symbol (e.g., primitive type)
> then require the caller to use a routine that requires a non-NULL gdbarch.
> Internal to symtab.c we can do whatever we want though.]
Absolutely. I agree that it would be preferable to define the
interface so that if you want to enable looking up primitive types,
you need to pass in an gdbarch explicitly.
Conversely, many places know for sure they do not need primitive types
(e.g. because they are looking up a variable or function name, or they
are looking up some non-primitive type like a struct type), and those
should preferably pass in a NULL gdbarch. (Certainly preferable to
using some random arch from target_gdbarch or get_current_arch ...)
As an aside, I'm not really happy with the use of current_language
in lookup_symbol. Ideally, this is one more of those globals we'd
really better get rid of. (In particular, since many callers actually
do know which language they're operating on.)
I'd prefer an interface where lookup_symbol uses language_unknown,
i.e. does not perform any language-specific lookup (which should
actually be fine for many of the current users). If you do want
do perform language-specific lookup, you should pass in the language
explicitly.
(Just mentioning this now since you're already going through all
users :-))
> This patch also adds some const-correctness to gdbarch.*.
> [It'll get split out of course.]
This is just for the variable accessors and predicates, right?
I guess that makes sense. Not sure if it really makes much
of a difference since most callers will still need to call one
of the other routines ...
Bye,
Ulrich
--
Dr. Ulrich Weigand
GNU/Linux compilers and toolchain
Ulrich.Weigand@de.ibm.com
prev parent reply other threads:[~2015-08-31 13:55 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-18 12:29 [PATCH 5/6] [PR 17684] add support for primitive types as symbols Doug Evans
2015-08-27 13:53 ` Cell multi-arch type resolution broken (Re: [PATCH 5/6] [PR 17684] add support for primitive types as symbols) Ulrich Weigand
2015-08-30 21:04 ` Doug Evans
2015-08-31 4:17 ` Doug Evans
2015-08-31 13:55 ` Ulrich Weigand [this message]
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=20150831135446.B63D68126@oc7340732750.ibm.com \
--to=uweigand@de.ibm.com \
--cc=gdb-patches@sourceware.org \
--cc=xdje42@gmail.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