ptrace and thread
David Xu
davidxu at viatech.com.cn
Wed Jan 14 20:46:33 PST 2004
>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
More information about the freebsd-threads
mailing list