From: Jim Blandy <jimb@redhat.com>
To: Daniel Berlin <dberlin@dberlin.org>
Cc: gdb-patches@sources.redhat.com
Subject: Re: [RFA]: dwarf2expr.[ch]
Date: Wed, 10 Jul 2002 12:48:00 -0000 [thread overview]
Message-ID: <nphej7xtef.fsf@zwingli.cygnus.com> (raw)
In-Reply-To: <Pine.LNX.4.44.0207101343380.12859-100000@dberlin.org>
Daniel Berlin <dberlin@dberlin.org> writes:
> Just some questions and statements:
> > > + return ctx->stack[ctx->stack_len - (1+n)];
> > > +
> > > + }
> >
> > This should check for underflow, too. Look at what DW_OP_rot will do
> > on an empty stack.
> It does.
> Look at the lines above it.
> (Yours won't have internal_error, just (ctx->error))
> if (ctx->stack_len < n)
> internal_error (__FILE__, __LINE__, "Asked for position %d of stack,
> stack only has %d elements on it\n",
> n, ctx->stack_len);
>
> If you ask for one item, and the stack has 0, this will catch it.
You're right, it does. I misread 'n' as indexing from bottom to top,
not top to bottom.
> > > +
> > > + switch (op)
> > > + {
> > > + case DW_OP_deref:
> > > + {
> > > + result = (CORE_ADDR)
> > > + (ctx->read_mem) (ctx->read_mem_baton,
> > > + result,
> > > + TARGET_PTR_BIT / TARGET_CHAR_BIT);
> >
> > Since CORE_ADDR may be wider than the target's address,
> > I think this
> > should mask off and/or sign extend as appropriate, depending on the
> > current gdbarch. Same anywhere we call ctx->read_mem, I think.
> Shouldn't the read_mem function do this for us?
> read_mem is returning a CORE_ADDR (the cast is pointless, i'll remove
> it) anyway, so it would seem to be *it's* job to make sure the
> CORE_ADDR it gives us is the right thing.
I'm worried about about strange addresses being produced because the
evaluator is using stack elements wider than officially specified.
Since the evaluator is the source of the behavior I'm concerned about,
I think it's better to correct it there than to require the
surrounding code in GDB to cope with it.
You're going to need a truncation function for all the operations that
are sensitive to the upper bits anyway (divide, shift right, compare),
so it doesn't seem a big deal to drop in an application here, too.
next prev parent reply other threads:[~2002-07-10 19:41 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-07-08 16:48 Daniel Berlin
2002-07-08 20:20 ` Andrew Cagney
2002-07-08 20:49 ` Daniel Berlin
2002-07-08 21:12 ` Andrew Cagney
2002-07-09 15:21 ` Jim Blandy
2002-07-10 9:05 ` Andrew Cagney
2002-07-09 15:10 ` Jim Blandy
2002-07-09 16:00 ` Daniel Berlin
2002-07-10 11:18 ` Daniel Berlin
2002-07-10 12:48 ` Jim Blandy [this message]
2002-07-10 13:27 ` Daniel Berlin
2002-07-10 16:15 ` Jim Blandy
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=nphej7xtef.fsf@zwingli.cygnus.com \
--to=jimb@redhat.com \
--cc=dberlin@dberlin.org \
--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