From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 62245 invoked by alias); 5 Jan 2016 15:55:59 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 61556 invoked by uid 89); 5 Jan 2016 15:55:59 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Tue, 05 Jan 2016 15:55:57 +0000 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (Postfix) with ESMTPS id 300E7C0A8058; Tue, 5 Jan 2016 15:55:56 +0000 (UTC) Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u05Ftsjv020335; Tue, 5 Jan 2016 10:55:55 -0500 Message-ID: <568BE78A.6010705@redhat.com> Date: Tue, 05 Jan 2016 15:55:00 -0000 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: Andrew Burgess , Joel Brobecker , Eli Zaretskii CC: gdb-patches@sourceware.org Subject: Re: [PATCH 1/3] gdb: New set/show max-value-size command. References: <57e2731e179d11c584e8cde994ab1e822a9893b0.1449869722.git.andrew.burgess@embecosm.com> <20160101094309.GC12416@adacore.com> <20160105141241.GG4242@embecosm.com> In-Reply-To: <20160105141241.GG4242@embecosm.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-SW-Source: 2016-01/txt/msg00055.txt.bz2 On 01/05/2016 02:12 PM, Andrew Burgess wrote: > +/* It is critical that the MAX_VALUE_SIZE is always greater than the size > + of LONGEST, otherwise GDB will not be able to parse integer values from > + the CLI; for example if the MAX_VALUE_SIZE could be set to 1 then GDB > + would be unable to parse "set max-value-size 2". > + > + As we want a consistent GDB experience across hosts with different sizes > + of LONGEST, this arbitrary minimum value was selected, so long as this > + is bigger than LONGEST of all GDB supported hosts we're fine. */ > + > +#define MIN_VALUE_FOR_MAX_VALUE_SIZE 16 > + > +/* Implement the "set max-value-size" command. */ > + > +static void > +set_max_value_size (char *args, int from_tty, > + struct cmd_list_element *c) > +{ > + gdb_assert (max_value_size == -1 || max_value_size >= 0); > + gdb_assert (sizeof (LONGEST) < MIN_VALUE_FOR_MAX_VALUE_SIZE); Make the second one a gdb_static_assert, and put it next to the MIN_VALUE_FOR_MAX_VALUE_SIZE definition. Thanks, Pedro Alves