summaryrefslogtreecommitdiffstats
path: root/lib/libkse/arch/i386/include
diff options
context:
space:
mode:
authordavidxu <davidxu@FreeBSD.org>2004-07-13 22:54:23 +0000
committerdavidxu <davidxu@FreeBSD.org>2004-07-13 22:54:23 +0000
commitb241de25233d4ef491311be116b62ee7e73ec7a8 (patch)
treedf1c09fab5a1acab32cdbcd83297249f5dd01df1 /lib/libkse/arch/i386/include
parent16b35fe1ee51b288cfd0114a4442ced2c2d1eddc (diff)
downloadFreeBSD-src-b241de25233d4ef491311be116b62ee7e73ec7a8.zip
FreeBSD-src-b241de25233d4ef491311be116b62ee7e73ec7a8.tar.gz
Call kse_switchin to switch context when being debugged.
Diffstat (limited to 'lib/libkse/arch/i386/include')
-rw-r--r--lib/libkse/arch/i386/include/pthread_md.h24
1 files changed, 18 insertions, 6 deletions
diff --git a/lib/libkse/arch/i386/include/pthread_md.h b/lib/libkse/arch/i386/include/pthread_md.h
index 4bcb130..28eefc1 100644
--- a/lib/libkse/arch/i386/include/pthread_md.h
+++ b/lib/libkse/arch/i386/include/pthread_md.h
@@ -237,15 +237,27 @@ _thread_enter_uts(struct tcb *tcb, struct kcb *kcb)
static __inline int
_thread_switch(struct kcb *kcb, struct tcb *tcb, int setmbox)
{
+ extern int _libkse_debug;
+
if ((kcb == NULL) || (tcb == NULL))
return (-1);
kcb->kcb_curtcb = tcb;
- if (setmbox != 0)
- _thr_setcontext(&tcb->tcb_tmbx.tm_context.uc_mcontext,
- (intptr_t)&tcb->tcb_tmbx,
- (intptr_t *)&kcb->kcb_kmbx.km_curthread);
- else
- _thr_setcontext(&tcb->tcb_tmbx.tm_context.uc_mcontext, 0, NULL);
+ if (_libkse_debug == 0) {
+ tcb->tcb_tmbx.tm_lwp = kcb->kcb_kmbx.km_lwp;
+ if (setmbox != 0)
+ _thr_setcontext(&tcb->tcb_tmbx.tm_context.uc_mcontext,
+ (intptr_t)&tcb->tcb_tmbx,
+ (intptr_t *)&kcb->kcb_kmbx.km_curthread);
+ else
+ _thr_setcontext(&tcb->tcb_tmbx.tm_context.uc_mcontext,
+ 0, NULL);
+ } else {
+ if (setmbox)
+ kse_switchin(&tcb->tcb_tmbx, KSE_SWITCHIN_SETTMBX);
+ else
+ kse_switchin(&tcb->tcb_tmbx, 0);
+ }
+
/* We should not reach here. */
return (-1);
}
OpenPOWER on IntegriCloud