public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: George Barrett <bob@bob131.so>
To: Simon Marchi <simon.marchi@polymtl.ca>, gdb-patches@sourceware.org
Subject: Re: [PATCH v2] guile: fix make-value with pointer type
Date: Fri, 30 Jul 2021 00:28:00 +1000	[thread overview]
Message-ID: <zk9gsho&m-arkaxlyvxg5w2&nb.2kj_lcbaqzk.tij&r9zubfwd0@mail.bob131.so> (raw)
In-Reply-To: <5d3cf5e9-41bc-4d69-35b2-73a1256028ed@polymtl.ca>

On Wed, Jul 28, 2021 at 10:07:26PM -0400, Simon Marchi wrote:
> On 2021-06-06 3:56 p.m., George Barrett via Gdb-patches wrote:
> > @@ -1931,6 +1931,22 @@ get_signed_type_minmax (struct type *type, LONGEST *min, LONGEST *max)
> >    *max = ((ULONGEST) 1 << (n - 1)) - 1;
> >  }
> >  
> > +/* Store in *MAX the largest value representable by pointer type
> > +   TYPE. */
> > +
> > +void
> > +get_pointer_type_max (struct type *type, CORE_ADDR *max)
> > +{
> 
> Let's use the function's return value to return the max:
> 
>   CORE_ADDR
>   get_pointer_type_max (struct type *type)
> 
> I'd suggest changing get_unsigned_type_max the same way, as a separate
> patch.

Ack.

> > @@ -558,6 +557,21 @@ vlscm_convert_typed_number (const char *func_name, int obj_arg_pos, SCM obj,
> >  	  return value_from_longest (type, gdbscm_scm_to_longest (obj));
> >  	}
> >      }
> > +  else if (type->code () == TYPE_CODE_PTR)
> > +    {
> > +      CORE_ADDR max;
> > +
> > +      get_pointer_type_max (type, &max);
> > +      if (!scm_is_unsigned_integer (obj, 0, max))
> > +	{
> > +	  *except_scmp
> > +	    = gdbscm_make_out_of_range_error (func_name,
> > +					      obj_arg_pos, obj,
> > +					_("value out of range for type"));
> 
> The indentaion of that last line is not correct, but I see that you just
> copied the code above.  Can you make a follow-patch to fix them all?  In
> this case, I would typically do:
> 
> 	  *except_scmp
> 	    = gdbscm_make_out_of_range_error
> 		(func_name, obj_arg_pos, obj, _("value out of range for type"));

So leave the indentation in the patch as-is, but have a follow-up patch fixing
both? Alright.

Thanks.

  reply	other threads:[~2021-07-29 14:28 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-06 19:56 George Barrett
2021-07-28 23:24 ` [PING] " George Barrett
2021-07-29  2:07 ` Simon Marchi
2021-07-29 14:28   ` George Barrett [this message]
2021-07-29 15:11     ` Simon Marchi

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='zk9gsho&m-arkaxlyvxg5w2&nb.2kj_lcbaqzk.tij&r9zubfwd0@mail.bob131.so' \
    --to=bob@bob131.so \
    --cc=gdb-patches@sourceware.org \
    --cc=simon.marchi@polymtl.ca \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).