From 2a156ddf33ed48f2ae770d9c966cc3ec68e6e3d8 Mon Sep 17 00:00:00 2001 From: vsc Date: Fri, 18 Jan 2002 04:24:10 +0000 Subject: [PATCH] debugger improvements git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@309 b08c6af1-5177-4d33-ba66-4b1c6b8b522a --- C/init.c | 4 +- pl/debug.yap | 136 +++++++++++++++++++++++++-------------------------- 2 files changed, 69 insertions(+), 71 deletions(-) diff --git a/C/init.c b/C/init.c index 94ce5ee13..0278aad45 100644 --- a/C/init.c +++ b/C/init.c @@ -501,9 +501,9 @@ InitDebug(void) } } #endif - /* Set at half leash */ + /* Set at full leash */ At = LookupAtom("$leash"); - PutValue(At, MkIntTerm(10)); + PutValue(At, MkIntTerm(15)); } void diff --git a/pl/debug.yap b/pl/debug.yap index c31da05a1..517bd248e 100644 --- a/pl/debug.yap +++ b/pl/debug.yap @@ -295,7 +295,7 @@ debugging :- '$get_value'(spy_cl,CL), /* save global clause no. */ repeat, /* we need this to be able to implement retry */ '$init_spy_cl'(G,Module), - '$trace'(call,G,Module,L), /* inform about call port */ + '$trace'(call,G,Module,L,CF), /* inform about call port */ /* the following choice point is where the predicate is called */ ( '$get_value'(spy_sp,0), /* make sure we are not skipping*/ '$system_catch'('$spycalls'(G,Module,Res), Module, @@ -304,9 +304,9 @@ debugging :- /* go execute the predicate */ ; /* we get here when the predicate fails */ ( '$get_value'(spy_sl, -1) -> - '$trace'(exception,G,Module,L) + '$trace'(exception,G,Module,L,CF) ; - '$trace'(fail,G,Module,L) /* inform at fail port */ + '$trace'(fail,G,Module,L,CF) /* inform at fail port */ ), '$get_value'(spy_sl,L2),/* make sure we are not ... */ L2 \= L, /* ... skiping to this level */ @@ -314,27 +314,28 @@ debugging :- '$set_value'(spy_cl,CL),/* restore global value of clause no */ '$setflop'(0), '$set_creep'(SC), /* restore creep value */ - '$cont_creep', fail ), /* and exit */ + '$cont_creep'(CF), fail ), /* and exit */ '$get_value'(spy_cl,Cla), /* save no. of clause to try */ ( var(Res), /* check not redoing */ - '$trace'(exit,G,Module,L), /* output message at exit */ + '$trace'(exit,G,Module,L,CF), /* output message at exit */ '$get_value'(spy_sp,0), /* check not skipping */ - '$set_creep'(SC), /* restore creep value */ '$set_value'(spy_cl,CL), /* restore clause no. */ + '$set_creep'(SC), /* restore creep value */ '$setflop'(0), - '$cont_creep'; /* exit */ + '$cont_creep'(CF); /* exit */ /* we get here when we want to redo a goal */ '$set_value'(spy_cl,Cla),/* restore clause no. to try */ - '$trace'(redo,G,Module,L), /* inform user_error */ + '$trace'(redo,G,Module,L,_), /* inform user_error */ fail /* to backtrack to spycalls */ ). '$do_spy'(G,Mod) :- '$execute0'(G,Mod). /* this clause applies when we do not want to spy the goal */ -'$cont_creep' :- '$get_value'('$trace',1), '$set_yap_flags'(10,1), fail. -'$cont_creep' :- '$access_yap_flags'(10,1), !, '$creep'. -'$cont_creep'. +'$cont_creep'( _) :- '$get_value'('$trace',1), '$set_yap_flags'(10,1), fail. +'$cont_creep'(CF) :- nonvar(CF), !, '$set_yap_flags'(10,1), '$creep'. +'$cont_creep'( _) :- '$access_yap_flags'(10,1), !, '$creep'. +'$cont_creep'( _). '$set_creep'(0) :- !, '$set_yap_flags'(10,0). '$set_creep'(_). @@ -737,12 +738,12 @@ debugging :- '$creep'([_|'$leave_creep']) :- !. '$creep'(G) :- '$direct_spy'(G). -'$trace'(P,'!'(_),Mod,L) :- !, - '$trace'(P,!,Mod,L). -'$trace'(P,G,Mod,L) :- +'$trace'(P,'!'(_),Mod,L,NC) :- !, + '$trace'(P,!,Mod,L,NC). +'$trace'(P,G,Mod,L,NC) :- '$chk'(P,L,G,Mod,SL), - '$msg'(P,G,Mod,L,SL). -'$trace'(_,_,_,_). + '$msg'(P,G,Mod,L,SL,NC), !. +'$trace'(_,_,_,_,_). '$handle_signals'([]). '$handle_signals'([S|Rest]) :- @@ -751,7 +752,7 @@ debugging :- '$handle_signals'(Rest). '$handle_signals'([_|Rest]) :- '$handle_signals'(Rest). -'$msg'(P,G,Module,L,SL):- +'$msg'(P,G,Module,L,SL,NC):- flush_output(user_output), flush_output(user_error), '$get_value'(debug,1), @@ -770,10 +771,10 @@ debugging :- nl(user_error) ; write(user_error,' ? '), get0(user_input,C), - '$action'(C,P,L,G), + '$action'(C,P,L,G,NC), '$skipeol'(C) - ) , - !, fail. + ), + !. '$unleashed'(call) :- '$get_value'('$leash',L), L /\ 2'1000 =:= 0. '$unleashed'(exit) :- '$get_value'('$leash',L), L /\ 2'0100 =:= 0. @@ -816,9 +817,8 @@ debugging :- '$skipeol'(10) :- !. '$skipeol'(_) :- get0(user,C), '$skipeol'(C). -'$action'(10,_,_,_) :- !, % newline creep - '$set_yap_flags'(10,1). -'$action'(33,_,_,_) :- !, % ! g execute +'$action'(10,_,_,_,continue) :- !. % newline creep +'$action'(33,_,_,_,_) :- !, % ! g execute read(user,G), % don't allow yourself to be caught by creep. '$access_yap_flags'(10, CL), @@ -826,83 +826,81 @@ debugging :- ( '$execute'(G) -> true ; true), '$set_yap_flags'(10, CL), !, fail. -'$action'(60,_,_,_) :- !, %