ptrace and thread
Doug Rabson
dfr at nlsystems.com
Wed Jan 14 04:33:22 PST 2004
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
More information about the freebsd-arch
mailing list