From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21639 invoked by alias); 11 Apr 2014 16:36:54 -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 21627 invoked by uid 89); 11 Apr 2014 16:36:53 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.5 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 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 ESMTP; Fri, 11 Apr 2014 16:36:52 +0000 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s3BGap4j000478 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 11 Apr 2014 12:36:51 -0400 Received: from psique (ovpn-113-33.phx2.redhat.com [10.3.113.33]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id s3BGamvJ003767 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Fri, 11 Apr 2014 12:36:50 -0400 From: Sergio Durigan Junior To: "Vladimir Nikulichev" Cc: gdb-patches@sourceware.org Subject: Re: [PATCH] Disable check for NUL bytes in /proc/pid/cmdline References: X-URL: http://www.redhat.com Date: Fri, 11 Apr 2014 16:36:00 -0000 In-Reply-To: (Vladimir Nikulichev's message of "Fri, 11 Apr 2014 18:28:55 +0400") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-IsSubscribed: yes X-SW-Source: 2014-04/txt/msg00209.txt.bz2 On Friday, April 11 2014, Vladimir Nikulichev wrote: > When I execute gcore on a process, it prints warning that > /proc/pid/cmdline > contains null characters: > > $ gcore 18706 > [Thread debugging using libthread_db enabled] > Using host libthread_db library "/lib64/libthread_db.so.1". > 0x00007fa23be3c5c3 in __select_nocancel () from /lib64/libc.so.6 > warning: target file /proc/18706/cmdline contained unexpected null > characters > Saved corefile core.18706 > > There's nothing wrong, null characters separate command line arguments > from > each other. This fix disables the check when reading cmdline. Thanks for the patch. > index 1b48f79..e6f9c3c 100644 > --- a/gdb/target.c > +++ b/gdb/target.c > @@ -2895,7 +2895,7 @@ target_fileio_read_alloc (const char *filename, > gdb_byte **buf_p) > if the result contains any embedded NUL bytes. */ > > char * > -target_fileio_read_stralloc (const char *filename) > +target_fileio_read_stralloc (const char *filename, int check_null) > { Shouldn't this argument be named "check_nul", since we are talking about the NUL byte? > diff --git a/gdb/target.h b/gdb/target.h > index d7c6c3d..2d11a99 100644 > --- a/gdb/target.h > +++ b/gdb/target.h > @@ -1890,7 +1890,8 @@ extern LONGEST target_fileio_read_alloc (const > char *filename, > or the transfer is unsupported, NULL is returned. Empty objects > are returned as allocated but empty strings. A warning is issued > if the result contains any embedded NUL bytes. */ > -extern char *target_fileio_read_stralloc (const char *filename); > +extern char *target_fileio_read_stralloc (const char *filename, > + int check_null); The comment could be expanded to explain what "check_nul" does. Thanks, -- Sergio