Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Sergio Durigan Junior <sergiodj@redhat.com>
To: "Vladimir Nikulichev" <nvs@tbricks.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH] Disable check for NUL bytes in /proc/pid/cmdline
Date: Fri, 11 Apr 2014 16:36:00 -0000	[thread overview]
Message-ID: <m34n1zu8kg.fsf@redhat.com> (raw)
In-Reply-To: <web-7508899@mx2.tbricks.com> (Vladimir Nikulichev's message of	"Fri, 11 Apr 2014 18:28:55 +0400")

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


  reply	other threads:[~2014-04-11 16:36 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-11 14:29 Vladimir Nikulichev
2014-04-11 16:36 ` Sergio Durigan Junior [this message]
2014-04-11 18:18 ` Pedro Alves

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m34n1zu8kg.fsf@redhat.com \
    --to=sergiodj@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=nvs@tbricks.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox