From owner-freebsd-arch@FreeBSD.ORG Wed Jan 14 04:33:22 2004 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 038D716A4CE; Wed, 14 Jan 2004 04:33:22 -0800 (PST) Received: from mail.qubesoft.com (gate.qubesoft.com [217.169.36.34]) by mx1.FreeBSD.org (Postfix) with ESMTP id 74C5A43D53; Wed, 14 Jan 2004 04:33:18 -0800 (PST) (envelope-from dfr@nlsystems.com) Received: from bluebottle.qubesoft.com (bluebottle.qubesoft.com [192.168.1.2]) by mail.qubesoft.com (8.12.9/8.12.9) with ESMTP id i0ECXHHF003384; Wed, 14 Jan 2004 12:33:17 GMT (envelope-from dfr@nlsystems.com) Received: from builder02.qubesoft.com (builder02.qubesoft.com [192.168.1.8]) i0ECXHRb002943; Wed, 14 Jan 2004 12:33:17 GMT (envelope-from dfr@nlsystems.com) From: Doug Rabson To: David Xu In-Reply-To: <4004B4D0.907@freebsd.org> References: <4004B4D0.907@freebsd.org> Content-Type: text/plain Message-Id: <1074083597.5917.5.camel@builder02.qubesoft.com> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.0 Date: 14 Jan 2004 12:33:17 +0000 Content-Transfer-Encoding: 7bit cc: arch@freebsd.org Subject: Re: ptrace and thread X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 Jan 2004 12:33:22 -0000 On Wed, 2004-01-14 at 03:17, David Xu wrote: > I am current working on debug support for KSE thread program, however I > found > ptrace interface is not thread-aware, in a threaded program, I need to > get/set registers > set for individual threads, current ptrace can not support that > features, there are two > ways to support these requirements: > > 1. keep current ptrace interface, add a command for example > PT_SETDTHREAD to > set current thread for debug, and subsequent request for example > PT_SETREGS and > PT_GETREGS will work on the thread, for single thread process, the > default current > thread is always the first thread in the process, this way we needn't > change legacy debugger > code. > > 2. introduce a second ptrace syscall, and accept a new parameter tid > (thread id), > the PT_SETREGS and PT_GETREGS will use the tid to operate on > corresponding > thread. As far as option 2 goes, I think the HP ttrace syscall might be a useful model to follow. You can read the manpage at: http://docs.hp.com/cgi-bin/onlinedocs.py?mpn=B2355-60103&service=hpux&path=00/13/1384&title=HP-UX%20Reference%20%2811i%20v2%29