From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 77909 invoked by alias); 26 Jun 2018 10:52:13 -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 77895 invoked by uid 89); 26 Jun 2018 10:52:13 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-2.8 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 spammy=experts, agent, HContent-Transfer-Encoding:8bit X-HELO: mx0a-001b2d01.pphosted.com Received: from mx0b-001b2d01.pphosted.com (HELO mx0a-001b2d01.pphosted.com) (148.163.158.5) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 26 Jun 2018 10:52:11 +0000 Received: from pps.filterd (m0098413.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w5QAmrpp046217 for ; Tue, 26 Jun 2018 06:52:10 -0400 Received: from e06smtp07.uk.ibm.com (e06smtp07.uk.ibm.com [195.75.94.103]) by mx0b-001b2d01.pphosted.com with ESMTP id 2juk02ttg4-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 26 Jun 2018 06:52:10 -0400 Received: from localhost by e06smtp07.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 26 Jun 2018 11:52:08 +0100 Received: from b06cxnps3074.portsmouth.uk.ibm.com (9.149.109.194) by e06smtp07.uk.ibm.com (192.168.101.137) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Tue, 26 Jun 2018 11:52:07 +0100 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w5QAq61S31195258 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 26 Jun 2018 10:52:06 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9A84F4C058; Tue, 26 Jun 2018 11:51:58 +0100 (BST) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8A5CD4C04E; Tue, 26 Jun 2018 11:51:58 +0100 (BST) Received: from oc3748833570.ibm.com (unknown [9.152.213.77]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 26 Jun 2018 11:51:58 +0100 (BST) Received: by oc3748833570.ibm.com (Postfix, from userid 1000) id A2B56D80279; Tue, 26 Jun 2018 12:52:05 +0200 (CEST) Subject: Re: [PATCH 3/4] Use get_remote_packet_size in download_tracepoint To: pedromfc@linux.vnet.ibm.com (Pedro Franco de Carvalho) Date: Tue, 26 Jun 2018 10:52:00 -0000 From: "Ulrich Weigand" Cc: gdb-patches@sourceware.org In-Reply-To: <878t72mvxo.fsf@linux.vnet.ibm.com> from "Pedro Franco de Carvalho" at Jun 25, 2018 05:51:31 PM MIME-Version: 1.0 x-cbid: 18062610-0028-0000-0000-000002D50897 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18062610-0029-0000-0000-0000238C6BBB Message-Id: <20180626105205.A2B56D80279@oc3748833570.ibm.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 8bit X-SW-Source: 2018-06/txt/msg00609.txt.bz2 Pedro Franco de Carvalho wrote: > Ulrich Weigand writes: > > > You know from the beginning that the agent expression will take > > (2 * aexpr->len) bytes, so it should be OK to only check this > > once, ahead of time. In fact, sending a partial agent expression > > seems to be worse than sending none, so if the agent expression > > is too long, I think it should be just omitted (and the user > > warned). > > I don't think a partial agent expression would be sent in this case, > since this is before the first putpkt is called in the function. But I > can still issue the warning and ignore the condition expression instead > of failing on the assertion. Otherwise I can check the size once and > call a gdb_assert if its too small, like the rest of the function. Which > is better? Ah, you right -- I missed that xsnprintf acually aborts. In this case, I agree that just checking once and assserting would be fine. > I am also assuming throughout this function that size_t and > gdb::char_vector::size_type are compatible (since buf.size () returns > the latter and xsnprintf takes a size_t). Is this ok? I'm not sure I fully understand the C++ standard on this question, but it seems a reasonable assumption to me. Maybe some of the C++ experts can chime in here? Bye, Ulrich -- Dr. Ulrich Weigand GNU/Linux compilers and toolchain Ulrich.Weigand@de.ibm.com