From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8521 invoked by alias); 9 Apr 2010 10:49:54 -0000 Received: (qmail 8505 invoked by uid 22791); 9 Apr 2010 10:49:52 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=BAYES_00,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from aussmtpmrkpc120.us.dell.com (HELO aussmtpmrkpc120.us.dell.com) (143.166.82.159) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 09 Apr 2010 10:49:48 +0000 X-Loopcount0: from 12.110.134.31 Received: from unknown (HELO M31.equallogic.com) ([12.110.134.31]) by aussmtpmrkpc120.us.dell.com with SMTP; 09 Apr 2010 05:49:46 -0500 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Subject: RE: User level threads debugging with GDB Date: Fri, 09 Apr 2010 10:49:00 -0000 Message-ID: In-Reply-To: <06A7AD4E92172446ADDEB44F8A5D5C101CA8246BEE@ARE01.alyotech.fr> References: <06A7AD4E92172446ADDEB44F8A5D5C101CA8246BEE@ARE01.alyotech.fr> From: "Paul Koning" To: "PILLON Julien" , 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/msg00030.txt.bz2 I've just gone through this for NetBSD... If your platform has a libthread_db then it seems sensible to use that and interface GDB to it, as Linux does (or can do; it doesn't seem to do it in all cases). If not, then you don't need to create one. Some existing files offer various pieces of the answer that you can use. For example, dec-threads.c is short and simple but not necessarily a complete answer. linux-nat.c is very helpful but a bunch of what it does exists because of extra work needed on Linux. Stack printing relies on the register access routines; those have to work per thread. If they do then the rest just works. I found the main changes were in the "wait" and "resume" routines. In "wait" because after the wait finishes you want to get the list of threads and their status, and use the GDB routines that update GDB's list of threads. In "resume" because you need to be able to step and continue a single thread as well as all threads.=20=20 For any given platform, I expect that you'll find parts of the answer in several of the existing threads support files, but probably not the whole answer in any one of them. paul > -----Original Message----- > From: gdb-owner@sourceware.org [mailto:gdb-owner@sourceware.org] On > Behalf Of PILLON Julien > Sent: Friday, April 09, 2010 4:13 AM > To: gdb@sourceware.org > Subject: User level threads debugging with GDB >=20 > Hi, > I would like to know the right way to do some user-level threads > debugging with GDB and I have a few questions : > First, the main work will be within the libthread_db (especially in the > td_ta_new function I guess) but what else must be modified and what can > be left as is ? > Next, how should I implement the stack printing ? > Is the attach mode altered with this kind of modifications ? And if it > is, where are the sources to modify ? >=20 > regards >=20 > Julien