From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1999 invoked by alias); 14 Sep 2012 16:30:59 -0000 Received: (qmail 1986 invoked by uid 22791); 14 Sep 2012 16:30:55 -0000 X-SWARE-Spam-Status: No, hits=-6.8 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,RCVD_IN_DNSWL_HI,RCVD_IN_HOSTKARMA_W,RP_MATCHES_RCVD,SPF_HELO_PASS X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 14 Sep 2012 16:30:41 +0000 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q8EGUdMn009721 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 14 Sep 2012 12:30:39 -0400 Received: from barimba (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id q8EGUb96004854 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Fri, 14 Sep 2012 12:30:37 -0400 From: Tom Tromey To: Giuseppe MONTALTO Cc: "Abid\, Hafiz" , "gdb-patches\@sourceware.org" Subject: Re: [PATCH] enhancement of mi_cmd_data_write_memory_bytes for filling memory regions (was [PATCH] new MI command for pattern filling of memory regions) References: <76FE3225DF13124EA2D05B290B624C95E65F2D466E@SAFEX1MAIL1.st.com> <87sjf9rzr0.fsf@fleche.redhat.com> <76FE3225DF13124EA2D05B290B624C95E65FECE356@SAFEX1MAIL1.st.com> <871umsqgu8.fsf@fleche.redhat.com> <76FE3225DF13124EA2D05B290B624C95E65FECE48F@SAFEX1MAIL1.st.com> <87397624b9.fsf@fleche.redhat.com> <76FE3225DF13124EA2D05B290B624C95E662A6921F@SAFEX1MAIL1.st.com> <76FE3225DF13124EA2D05B290B624C95E6632A4256@SAFEX1MAIL1.st.com> Date: Fri, 14 Sep 2012 16:30:00 -0000 In-Reply-To: <76FE3225DF13124EA2D05B290B624C95E6632A4256@SAFEX1MAIL1.st.com> (Giuseppe MONTALTO's message of "Tue, 12 Jun 2012 16:21:32 +0200") Message-ID: <878vcc1s9f.fsf@fleche.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain 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 X-SW-Source: 2012-09/txt/msg00288.txt.bz2 >>>>> "Giuseppe" == Giuseppe MONTALTO writes: Giuseppe> New version of the patch. I'm sorry about the delay on this. I know it feels uncomfortable, but it really is good to ping patches -- say every week or so. Otherwise they tend to slide off the radar. Giuseppe> + int len, r, i, steps, reminder; Giuseppe> + long int count, j; I think now size_t is preferred. (This changed since your patch submission.) Typo: should be "remainder", not "reminder". Giuseppe> + count = strtol (argv[2], NULL, 10); I think strtoul instead. Giuseppe> + if (len < count) Giuseppe> + { Giuseppe> + /* pattern is made of less bytes than count: Giuseppe> + repeat pattern to fill memory. */ Comments should start with an uppercase letter. Giuseppe> + else Giuseppe> + { Giuseppe> + /* pattern is longer than (or equal to) count: Giuseppe> + just copy len bytes. */ Likewise. Giuseppe> + xfree (databuf); It seems like you could do less work for the usual case where len==count. That is, avoid the extra malloc and memcpy. Giuseppe> +set testfile "mi-read-memory" Giuseppe> +set srcfile ${testfile}.c Giuseppe> +set binfile ${objdir}/${subdir}/${testfile} Use standard_testfile now. Giuseppe> +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-DFAKEARGV}] != "" } { Giuseppe> + untested mi-read-memory.exp Use build_executable instead and don't call untested. Giuseppe> +return 0 No need for a return at the end of a .exp file. Tom