From owner-freebsd-arch@FreeBSD.ORG Tue Jan 13 19:18:03 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 518B716A4CE for ; Tue, 13 Jan 2004 19:18:03 -0800 (PST) Received: from exchhz01.viatech.com.cn (ip-40-162-97-218.anlai.com [218.97.162.40]) by mx1.FreeBSD.org (Postfix) with ESMTP id 7A22643D1D for ; Tue, 13 Jan 2004 19:17:59 -0800 (PST) (envelope-from davidxu@freebsd.org) Received: from freebsd.org (DAVIDWNT [10.4.1.99]) by exchhz01.viatech.com.cn with SMTP (Microsoft Exchange Internet Mail Service Version 5.5.2650.21) id CY5M1L3V; Wed, 14 Jan 2004 10:55:42 +0800 Message-ID: <4004B4D0.907@freebsd.org> Date: Wed, 14 Jan 2004 11:17:36 +0800 From: David Xu User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.5b) Gecko/20030723 Thunderbird/0.1 X-Accept-Language: en-us, en MIME-Version: 1.0 To: arch@freebsd.org Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: 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 03:18:03 -0000 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