From owner-freebsd-threads@FreeBSD.ORG Wed Jan 14 20:46:33 2004 Return-Path: Delivered-To: freebsd-threads@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id C7CA116A4CE for ; Wed, 14 Jan 2004 20:46:33 -0800 (PST) Received: from bento.FreeBSD.org (bento.freebsd.org [216.136.204.23]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4161343D6E; Wed, 14 Jan 2004 20:46:31 -0800 (PST) (envelope-from davidxu@viatech.com.cn) Received: from viatech.com.cn (localhost [127.0.0.1]) by bento.FreeBSD.org (8.12.10/8.12.10) with ESMTP id i0F4kRfx027976; Wed, 14 Jan 2004 20:46:30 -0800 (PST) (envelope-from davidxu@viatech.com.cn) Message-ID: <40061B12.4000903@viatech.com.cn> Date: Thu, 15 Jan 2004 12:46:10 +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: Julian Elischer References: <4005D459.6010202@freebsd.org> In-Reply-To: <4005D459.6010202@freebsd.org> Content-Type: multipart/mixed; boundary="------------060703020702070301090800" cc: threads@freebsd.org Subject: Re: ptrace and thread X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Jan 2004 04:46:33 -0000 This is a multi-part message in MIME format. --------------060703020702070301090800 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit >On Wed, 14 Jan 2004, 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: >> >> > >Yes I tried to address this a bit around the time when I added the >single ttreading code. Ialso made several posts looking for advice >from gdb/ptrace experts but got very little response.. >As you noticed, the ptrace facility is almost completely useless >WRT threads.. > >it is possible to imagine an extension where you select a single thread >of interest but you would have to decide whether you want all the other >threads to be left running or left suspended.. >(you may need both possibilities to correctly debug a problem) > > I want to suspend all threads. >The problem is that the thread becomes invisible to the kernel when it >crosses over to userland so the UTS needs to take an active part, >(unless the kernel can recognise when the thread has yielded and the UTS >has been enterred. (possible I guess) at which time >single stepping would be turned off allowing the UTS to run at full >speed. > >The UTS would hav eto co-operate by using a method of re-enterring the >thread that allows the kernel to re-start single stepping.. > >What the other threads are doing in teh meanwhile is unknown. > > > May you have some ideas about how to let UTS run at full speed under debugger ? Dan and I ever considered that we needn't to support debugging UTS kernel, only user code need to be supported, when under gdb, we will use kse_switchin syscall to switch a thread context, this lets us to switch an userland context which single step enabled in eflags (i386), kse_switchin syscall need to be changed to support clearing context_in_userland flag, I will introduce this flag to kse_thr_mailbox, we also need to finallize mailbox layout as Dan and Marcel ever said. Besides this, I already have patch for gdb now to support debugging kse thread, it works but still has bug, I am testing it now on UP. David Xu --------------060703020702070301090800--