From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19798 invoked by alias); 11 Apr 2014 18:18:25 -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 19785 invoked by uid 89); 11 Apr 2014 18:18:25 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 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 18:18:24 +0000 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s3BIINGF009215 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 11 Apr 2014 14:18:23 -0400 Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s3BIILCV021829; Fri, 11 Apr 2014 14:18:22 -0400 Message-ID: <534831EC.1050703@redhat.com> Date: Fri, 11 Apr 2014 18:18:00 -0000 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130625 Thunderbird/17.0.7 MIME-Version: 1.0 To: Vladimir Nikulichev CC: gdb-patches@sourceware.org Subject: Re: [PATCH] Disable check for NUL bytes in /proc/pid/cmdline References: In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-SW-Source: 2014-04/txt/msg00212.txt.bz2 On 04/11/2014 03:28 PM, 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. This also affects "info proc cmdline", which ignores all arguments but the first. Seems to me we should stop thinking of cmdline as a single string at all, thus read it with target_fileio_read_alloc as one block, and then "parsing" the result, extracting/printing all arguments. -- Pedro Alves