From: David Carlton <carlton@math.stanford.edu>
To: Daniel Jacobowitz <drow@mvista.com>
Cc: gdb <gdb@sources.redhat.com>
Subject: Re: struct environment
Date: Tue, 10 Sep 2002 17:25:00 -0000 [thread overview]
Message-ID: <ro1n0qp8j8r.fsf@jackfruit.Stanford.EDU> (raw)
In-Reply-To: <20020906150620.GA19200@nevyn.them.org>
On Fri, 6 Sep 2002 11:06:20 -0400, Daniel Jacobowitz <drow@mvista.com> said:
> On Thu, Sep 05, 2002 at 01:50:40PM -0700, David Carlton wrote:
>> * There should be a shallow lookup function, i.e. one that looks up a
>> symbol just in one environment, without going up to a parent
>> environment. (The latter will get added in once we get to
>> converting over the global environment.) Maybe
>>
>> struct symbol *env_lookup_shallow(struct environment *,
>> const char *);
> You may need more information than this. Sometimes
> lookup_block_symbol needs to look up the symbol (i.e. demangled)
> which has a particular mangled name - this is a wart and not one I'm
> fond of but it isn't quite ready to die yet.
Fair enough; for now, that function has the exact same arguments as
lookup_block_symbol (i.e. including the demangled name and the
namespace).
But, speaking of warts in lookup_block_symbol, what's going on with
this code?
/* If SYM has aliases, then use any alias that is active
at the current PC. If no alias is active at the current
PC, then use the main symbol.
?!? Is checking the current pc correct? Is this routine
ever called to look up a symbol from another context?
FIXME: No, it's not correct. If someone sets a
conditional breakpoint at an address, then the
breakpoint's `struct expression' should refer to the
`struct symbol' appropriate for the breakpoint's
address, which may not be the PC.
Even if it were never called from another context,
it's totally bizarre for lookup_symbol's behavior to
depend on the value of the inferior's current PC. We
should pass in the appropriate PC as well as the
block. The interface to lookup_symbol should change
to require the caller to provide a PC. */
if (SYMBOL_ALIASES (sym))
sym = find_active_alias (sym, read_pc ());
sym_found = sym;
if (SYMBOL_CLASS (sym) != LOC_ARG &&
SYMBOL_CLASS (sym) != LOC_LOCAL_ARG &&
SYMBOL_CLASS (sym) != LOC_REF_ARG &&
SYMBOL_CLASS (sym) != LOC_REGPARM &&
SYMBOL_CLASS (sym) != LOC_REGPARM_ADDR &&
SYMBOL_CLASS (sym) != LOC_BASEREG_ARG)
{
break;
}
Is the SYMBOL_ALIASES bit some sort of stabs mess? And is that if
expression an attempt to make sure that function arguments whose names
are shadowed by local variables don't get returned?
For now, I'm planning just to copy all that to env_lookup_shallow, but
I do wish I understood a little better what it's doing.
David Carlton
carlton@math.stanford.edu
next prev parent reply other threads:[~2002-09-11 0:25 UTC|newest]
Thread overview: 49+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-09-05 13:50 David Carlton
2002-09-06 8:06 ` Daniel Jacobowitz
2002-09-06 10:20 ` David Carlton
2002-09-06 10:57 ` Daniel Jacobowitz
2002-09-06 11:56 ` David Carlton
2002-09-06 12:34 ` Daniel Berlin
2002-09-06 12:41 ` Daniel Jacobowitz
2002-09-06 12:55 ` Daniel Berlin
2002-09-11 11:33 ` David Carlton
2002-09-11 11:36 ` Daniel Jacobowitz
2002-09-11 12:27 ` David Carlton
2002-09-06 14:43 ` David Carlton
2002-09-06 14:46 ` Daniel Jacobowitz
2002-09-06 14:57 ` mdebugread.c (was Re: struct environment) David Carlton
2002-09-06 15:35 ` Daniel Jacobowitz
2002-09-10 17:25 ` David Carlton [this message]
2002-09-10 17:31 ` struct environment Daniel Jacobowitz
2002-09-11 10:29 ` David Carlton
2002-09-11 10:55 ` Daniel Jacobowitz
2002-09-11 12:33 ` Daniel Berlin
2002-09-10 17:36 ` David Carlton
2002-09-16 22:03 ` Andrew Cagney
2002-09-06 15:00 ` David Carlton
2002-09-06 16:37 ` Tom Tromey
2002-09-06 17:19 ` David Carlton
2002-09-07 10:26 ` Per Bothner
2002-09-07 10:32 ` Daniel Jacobowitz
2002-09-09 11:18 ` David Carlton
2002-09-12 12:26 ` Andrew Cagney
2002-09-13 9:44 ` David Carlton
2002-09-17 0:48 ` Andrew Cagney
2002-09-17 6:41 ` Daniel Jacobowitz
2002-09-17 8:59 ` Andrew Cagney
2002-09-17 9:07 ` Daniel Jacobowitz
2002-09-17 10:54 ` Andrew Cagney
2002-09-17 11:02 ` Daniel Jacobowitz
2002-09-17 12:37 ` Andrew Cagney
2002-09-17 12:41 ` Daniel Jacobowitz
2002-09-18 8:13 ` Andrew Cagney
2002-09-17 12:52 ` Daniel Berlin
2002-09-17 13:34 ` Daniel Jacobowitz
2002-09-17 21:51 ` Daniel Berlin
2002-09-18 7:26 ` Daniel Jacobowitz
2002-09-18 9:08 ` David Carlton
2002-09-17 12:18 ` David Carlton
2002-09-17 10:29 ` David Carlton
2002-09-17 12:50 ` Daniel Berlin
2002-09-17 13:24 ` David Carlton
2002-09-18 22:26 ` Eli Zaretskii
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=ro1n0qp8j8r.fsf@jackfruit.Stanford.EDU \
--to=carlton@math.stanford.edu \
--cc=drow@mvista.com \
--cc=gdb@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