From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.bob131.so (server2.bob131.so [128.199.153.143]) by sourceware.org (Postfix) with ESMTPS id 3A62D3864827 for ; Thu, 29 Jul 2021 14:28:05 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 3A62D3864827 Received: from internal.mail.bob131.so (localhost [127.0.0.1]) by mail.bob131.so (Postfix) with ESMTP id 6DBBD54769; Thu, 29 Jul 2021 14:28:02 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 mail.bob131.so 6DBBD54769 Date: Fri, 30 Jul 2021 00:28:00 +1000 From: George Barrett To: Simon Marchi , gdb-patches@sourceware.org Subject: Re: [PATCH v2] guile: fix make-value with pointer type Message-ID: References: <5d3cf5e9-41bc-4d69-35b2-73a1256028ed@polymtl.ca> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <5d3cf5e9-41bc-4d69-35b2-73a1256028ed@polymtl.ca> X-Spam-Status: No, score=-6.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Jul 2021 14:28:06 -0000 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.