debugging
This commit is contained in:
parent
d379034a96
commit
c3b06ffdd1
@ -1,5 +1,7 @@
|
|||||||
/************************************************************************\
|
/************************************************************************\
|
||||||
* Cut & Commit Instructions *
|
* Cut & Commit Inst
|
||||||
|
|
||||||
|
ructions *
|
||||||
\************************************************************************/
|
\************************************************************************/
|
||||||
|
|
||||||
#ifdef INDENT_CODE
|
#ifdef INDENT_CODE
|
||||||
|
13
C/errors.c
13
C/errors.c
@ -395,7 +395,7 @@ int Yap_SWIHandleError(const char *s, ...) {
|
|||||||
|
|
||||||
void Yap_RestartYap(int flag) {
|
void Yap_RestartYap(int flag) {
|
||||||
CACHE_REGS
|
CACHE_REGS
|
||||||
fprintf(stderr,"call siglongjmp HR=%p\n", HR);
|
fprintf(stderr,"call siglongjmp HR=%p B=%p\n", HR, B);
|
||||||
#if PUSH_REGS
|
#if PUSH_REGS
|
||||||
restore_absmi_regs(&Yap_standard_regs);
|
restore_absmi_regs(&Yap_standard_regs);
|
||||||
#endif
|
#endif
|
||||||
@ -630,13 +630,6 @@ yamop *Yap_Error__(bool throw, const char *file, const char *function, int linen
|
|||||||
LOCAL_PrologMode &= ~InErrorMode;
|
LOCAL_PrologMode &= ~InErrorMode;
|
||||||
Yap_exit(1);
|
Yap_exit(1);
|
||||||
}
|
}
|
||||||
if (LOCAL_within_print_message) {
|
|
||||||
/* error within error */
|
|
||||||
fprintf(stderr, "%% ERROR WITHIN WARNING %d: %s\n", LOCAL_Error_TYPE,
|
|
||||||
tmpbuf);
|
|
||||||
LOCAL_PrologMode &= ~InErrorMode;
|
|
||||||
Yap_exit(1);
|
|
||||||
}
|
|
||||||
if (where == 0L || where == TermNil) {
|
if (where == 0L || where == TermNil) {
|
||||||
LOCAL_ActiveError->culprit = NULL;
|
LOCAL_ActiveError->culprit = NULL;
|
||||||
} else {
|
} else {
|
||||||
@ -790,9 +783,9 @@ yamop *Yap_Error__(bool throw, const char *file, const char *function, int linen
|
|||||||
}
|
}
|
||||||
//reset_error_description();
|
//reset_error_description();
|
||||||
fprintf(stderr,"HR before jmp=%p\n", HR);
|
fprintf(stderr,"HR before jmp=%p\n", HR);
|
||||||
if (!throw) {
|
// if (!throw) {
|
||||||
Yap_JumpToEnv();
|
Yap_JumpToEnv();
|
||||||
}
|
// }
|
||||||
return P;
|
return P;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
40
C/exec.c
40
C/exec.c
@ -917,7 +917,7 @@ static Int setup_call_catcher_cleanup(USES_REGS1) {
|
|||||||
Int oENV = LCL0 - ENV;
|
Int oENV = LCL0 - ENV;
|
||||||
Int oYENV = LCL0 - YENV;
|
Int oYENV = LCL0 - YENV;
|
||||||
bool rc;
|
bool rc;
|
||||||
|
fprintf(stderr, "HR before catch=%p--%p\n", HR, B );
|
||||||
Yap_DisableInterrupts(worker_id);
|
Yap_DisableInterrupts(worker_id);
|
||||||
rc = Yap_RunTopGoal(Setup, false);
|
rc = Yap_RunTopGoal(Setup, false);
|
||||||
Yap_EnableInterrupts(worker_id);
|
Yap_EnableInterrupts(worker_id);
|
||||||
@ -1387,10 +1387,11 @@ static Int execute_depth_limit(USES_REGS1) {
|
|||||||
static bool exec_absmi(bool top, yap_reset_t reset_mode USES_REGS) {
|
static bool exec_absmi(bool top, yap_reset_t reset_mode USES_REGS) {
|
||||||
int lval, out;
|
int lval, out;
|
||||||
Int OldBorder = LOCAL_CBorder;
|
Int OldBorder = LOCAL_CBorder;
|
||||||
LOCAL_CBorder = LCL0 - (CELL *)B;
|
LOCAL_CBorder = LCL0 - ENV;
|
||||||
|
|
||||||
sigjmp_buf signew, *sighold = LOCAL_RestartEnv;
|
sigjmp_buf signew, *sighold = LOCAL_RestartEnv;
|
||||||
LOCAL_RestartEnv = &signew;
|
LOCAL_RestartEnv = &signew;
|
||||||
REGSTORE *old_rs = Yap_regp;
|
REGSTORE *old_rs = Yap_regp;
|
||||||
|
|
||||||
if (top && (lval = sigsetjmp(signew, 1)) != 0) {
|
if (top && (lval = sigsetjmp(signew, 1)) != 0) {
|
||||||
switch (lval) {
|
switch (lval) {
|
||||||
@ -1429,6 +1430,7 @@ static bool exec_absmi(bool top, yap_reset_t reset_mode USES_REGS) {
|
|||||||
case 3: { /* saved state */
|
case 3: { /* saved state */
|
||||||
LOCAL_CBorder = OldBorder;
|
LOCAL_CBorder = OldBorder;
|
||||||
LOCAL_RestartEnv = sighold;
|
LOCAL_RestartEnv = sighold;
|
||||||
|
LOCAL_PrologMode = UserMode;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
case 4:
|
case 4:
|
||||||
@ -1439,7 +1441,7 @@ static bool exec_absmi(bool top, yap_reset_t reset_mode USES_REGS) {
|
|||||||
LOCAL_ActiveError->errorNo = ABORT_EVENT;
|
LOCAL_ActiveError->errorNo = ABORT_EVENT;
|
||||||
Yap_JumpToEnv();
|
Yap_JumpToEnv();
|
||||||
}
|
}
|
||||||
LOCAL_PrologMode &= ~AbortMode;
|
LOCAL_PrologMode = UserMode;
|
||||||
P = (yamop *) FAILCODE;
|
P = (yamop *) FAILCODE;
|
||||||
LOCAL_RestartEnv = sighold;
|
LOCAL_RestartEnv = sighold;
|
||||||
return false;
|
return false;
|
||||||
@ -1449,27 +1451,27 @@ static bool exec_absmi(bool top, yap_reset_t reset_mode USES_REGS) {
|
|||||||
// but we should inform the caller on what happened.
|
// but we should inform the caller on what happened.
|
||||||
|
|
||||||
Yap_regp = old_rs;
|
Yap_regp = old_rs;
|
||||||
fprintf(stderr,"HR before jmp=%p\n", HR);
|
restore_TR();
|
||||||
Yap_JumpToEnv();
|
restore_B();
|
||||||
fprintf(stderr,"HR after jmp=%p\n", HR);
|
/* H is not so important, because we're gonna backtrack */
|
||||||
ASP = (CELL *) B;
|
restore_H();
|
||||||
|
/* set stack */
|
||||||
|
ASP = (CELL *) PROTECT_FROZEN_B(B);
|
||||||
|
|
||||||
if (B == NULL || B->cp_b == NULL || (CELL*)(B->cp_b) > LCL0 - LOCAL_CBorder) {
|
if (B == NULL || B->cp_b == NULL || (CELL*)(B->cp_b) > LCL0 - LOCAL_CBorder) {
|
||||||
LOCAL_RestartEnv = sighold;
|
LOCAL_RestartEnv = sighold;
|
||||||
LOCAL_CBorder = OldBorder;
|
LOCAL_CBorder = OldBorder;
|
||||||
fprintf(stderr, "HR after sigset A=%p\n", HR);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
fprintf(stderr, "HR after sigset=B %p\n", HR);
|
|
||||||
P = FAILCODE;
|
P = FAILCODE;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
LOCAL_PrologMode = UserMode;
|
|
||||||
YENV = ASP;
|
YENV = ASP;
|
||||||
YENV[E_CB] = Unsigned(B);
|
YENV[E_CB] = Unsigned(B);
|
||||||
out = Yap_absmi(0);
|
fprintf(stderr, "HR before absmi(%d)=%p--%p\n", lval, HR, B);
|
||||||
// fprintf(stderr, "HR after absmi=%p\n", HR);
|
out = Yap_absmi(0);
|
||||||
/* make sure we don't leave a FAIL signal hanging around */
|
/* make sure we don't leave a FAIL signal hanging around */
|
||||||
Yap_get_signal(YAP_FAIL_SIGNAL);
|
Yap_get_signal(YAP_FAIL_SIGNAL);
|
||||||
if (!Yap_has_a_signal())
|
if (!Yap_has_a_signal())
|
||||||
CalculateStackGap(PASS_REGS1);
|
CalculateStackGap(PASS_REGS1);
|
||||||
@ -1526,6 +1528,8 @@ static bool do_goal(yamop *CodeAdr, int arity, CELL *pt, bool top USES_REGS) {
|
|||||||
choiceptr saved_b = B;
|
choiceptr saved_b = B;
|
||||||
bool out;
|
bool out;
|
||||||
|
|
||||||
|
fprintf(stderr,"B before PrepGoal=%p\n", B);
|
||||||
|
|
||||||
Yap_PrepGoal(arity, pt, saved_b PASS_REGS);
|
Yap_PrepGoal(arity, pt, saved_b PASS_REGS);
|
||||||
CACHE_A1();
|
CACHE_A1();
|
||||||
P = (yamop *)CodeAdr;
|
P = (yamop *)CodeAdr;
|
||||||
@ -2025,9 +2029,11 @@ bool is_cleanup_cp(choiceptr cp_b) {
|
|||||||
so get pointers here */
|
so get pointers here */
|
||||||
/* find the first choicepoint that may be a catch */
|
/* find the first choicepoint that may be a catch */
|
||||||
// DBTerm *dbt = Yap_RefToException();
|
// DBTerm *dbt = Yap_RefToException();
|
||||||
while (handler && Yap_PredForChoicePt(handler, NULL) != PredDollarCatch &&
|
while (handler
|
||||||
LOCAL_CBorder < LCL0 - (CELL *)handler && handler->cp_ap != NOCODE &&
|
&& Yap_PredForChoicePt(handler, NULL) != PredDollarCatch
|
||||||
handler->cp_b != NULL) {
|
// && LOCAL_CBorder < LCL0 - (CELL *)handler && handler->cp_ap != NOCODE
|
||||||
|
// && handler->cp_b != NULL
|
||||||
|
) {
|
||||||
handler = handler->cp_b;
|
handler = handler->cp_b;
|
||||||
}
|
}
|
||||||
pop_text_stack(1);
|
pop_text_stack(1);
|
||||||
|
Reference in New Issue
Block a user