Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Daniel Berlin <dberlin@dberlin.org>
To: Jim Blandy <jimb@redhat.com>
Cc: gdb-patches@sources.redhat.com
Subject: Re: [RFA]: dwarf2expr.[ch]
Date: Wed, 10 Jul 2002 11:18:00 -0000	[thread overview]
Message-ID: <Pine.LNX.4.44.0207101343380.12859-100000@dberlin.org> (raw)
In-Reply-To: <npznx036c6.fsf@zwingli.cygnus.com>

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.


> > + 
> > + 	  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.


  parent reply	other threads:[~2002-07-10 18:01 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 [this message]
2002-07-10 12:48     ` Jim Blandy
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=Pine.LNX.4.44.0207101343380.12859-100000@dberlin.org \
    --to=dberlin@dberlin.org \
    --cc=gdb-patches@sources.redhat.com \
    --cc=jimb@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