Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 15 Jan 2004 12:46:10 +0800
From:      David Xu <davidxu@viatech.com.cn>
To:        Julian Elischer <julian@elischer.org>
Cc:        threads@freebsd.org
Subject:   Re: ptrace and thread
Message-ID:  <40061B12.4000903@viatech.com.cn>
In-Reply-To: <4005D459.6010202@freebsd.org>
References:  <4005D459.6010202@freebsd.org>

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



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