1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-15 10:17:20 +00:00

Call kse_switchin to switch context when being debugged.

This commit is contained in:
David Xu 2004-07-13 22:54:23 +00:00
parent 63db3fb215
commit e378b41cb4
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=132125
9 changed files with 158 additions and 55 deletions

View File

@ -235,17 +235,31 @@ _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)
_amd64_restore_context(&tcb->tcb_tmbx.tm_context.uc_mcontext,
(intptr_t)&tcb->tcb_tmbx,
(intptr_t *)&kcb->kcb_kmbx.km_curthread);
else
_amd64_restore_context(&tcb->tcb_tmbx.tm_context.uc_mcontext,
0, NULL);
/* We should not reach here. */
if (_libkse_debug == 0) {
tcb->tcb_tmbx.tm_lwp = kcb->kcb_kmbx.km_lwp;
if (setmbox != 0)
_amd64_restore_context(
&tcb->tcb_tmbx.tm_context.uc_mcontext,
(intptr_t)&tcb->tcb_tmbx,
(intptr_t *)&kcb->kcb_kmbx.km_curthread);
else
_amd64_restore_context(
&tcb->tcb_tmbx.tm_context.uc_mcontext,
0, NULL);
/* We should not reach here. */
} else {
if (setmbox)
kse_switchin(&tcb->tcb_tmbx, KSE_SWITCHIN_SETTMBX);
else
kse_switchin(&tcb->tcb_tmbx, 0);
}
return (-1);
}
#endif

View File

@ -227,15 +227,24 @@ _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;
mcontext_t *mc;
_tcb_set(kcb, tcb);
mc = &tcb->tcb_tmbx.tm_context.uc_mcontext;
if (setmbox)
_thr_setcontext(mc, (intptr_t)&tcb->tcb_tmbx,
(intptr_t *)&kcb->kcb_kmbx.km_curthread);
else
_thr_setcontext(mc, 0, NULL);
if (_libkse_debug == 0) {
if (setmbox)
_thr_setcontext(mc, (intptr_t)&tcb->tcb_tmbx,
(intptr_t *)&kcb->kcb_kmbx.km_curthread);
else
_thr_setcontext(mc, 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);
}

View File

@ -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);
}

View File

@ -227,15 +227,25 @@ _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;
mcontext_t *mc;
_tcb_set(kcb, tcb);
mc = &tcb->tcb_tmbx.tm_context.uc_mcontext;
if (setmbox)
_thr_setcontext(mc, (intptr_t)&tcb->tcb_tmbx,
(intptr_t *)&kcb->kcb_kmbx.km_curthread);
else
_thr_setcontext(mc, 0, NULL);
if (_libkse_debug == 0) {
tcb->tcb_tmbx.tm_lwp = kcb->kcb_kmbx.km_lwp;
if (setmbox)
_thr_setcontext(mc, (intptr_t)&tcb->tcb_tmbx,
(intptr_t *)&kcb->kcb_kmbx.km_curthread);
else
_thr_setcontext(mc, 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);
}

View File

@ -218,14 +218,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;
_tcb_set(kcb, tcb);
if (setmbox != 0)
_alpha_restore_context(&tcb->tcb_tmbx.tm_context.uc_mcontext,
(intptr_t)&tcb->tcb_tmbx,
(intptr_t *)&kcb->kcb_kmbx.km_curthread);
else
_alpha_restore_context(&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)
_alpha_restore_context(
&tcb->tcb_tmbx.tm_context.uc_mcontext,
(intptr_t)&tcb->tcb_tmbx,
(intptr_t *)&kcb->kcb_kmbx.km_curthread);
else
_alpha_restore_context(
&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);
}

View File

@ -235,17 +235,31 @@ _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)
_amd64_restore_context(&tcb->tcb_tmbx.tm_context.uc_mcontext,
(intptr_t)&tcb->tcb_tmbx,
(intptr_t *)&kcb->kcb_kmbx.km_curthread);
else
_amd64_restore_context(&tcb->tcb_tmbx.tm_context.uc_mcontext,
0, NULL);
/* We should not reach here. */
if (_libkse_debug == 0) {
tcb->tcb_tmbx.tm_lwp = kcb->kcb_kmbx.km_lwp;
if (setmbox != 0)
_amd64_restore_context(
&tcb->tcb_tmbx.tm_context.uc_mcontext,
(intptr_t)&tcb->tcb_tmbx,
(intptr_t *)&kcb->kcb_kmbx.km_curthread);
else
_amd64_restore_context(
&tcb->tcb_tmbx.tm_context.uc_mcontext,
0, NULL);
/* We should not reach here. */
} else {
if (setmbox)
kse_switchin(&tcb->tcb_tmbx, KSE_SWITCHIN_SETTMBX);
else
kse_switchin(&tcb->tcb_tmbx, 0);
}
return (-1);
}
#endif

View File

@ -227,15 +227,24 @@ _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;
mcontext_t *mc;
_tcb_set(kcb, tcb);
mc = &tcb->tcb_tmbx.tm_context.uc_mcontext;
if (setmbox)
_thr_setcontext(mc, (intptr_t)&tcb->tcb_tmbx,
(intptr_t *)&kcb->kcb_kmbx.km_curthread);
else
_thr_setcontext(mc, 0, NULL);
if (_libkse_debug == 0) {
if (setmbox)
_thr_setcontext(mc, (intptr_t)&tcb->tcb_tmbx,
(intptr_t *)&kcb->kcb_kmbx.km_curthread);
else
_thr_setcontext(mc, 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);
}

View File

@ -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);
}

View File

@ -227,15 +227,25 @@ _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;
mcontext_t *mc;
_tcb_set(kcb, tcb);
mc = &tcb->tcb_tmbx.tm_context.uc_mcontext;
if (setmbox)
_thr_setcontext(mc, (intptr_t)&tcb->tcb_tmbx,
(intptr_t *)&kcb->kcb_kmbx.km_curthread);
else
_thr_setcontext(mc, 0, NULL);
if (_libkse_debug == 0) {
tcb->tcb_tmbx.tm_lwp = kcb->kcb_kmbx.km_lwp;
if (setmbox)
_thr_setcontext(mc, (intptr_t)&tcb->tcb_tmbx,
(intptr_t *)&kcb->kcb_kmbx.km_curthread);
else
_thr_setcontext(mc, 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);
}