From: Yao Qi <yao@codesourcery.com>
To: Will Huang <will.huang@aliyun-inc.com>
Cc: <gdb-patches@sourceware.org>
Subject: Re: [PATCH][PR threads/15824] when get threads name failed from info threads with linux kernel version earlier than 2.6.33
Date: Fri, 16 Aug 2013 11:29:00 -0000 [thread overview]
Message-ID: <520E0CFB.9010203@codesourcery.com> (raw)
In-Reply-To: <01a201ce9a6a$74436db0$5cca4910$@huang@aliyun-inc.com>
On 08/16/2013 06:22 PM, Will Huang wrote:
> Sorry for mistakes. There is no gdb_fopen_cloexec in gdb-7.6. Except that all comments are accepted.
>
Are you proposing a patch for GDB 7.6 tree only? This problem exists
on mainline too. We post patch for mainline, and backport the patch to
internal tree or older tree.
> +
> +static int
> +linux_proc_get_string (pid_t lwpid, pid_t tid, char *target,
> + size_t t_size, const char *field)
> +{
> + size_t field_len = strlen (field);
> + FILE *status_file;
> + char buf[100];
> + int retval = -1;
> +
> + if (tid > 0)
> + xsnprintf (buf, sizeof (buf), "/proc/%d/task/%d/status",
> + (int) lwpid, (int) tid);
> + else
> + {
> + /*if TID is zero, ingnore it*/
/* If TID is zero, ignore it. */
> + xsnprintf (buf, sizeof (buf), "/proc/%d/status", (int) lwpid);
> + }
> +
> + status_file = fopen (buf, "r");
> + if (status_file == NULL)
> + {
> + warning (_("unable to open /proc file '%s'"), buf);
> + return -1;
> + }
> +
> + while (fgets (buf, sizeof (buf), status_file))
> + if (strncmp (buf, field, field_len) == 0 && buf[field_len] == ':')
> + {
> + size_t pos = field_len + 1;
Blank line is needed here.
> diff -ruN ./gdb.org/linux-nat.c ./gdb/linux-nat.c
> --- ./gdb.org/linux-nat.c 2013-02-13 22:59:49.000000000 +0800
> +++ ./gdb/linux-nat.c 2013-08-16 17:55:19.000000000 +0800
> @@ -4294,6 +4294,15 @@
>
> fclose (comm_file);
> }
> + else
> + {
> + static char comm[COMM_LEN + 1];
> + int size = linux_proc_get_thread_name ((pid_t) pid, (pid_t) lwp, comm, COMM_LEN + 1);
This line is too long.
Otherwise, I don't have comments to this patch.
--
Yao (é½å°§)
next prev parent reply other threads:[~2013-08-16 11:29 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-14 4:27 Will Huang
2013-08-16 2:26 ` Yao Qi
2013-08-16 5:32 ` Will Huang
2013-08-16 9:38 ` Yao Qi
2013-08-16 10:22 ` Will Huang
2013-08-16 11:29 ` Yao Qi [this message]
2013-08-16 16:24 ` Pedro Alves
2013-08-19 2:52 ` Will Huang
2013-08-19 3:10 ` Yao Qi
2013-08-19 5:01 ` Will Huang
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=520E0CFB.9010203@codesourcery.com \
--to=yao@codesourcery.com \
--cc=gdb-patches@sourceware.org \
--cc=will.huang@aliyun-inc.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