Skip site navigation (1)Skip section navigation (2)
Date:      14 Jan 2004 12:33:17 +0000
From:      Doug Rabson <dfr@nlsystems.com>
To:        David Xu <davidxu@freebsd.org>
Cc:        arch@freebsd.org
Subject:   Re: ptrace and thread
Message-ID:  <1074083597.5917.5.camel@builder02.qubesoft.com>
In-Reply-To: <4004B4D0.907@freebsd.org>
References:  <4004B4D0.907@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1074083597.5917.5.camel>