From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7372 invoked by alias); 8 Jun 2009 14:24:31 -0000 Received: (qmail 7363 invoked by uid 22791); 8 Jun 2009 14:24:30 -0000 X-SWARE-Spam-Status: No, hits=-1.2 required=5.0 tests=AWL,BAYES_00,SPF_NEUTRAL X-Spam-Check-By: sourceware.org Received: from honeysuckle.london.02.net (HELO honeysuckle.london.02.net) (87.194.255.144) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 08 Jun 2009 14:24:23 +0000 Received: from elm.config (87.194.37.195) by honeysuckle.london.02.net (8.5.016.1) id 4A23EDE6006D08AD; Mon, 8 Jun 2009 15:24:05 +0100 Date: Mon, 08 Jun 2009 14:24:00 -0000 From: Karen Osmond Reply-To: karen.osmond@gmail.com To: Tom Tromey cc: karen.osmond@gmail.com, gdb-patches@sourceware.org Subject: Re: [rfc][patch] Allow GDB to display user-defined thread names In-Reply-To: Message-ID: References: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-IsSubscribed: yes 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 X-SW-Source: 2009-06/txt/msg00173.txt.bz2 On Fri, 5 Jun 2009, Tom Tromey wrote: > >>>>> "Karen" == Karen Osmond writes: > Karen> The new gdb command takes the form "thread name NAME" and > Karen> associates NAME with the current thread, so you can issue > Karen> something like: > > It seems like a nice idea to me. As J.T. says, it would be nice to > have this automatically work for targets that define a thread name -- Yup, I'll try to find out a bit more about those posix thread extensions. Also, I think the Windows way involves throwing a particular exception to get the thread name into the debugger, and it looks like gdb doesn't support that currently (though i only had a very cursory browse for it). > but I think it is ok to build up the feature piecemeal. I'll leave the above and python and MI for now... > Karen> So, if this is of interest, I'd like to spend the time to improve it but > Karen> if anybody has time, it would be of great help if a gdb bod could > Karen> volunteer to mentor me a bit... please? :) > > Sure. Wonderful, thank you! > Actually, it seems to me that the name-printing should be done by some > generic code, not in linux-thread-db.c. Yes, true... and stepping back a level, adding it to target_pid_to_str seems wrong also. Perhaps it is best to make a new function to print the thread's id, name and pid_to_str stuff and to call that from the appropriate places in thread.c, such as after the thread id in "thread info" output. I think it is also helpful in a few other places like [Switching to...] and [New...] and [... exited]. Those don't currently include the thread id, but perhaps it makes sense to add that as well (I spotted a FIXME-implementors in the manual to that effect, at least for [New...]). > One important missing piece is an update to the manual. > All new user commands require documentation. I'll make sure to include that in the next patch. cheers, -karen