This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] Disable check for NUL bytes in /proc/pid/cmdline
- From: Pedro Alves <palves at redhat dot com>
- To: Vladimir Nikulichev <nvs at tbricks dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Fri, 11 Apr 2014 19:18:20 +0100
- Subject: Re: [PATCH] Disable check for NUL bytes in /proc/pid/cmdline
- Authentication-results: sourceware.org; auth=none
- References: <web-7508899 at mx2 dot tbricks dot com>
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