From e252ef0b2ffa4dfb2907b6336f737bde03f12123 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADtor=20Santos=20Costa?= Date: Tue, 23 Sep 2008 23:43:01 +0100 Subject: [PATCH] more debugger fixes! - make sure donotrace and oncenotrace are known to the signal mechanism: they should disable creeping - avoid creep at deallocate: it is a very bad idea :( --- C/absmi.c | 6 +++--- pl/boot.yap | 9 ++++----- pl/signals.yap | 42 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 49 insertions(+), 8 deletions(-) diff --git a/C/absmi.c b/C/absmi.c index 804f2575b..d47b8e3d8 100644 --- a/C/absmi.c +++ b/C/absmi.c @@ -2690,9 +2690,9 @@ Yap_absmi(int inp) /* don't do a creep here; also, if our instruction is followed by a execute_c, just wait a bit more */ - if (ActiveSignals & YAP_CREEP_SIGNAL && - PREG->opc != Yap_opcode(_procceed) && - PREG->opc != Yap_opcode(_cut_e)) { + if (ActiveSignals & YAP_CREEP_SIGNAL || + (PREG->opc != Yap_opcode(_procceed) && + PREG->opc != Yap_opcode(_cut_e))) { GONext(); } PP = PREG->u.p.p; diff --git a/pl/boot.yap b/pl/boot.yap index 91f0be98c..4754746fd 100644 --- a/pl/boot.yap +++ b/pl/boot.yap @@ -849,7 +849,7 @@ not(G) :- \+ '$execute'(G). '$call'(G, CP, G0, CurMod) :- ( '$is_expand_goal_or_meta_predicate'(G,CurMod) -> ( - user:goal_expansion(G, CurMod, NG) -> + '$oncenotrace'(user:goal_expansion(G, CurMod, NG)) -> '$call'(NG, CP, G0,CurMod) ; % repeat other code. @@ -1165,9 +1165,8 @@ throw(Ball) :- nb_setval('$system_mode',off), ( nb_getval('$trace',on) -> '$creep' ; true). -'$donotrace'(G) :- - '$disable_creep', !, - '$execute'(G), - '$creep'. '$donotrace'(G) :- '$execute'(G). + +'$oncenotrace'(G) :- + '$execute'(G), !. diff --git a/pl/signals.yap b/pl/signals.yap index abcd141ad..fbecd5e89 100644 --- a/pl/signals.yap +++ b/pl/signals.yap @@ -97,6 +97,48 @@ !, '$creep', '$execute_nonstop'('$call'(G, CP, G0, M),M0). +% donotrace: means do not trace! So, +% ignore and then put creep back for the continuation. +'$start_creep'([M0|'$donotrace'(G)]) :- + !, + ( + CP0 is '$last_choice_pt', + '$execute_nonstop'(G,M0), + CP1 is '$last_choice_pt', + % exit port: creep + '$creep', + ( + % if deterministic just creep all you want. + CP0 = CP1 -> + ! + ; + % extra disjunction protects reentry into usergoal + ( + % cannot cut here + true + ; + % be sure to disable creep on redo port + '$disable_creep', + fail + ) + ) + ; + % put it back again on fail + '$creep', + fail + ). +'$start_creep'([M0|'$oncenotrace'(G)]) :- + !, + ('$execute_nonstop'(G,M0), + CP1 is '$last_choice_pt', + % exit port: creep + '$creep', + ! + ; + % put it back again on fail + '$creep', + fail + ). % do not debug if we are not in debug mode. '$start_creep'([Mod|G]) :- '$debug_on'(DBON), DBON = false, !,