From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4936 invoked by alias); 28 Mar 2013 20:56:38 -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 4535 invoked by uid 89); 28 Mar 2013 20:56:31 -0000 X-Spam-SWARE-Status: No, score=-4.5 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,KHOP_THREADED,RCVD_IN_HOSTKARMA_W,RCVD_IN_HOSTKARMA_WL autolearn=ham version=3.3.1 Received: from na3sys009aog116.obsmtp.com (HELO na3sys009aog116.obsmtp.com) (74.125.149.240) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Thu, 28 Mar 2013 20:56:28 +0000 Received: from mx20.qnx.com ([72.1.200.103]) (using TLSv1) by na3sys009aob116.postini.com ([74.125.148.12]) with SMTP ID DSNKUVSudu4cbXxmouvBHxN02djK9s+bIH4k@postini.com; Thu, 28 Mar 2013 13:56:28 PDT Received: by mx20.qnx.com (Postfix, from userid 500) id E5838210FC; Thu, 28 Mar 2013 16:56:21 -0400 (EDT) Received: from exhts.ott.qnx.com (exch1 [10.222.2.137]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by mx20.qnx.com (Postfix) with ESMTPS id A1E3720E2D; Thu, 28 Mar 2013 16:56:21 -0400 (EDT) Received: from [10.222.96.215] (10.222.2.5) by EXCH1.ott.qnx.com (10.222.2.137) with Microsoft SMTP Server (TLS) id 14.2.318.4; Thu, 28 Mar 2013 16:56:21 -0400 Message-ID: <5154AE75.4050103@qnx.com> Date: Fri, 29 Mar 2013 00:26:00 -0000 From: Aleksandar Ristovski User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130308 Thunderbird/17.0.4 MIME-Version: 1.0 To: Jan Kratochvil CC: "gdb-patches@sourceware.org" , Pedro Alves Subject: Re: [patch 4/6] Prepare linux_find_memory_regions_full & co. for move References: <51278984.3070208@qnx.com> <20130310210820.GE21130@host2.jankratochvil.net> <514C56CB.4070207@qnx.com> <20130326165242.GA12291@host2.jankratochvil.net> <515353C4.2050203@qnx.com> <20130328202805.GB9375@host2.jankratochvil.net> In-Reply-To: <20130328202805.GB9375@host2.jankratochvil.net> Content-Type: text/plain; charset="ISO-8859-1"; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2013-03/txt/msg01079.txt.bz2 On 13-03-28 04:28 PM, Jan Kratochvil wrote: > 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. [AR] I apologize to Pedro - the code as I put it seems more natural, a few less lines and such. But I can remove it, it is not essential. > > 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. [AR] Thanks. I will repost the patch. > > > Thanks, > Jan >