From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10221 invoked by alias); 16 Aug 2013 11:29:58 -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 10208 invoked by uid 89); 16 Aug 2013 11:29:58 -0000 X-Spam-SWARE-Status: No, score=-4.6 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,KHOP_THREADED,RCVD_IN_HOSTKARMA_W,RCVD_IN_HOSTKARMA_WL autolearn=ham version=3.3.2 Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Fri, 16 Aug 2013 11:29:57 +0000 Received: from svr-orw-fem-01.mgc.mentorg.com ([147.34.98.93]) by relay1.mentorg.com with esmtp id 1VAIE6-0003Gn-Dt from Yao_Qi@mentor.com ; Fri, 16 Aug 2013 04:29:54 -0700 Received: from SVR-ORW-FEM-05.mgc.mentorg.com ([147.34.97.43]) by svr-orw-fem-01.mgc.mentorg.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.4675); Fri, 16 Aug 2013 04:29:53 -0700 Received: from qiyao.dyndns.org (147.34.91.1) by svr-orw-fem-05.mgc.mentorg.com (147.34.97.43) with Microsoft SMTP Server id 14.2.247.3; Fri, 16 Aug 2013 04:29:53 -0700 Message-ID: <520E0CFB.9010203@codesourcery.com> Date: Fri, 16 Aug 2013 11:29:00 -0000 From: Yao Qi User-Agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130110 Thunderbird/17.0.2 MIME-Version: 1.0 To: Will Huang CC: Subject: Re: [PATCH][PR threads/15824] when get threads name failed from info threads with linux kernel version earlier than 2.6.33 References: <00b201ce98a6$7cf69150$76e3b3f0$@huang@aliyun-inc.com> <520D8D9A.3050003@codesourcery.com> <016701ce9a41$f39086d0$dab19470$@huang@aliyun-inc.com> <520DF2E2.3020407@codesourcery.com> <01a201ce9a6a$74436db0$5cca4910$@huang@aliyun-inc.com> In-Reply-To: <01a201ce9a6a$74436db0$5cca4910$@huang@aliyun-inc.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-SW-Source: 2013-08/txt/msg00421.txt.bz2 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 (齐尧)