From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25182 invoked by alias); 23 Apr 2010 11:50:43 -0000 Received: (qmail 25172 invoked by uid 22791); 23 Apr 2010 11:50:42 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=BAYES_00,TW_XS,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (38.113.113.100) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 23 Apr 2010 11:50:37 +0000 Received: (qmail 15695 invoked from network); 23 Apr 2010 11:50:36 -0000 Received: from unknown (HELO orlando.localnet) (pedro@127.0.0.2) by mail.codesourcery.com with ESMTPA; 23 Apr 2010 11:50:36 -0000 From: Pedro Alves To: gdb@sourceware.org Subject: Re: pthread_t ids of threads not showed by "thread info" Date: Fri, 23 Apr 2010 11:50:00 -0000 User-Agent: KMail/1.12.2 (Linux/2.6.31-20-generic; KDE/4.3.2; x86_64; ; ) Cc: Stefano Sabatini References: <20100422151855.GA3128@geppetto> <20100422154404.GB3128@geppetto> In-Reply-To: <20100422154404.GB3128@geppetto> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201004231250.34075.pedro@codesourcery.com> X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2010-04/txt/msg00095.txt.bz2 On Thursday 22 April 2010 16:44:04, Stefano Sabatini wrote: > > (gdb) info threads > > * 9 Thread 25919 0x0040cc7d in PSafeObject::LockReadOnly (this=0xb6d3d1d8) > > at ../common/safecoll.cxx:144 > > 8 Thread 25920 0x00885402 in __kernel_vsyscall () For core files, older GDBs printed: 8 process 25920 0x00885402 in __kernel_vsyscall () instead. I'm thinking that the change so s/process/Thread/ in corelow.c:core_pid_to_str to default to print "Thread" wasn't that great. The idea was that "process" isn't good either, since now GDB supports multi-process, and so it's also confusing. What would people say to a change like this (pseudo-patch): static char * core_pid_to_str (struct target_ops *ops, ptid_t ptid) { static char buf[64]; if (core_gdbarch && gdbarch_core_pid_to_str_p (core_gdbarch)) { char *ret = gdbarch_core_pid_to_str (core_gdbarch, ptid); if (ret != NULL) return ret; } if (ptid_get_lwp (ptid) == 0) xsnprintf (buf, sizeof buf, "
"); else - xsnprintf (buf, sizeof buf, "Thread %ld", ptid_get_lwp (ptid)); + xsnprintf (buf, sizeof buf, "LWP %ld", ptid_get_lwp (ptid)); return buf; } That is, default to print "LWP" instead. For core files, older GDBs printed: 8 LWP 25920 0x00885402 in __kernel_vsyscall () I think that'll make more sense for the majority of hosts/targets that support core files. At least more than "Thread ". The gdbarch callback was added specifically for Solaris, so that we'd print "LWP " there: char * sol2_core_pid_to_str (struct gdbarch *gdbarch, ptid_t ptid) { static char buf[80]; xsnprintf (buf, sizeof buf, "LWP %ld", ptid_get_lwp (ptid)); return buf; } we could get rid of it, and instead register callbacks to whatever targets/archs want "Thread " instead. Note that there are a few targets that do layer a thread_stratum layer on top of corelow.c (at least OpenBSD, and Solaris' sol-thread.c), and those are already overriding core_pid_to_str to print whatever else they want instead, using the regular target_ops inheritance mechanisms. I'm thinking that Cygwin core files would be a case where you don't have a thread_stratum, but still want "Thread". These kinds of targets sounds like the minority, so flipping the default seems to make sense, and be less confusing to users. Opinions? -- Pedro Alves