Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 14 Jan 2004 11:17:36 +0800
From:      David Xu <davidxu@freebsd.org>
To:        arch@freebsd.org
Subject:   ptrace and thread
Message-ID:  <4004B4D0.907@freebsd.org>

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

For first method, I have a  patch  there:
http://people.freebsd.org/~davidxu/kse/ptrace.diff
The patch also includes some bits to support KSE debug,  not just for 
pure 1:1 threading.

David Xu




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