From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25031 invoked by alias); 28 Mar 2013 20:28:27 -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 25009 invoked by uid 89); 28 Mar 2013 20:28:17 -0000 X-Spam-SWARE-Status: No, score=-7.0 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,RCVD_IN_DNSWL_HI,RCVD_IN_HOSTKARMA_W,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.1 Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Thu, 28 Mar 2013 20:28:14 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r2SKSAZ9020975 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 28 Mar 2013 16:28:10 -0400 Received: from host2.jankratochvil.net (ovpn-116-39.ams2.redhat.com [10.36.116.39]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r2SKS5r9025436 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Thu, 28 Mar 2013 16:28:09 -0400 Date: Thu, 28 Mar 2013 23:02:00 -0000 From: Jan Kratochvil To: Aleksandar Ristovski Cc: "gdb-patches@sourceware.org" Subject: Re: [patch 4/6] Prepare linux_find_memory_regions_full & co. for move Message-ID: <20130328202805.GB9375@host2.jankratochvil.net> References: <51278984.3070208@qnx.com> <20130310210820.GE21130@host2.jankratochvil.net> <514C56CB.4070207@qnx.com> <20130326165242.GA12291@host2.jankratochvil.net> <515353C4.2050203@qnx.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <515353C4.2050203@qnx.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes X-SW-Source: 2013-03/txt/msg01075.txt.bz2 On Wed, 27 Mar 2013 21:17:08 +0100, Aleksandar Ristovski wrote: > --- a/gdb/target.c > +++ b/gdb/target.c [...] > @@ -3540,15 +3580,16 @@ target_fileio_read_alloc (const char *filename, gdb_byte **buf_p) > are returned as allocated but empty strings. A warning is issued > if the result contains any embedded NUL bytes. */ > > -char * > -target_fileio_read_stralloc (const char *filename) > +typedef LONGEST (read_stralloc_func_ftype) (const char *filename, > + gdb_byte **buf_p, int padding); > + > +static char * > +read_stralloc (const char *filename, read_stralloc_func_ftype *func) > { > - gdb_byte *buffer; > - char *bufstr; > + char *buffer; Why you make this change? That is unrelated to this patchset, it is a recent modification by Pedro. fad14e531 (Pedro Alves 2013-03-11 12:22:16 +0000 3546) gdb_byte *buffer; fad14e531 (Pedro Alves 2013-03-11 12:22:16 +0000 3547) char *bufstr; > LONGEST i, transferred; > > - transferred = target_fileio_read_alloc_1 (filename, &buffer, 1); > - bufstr = (char *) buffer; Likewise. I already replied to this change in: http://sourceware.org/ml/gdb-patches/2013-03/msg00965.html Message-ID: <20130326165242.GA12291@host2.jankratochvil.net> > + transferred = func (filename, (gdb_byte **) &buffer, 1); Likewise - the (gdb_byte **) cast. > > if (transferred < 0) > return NULL; > @@ -3556,11 +3597,11 @@ target_fileio_read_stralloc (const char *filename) > if (transferred == 0) > return xstrdup (""); > > - bufstr[transferred] = 0; > + buffer[transferred] = 0; > > /* Check for embedded NUL bytes; but allow trailing NULs. */ > - for (i = strlen (bufstr); i < transferred; i++) > - if (bufstr[i] != 0) > + for (i = strlen (buffer); i < transferred; i++) > + if (buffer[i] != 0) > { > warning (_("target file %s " > "contained unexpected null characters"), > @@ -3568,9 +3609,14 @@ target_fileio_read_stralloc (const char *filename) > break; > } > > - return bufstr; > + return buffer; > } > > +char * > +target_fileio_read_stralloc (const char *filename) > +{ > + return read_stralloc (filename, target_fileio_read_alloc_1); > +} > > static int > default_region_ok_for_hw_watchpoint (CORE_ADDR addr, int len) > -- > 1.7.10.4 > Otherwise OK for this part but it needs a new post, thanks for catching the xrealloc. Thanks, Jan