debugger
This commit is contained in:
parent
0e47ddc802
commit
69dc2a963c
5
H/ATOMS
5
H/ATOMS
|
@ -91,6 +91,7 @@ A Context N "context"
|
||||||
A Cputime N "cputime"
|
A Cputime N "cputime"
|
||||||
A Create N "create"
|
A Create N "create"
|
||||||
A Creep F "$creep"
|
A Creep F "$creep"
|
||||||
|
A UserCreep N "creep"
|
||||||
A CryptAtoms N "crypt_atoms"
|
A CryptAtoms N "crypt_atoms"
|
||||||
A Curly N "{}"
|
A Curly N "{}"
|
||||||
A Csult F "$csult"
|
A Csult F "$csult"
|
||||||
|
@ -222,6 +223,7 @@ A LOOP N "_LOOP_"
|
||||||
A LoopStream N "loop_stream"
|
A LoopStream N "loop_stream"
|
||||||
A LT N "<"
|
A LT N "<"
|
||||||
A LastExecuteWithin F "$last_execute_within"
|
A LastExecuteWithin F "$last_execute_within"
|
||||||
|
A Leap N "leap"
|
||||||
A Leash F "$leash"
|
A Leash F "$leash"
|
||||||
A Least N "least"
|
A Least N "least"
|
||||||
A Length F "length"
|
A Length F "length"
|
||||||
|
@ -454,6 +456,7 @@ A WriteTerm N "write_term"
|
||||||
A Xml N "xml"
|
A Xml N "xml"
|
||||||
A YapHacks N "yap_hacks"
|
A YapHacks N "yap_hacks"
|
||||||
A ZeroDivisor N "zero_divisor"
|
A ZeroDivisor N "zero_divisor"
|
||||||
|
A Zip N "zip"
|
||||||
F AfInet AfInet 2
|
F AfInet AfInet 2
|
||||||
F AfLocal AfLocal 1
|
F AfLocal AfLocal 1
|
||||||
F AfUnix AfUnix 1
|
F AfUnix AfUnix 1
|
||||||
|
@ -486,7 +489,7 @@ F Comma Comma 2
|
||||||
F CommentHook CommentHook 3
|
F CommentHook CommentHook 3
|
||||||
F Context2 Context 2
|
F Context2 Context 2
|
||||||
F ConsistencyError ConsistencyError 1
|
F ConsistencyError ConsistencyError 1
|
||||||
F Creep Creep 1
|
F Creep Creep 4
|
||||||
F Csult Csult 2
|
F Csult Csult 2
|
||||||
F CurrentModule CurrentModule 1
|
F CurrentModule CurrentModule 1
|
||||||
F CutBy CutBy 1
|
F CutBy CutBy 1
|
||||||
|
|
12
H/amidefs.h
12
H/amidefs.h
|
@ -1043,4 +1043,16 @@ extern void **Yap_ABSMI_OPCODES;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/// Debugging Support
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
DEBUG_CREEP_LEAP_OR_ZIP = 0,
|
||||||
|
DEBUG_GOAL_NUMBER = 1,
|
||||||
|
DEBUG_SPY = 2,
|
||||||
|
DEBUG_TRACE_MODE = 3,
|
||||||
|
DEBUG_GOAL_QUEUE = 4,
|
||||||
|
DEBUG_DEBUGGER_MAY_BE_CALLED = 5,
|
||||||
|
DEBUG_NUMBER_OF_OPTS =6
|
||||||
|
} debug_key_t ;
|
||||||
|
|
||||||
#endif
|
#endif
|
|
@ -86,6 +86,7 @@
|
||||||
AtomCputime = Yap_LookupAtom("cputime"); TermCputime = MkAtomTerm(AtomCputime);
|
AtomCputime = Yap_LookupAtom("cputime"); TermCputime = MkAtomTerm(AtomCputime);
|
||||||
AtomCreate = Yap_LookupAtom("create"); TermCreate = MkAtomTerm(AtomCreate);
|
AtomCreate = Yap_LookupAtom("create"); TermCreate = MkAtomTerm(AtomCreate);
|
||||||
AtomCreep = Yap_FullLookupAtom("$creep"); TermCreep = MkAtomTerm(AtomCreep);
|
AtomCreep = Yap_FullLookupAtom("$creep"); TermCreep = MkAtomTerm(AtomCreep);
|
||||||
|
AtomUserCreep = Yap_LookupAtom("creep"); TermUserCreep = MkAtomTerm(AtomUserCreep);
|
||||||
AtomCryptAtoms = Yap_LookupAtom("crypt_atoms"); TermCryptAtoms = MkAtomTerm(AtomCryptAtoms);
|
AtomCryptAtoms = Yap_LookupAtom("crypt_atoms"); TermCryptAtoms = MkAtomTerm(AtomCryptAtoms);
|
||||||
AtomCurly = Yap_LookupAtom("{}"); TermCurly = MkAtomTerm(AtomCurly);
|
AtomCurly = Yap_LookupAtom("{}"); TermCurly = MkAtomTerm(AtomCurly);
|
||||||
AtomCsult = Yap_FullLookupAtom("$csult"); TermCsult = MkAtomTerm(AtomCsult);
|
AtomCsult = Yap_FullLookupAtom("$csult"); TermCsult = MkAtomTerm(AtomCsult);
|
||||||
|
@ -216,6 +217,7 @@
|
||||||
AtomLoopStream = Yap_LookupAtom("loop_stream"); TermLoopStream = MkAtomTerm(AtomLoopStream);
|
AtomLoopStream = Yap_LookupAtom("loop_stream"); TermLoopStream = MkAtomTerm(AtomLoopStream);
|
||||||
AtomLT = Yap_LookupAtom("<"); TermLT = MkAtomTerm(AtomLT);
|
AtomLT = Yap_LookupAtom("<"); TermLT = MkAtomTerm(AtomLT);
|
||||||
AtomLastExecuteWithin = Yap_FullLookupAtom("$last_execute_within"); TermLastExecuteWithin = MkAtomTerm(AtomLastExecuteWithin);
|
AtomLastExecuteWithin = Yap_FullLookupAtom("$last_execute_within"); TermLastExecuteWithin = MkAtomTerm(AtomLastExecuteWithin);
|
||||||
|
AtomLeap = Yap_LookupAtom("leap"); TermLeap = MkAtomTerm(AtomLeap);
|
||||||
AtomLeash = Yap_FullLookupAtom("$leash"); TermLeash = MkAtomTerm(AtomLeash);
|
AtomLeash = Yap_FullLookupAtom("$leash"); TermLeash = MkAtomTerm(AtomLeash);
|
||||||
AtomLeast = Yap_LookupAtom("least"); TermLeast = MkAtomTerm(AtomLeast);
|
AtomLeast = Yap_LookupAtom("least"); TermLeast = MkAtomTerm(AtomLeast);
|
||||||
AtomLength = Yap_FullLookupAtom("length"); TermLength = MkAtomTerm(AtomLength);
|
AtomLength = Yap_FullLookupAtom("length"); TermLength = MkAtomTerm(AtomLength);
|
||||||
|
@ -448,6 +450,7 @@
|
||||||
AtomXml = Yap_LookupAtom("xml"); TermXml = MkAtomTerm(AtomXml);
|
AtomXml = Yap_LookupAtom("xml"); TermXml = MkAtomTerm(AtomXml);
|
||||||
AtomYapHacks = Yap_LookupAtom("yap_hacks"); TermYapHacks = MkAtomTerm(AtomYapHacks);
|
AtomYapHacks = Yap_LookupAtom("yap_hacks"); TermYapHacks = MkAtomTerm(AtomYapHacks);
|
||||||
AtomZeroDivisor = Yap_LookupAtom("zero_divisor"); TermZeroDivisor = MkAtomTerm(AtomZeroDivisor);
|
AtomZeroDivisor = Yap_LookupAtom("zero_divisor"); TermZeroDivisor = MkAtomTerm(AtomZeroDivisor);
|
||||||
|
AtomZip = Yap_LookupAtom("zip"); TermZip = MkAtomTerm(AtomZip);
|
||||||
FunctorAfInet = Yap_MkFunctor(AtomAfInet,2);
|
FunctorAfInet = Yap_MkFunctor(AtomAfInet,2);
|
||||||
FunctorAfLocal = Yap_MkFunctor(AtomAfLocal,1);
|
FunctorAfLocal = Yap_MkFunctor(AtomAfLocal,1);
|
||||||
FunctorAfUnix = Yap_MkFunctor(AtomAfUnix,1);
|
FunctorAfUnix = Yap_MkFunctor(AtomAfUnix,1);
|
||||||
|
@ -480,7 +483,7 @@
|
||||||
FunctorCommentHook = Yap_MkFunctor(AtomCommentHook,3);
|
FunctorCommentHook = Yap_MkFunctor(AtomCommentHook,3);
|
||||||
FunctorContext2 = Yap_MkFunctor(AtomContext,2);
|
FunctorContext2 = Yap_MkFunctor(AtomContext,2);
|
||||||
FunctorConsistencyError = Yap_MkFunctor(AtomConsistencyError,1);
|
FunctorConsistencyError = Yap_MkFunctor(AtomConsistencyError,1);
|
||||||
FunctorCreep = Yap_MkFunctor(AtomCreep,1);
|
FunctorCreep = Yap_MkFunctor(AtomCreep,4);
|
||||||
FunctorCsult = Yap_MkFunctor(AtomCsult,2);
|
FunctorCsult = Yap_MkFunctor(AtomCsult,2);
|
||||||
FunctorCurrentModule = Yap_MkFunctor(AtomCurrentModule,1);
|
FunctorCurrentModule = Yap_MkFunctor(AtomCurrentModule,1);
|
||||||
FunctorCutBy = Yap_MkFunctor(AtomCutBy,1);
|
FunctorCutBy = Yap_MkFunctor(AtomCutBy,1);
|
||||||
|
|
|
@ -86,6 +86,7 @@
|
||||||
AtomCputime = AtomAdjust(AtomCputime); TermCputime = MkAtomTerm(AtomCputime);
|
AtomCputime = AtomAdjust(AtomCputime); TermCputime = MkAtomTerm(AtomCputime);
|
||||||
AtomCreate = AtomAdjust(AtomCreate); TermCreate = MkAtomTerm(AtomCreate);
|
AtomCreate = AtomAdjust(AtomCreate); TermCreate = MkAtomTerm(AtomCreate);
|
||||||
AtomCreep = AtomAdjust(AtomCreep); TermCreep = MkAtomTerm(AtomCreep);
|
AtomCreep = AtomAdjust(AtomCreep); TermCreep = MkAtomTerm(AtomCreep);
|
||||||
|
AtomUserCreep = AtomAdjust(AtomUserCreep); TermUserCreep = MkAtomTerm(AtomUserCreep);
|
||||||
AtomCryptAtoms = AtomAdjust(AtomCryptAtoms); TermCryptAtoms = MkAtomTerm(AtomCryptAtoms);
|
AtomCryptAtoms = AtomAdjust(AtomCryptAtoms); TermCryptAtoms = MkAtomTerm(AtomCryptAtoms);
|
||||||
AtomCurly = AtomAdjust(AtomCurly); TermCurly = MkAtomTerm(AtomCurly);
|
AtomCurly = AtomAdjust(AtomCurly); TermCurly = MkAtomTerm(AtomCurly);
|
||||||
AtomCsult = AtomAdjust(AtomCsult); TermCsult = MkAtomTerm(AtomCsult);
|
AtomCsult = AtomAdjust(AtomCsult); TermCsult = MkAtomTerm(AtomCsult);
|
||||||
|
@ -216,6 +217,7 @@
|
||||||
AtomLoopStream = AtomAdjust(AtomLoopStream); TermLoopStream = MkAtomTerm(AtomLoopStream);
|
AtomLoopStream = AtomAdjust(AtomLoopStream); TermLoopStream = MkAtomTerm(AtomLoopStream);
|
||||||
AtomLT = AtomAdjust(AtomLT); TermLT = MkAtomTerm(AtomLT);
|
AtomLT = AtomAdjust(AtomLT); TermLT = MkAtomTerm(AtomLT);
|
||||||
AtomLastExecuteWithin = AtomAdjust(AtomLastExecuteWithin); TermLastExecuteWithin = MkAtomTerm(AtomLastExecuteWithin);
|
AtomLastExecuteWithin = AtomAdjust(AtomLastExecuteWithin); TermLastExecuteWithin = MkAtomTerm(AtomLastExecuteWithin);
|
||||||
|
AtomLeap = AtomAdjust(AtomLeap); TermLeap = MkAtomTerm(AtomLeap);
|
||||||
AtomLeash = AtomAdjust(AtomLeash); TermLeash = MkAtomTerm(AtomLeash);
|
AtomLeash = AtomAdjust(AtomLeash); TermLeash = MkAtomTerm(AtomLeash);
|
||||||
AtomLeast = AtomAdjust(AtomLeast); TermLeast = MkAtomTerm(AtomLeast);
|
AtomLeast = AtomAdjust(AtomLeast); TermLeast = MkAtomTerm(AtomLeast);
|
||||||
AtomLength = AtomAdjust(AtomLength); TermLength = MkAtomTerm(AtomLength);
|
AtomLength = AtomAdjust(AtomLength); TermLength = MkAtomTerm(AtomLength);
|
||||||
|
@ -447,6 +449,7 @@
|
||||||
AtomWriteTerm = AtomAdjust(AtomWriteTerm); TermWriteTerm = MkAtomTerm(AtomWriteTerm);
|
AtomWriteTerm = AtomAdjust(AtomWriteTerm); TermWriteTerm = MkAtomTerm(AtomWriteTerm);
|
||||||
AtomXml = AtomAdjust(AtomXml); TermXml = MkAtomTerm(AtomXml);
|
AtomXml = AtomAdjust(AtomXml); TermXml = MkAtomTerm(AtomXml);
|
||||||
AtomYapHacks = AtomAdjust(AtomYapHacks); TermYapHacks = MkAtomTerm(AtomYapHacks);
|
AtomYapHacks = AtomAdjust(AtomYapHacks); TermYapHacks = MkAtomTerm(AtomYapHacks);
|
||||||
|
AtomZip = AtomAdjust(AtomZip); TermZip = MkAtomTerm(AtomZip);
|
||||||
AtomZeroDivisor = AtomAdjust(AtomZeroDivisor); TermZeroDivisor = MkAtomTerm(AtomZeroDivisor);
|
AtomZeroDivisor = AtomAdjust(AtomZeroDivisor); TermZeroDivisor = MkAtomTerm(AtomZeroDivisor);
|
||||||
FunctorAfInet = FuncAdjust(FunctorAfInet);
|
FunctorAfInet = FuncAdjust(FunctorAfInet);
|
||||||
FunctorAfLocal = FuncAdjust(FunctorAfLocal);
|
FunctorAfLocal = FuncAdjust(FunctorAfLocal);
|
||||||
|
|
|
@ -85,7 +85,8 @@ X_API EXTERNAL Atom AtomConsultOnBoot; X_API EXTERNAL Term TermConsultOnBoot;
|
||||||
X_API EXTERNAL Atom AtomContext; X_API EXTERNAL Term TermContext;
|
X_API EXTERNAL Atom AtomContext; X_API EXTERNAL Term TermContext;
|
||||||
X_API EXTERNAL Atom AtomCputime; X_API EXTERNAL Term TermCputime;
|
X_API EXTERNAL Atom AtomCputime; X_API EXTERNAL Term TermCputime;
|
||||||
X_API EXTERNAL Atom AtomCreate; X_API EXTERNAL Term TermCreate;
|
X_API EXTERNAL Atom AtomCreate; X_API EXTERNAL Term TermCreate;
|
||||||
X_API EXTERNAL Atom AtomCreep; X_API EXTERNAL Term TermCreep;
|
X_API EXTERNAL Atom AtomCreep; X_API EXTERNAL Term TermCreep;
|
||||||
|
X_API EXTERNAL Atom AtomUserCreep; X_API EXTERNAL Term TermUserCreep;
|
||||||
X_API EXTERNAL Atom AtomCryptAtoms; X_API EXTERNAL Term TermCryptAtoms;
|
X_API EXTERNAL Atom AtomCryptAtoms; X_API EXTERNAL Term TermCryptAtoms;
|
||||||
X_API EXTERNAL Atom AtomCurly; X_API EXTERNAL Term TermCurly;
|
X_API EXTERNAL Atom AtomCurly; X_API EXTERNAL Term TermCurly;
|
||||||
X_API EXTERNAL Atom AtomCsult; X_API EXTERNAL Term TermCsult;
|
X_API EXTERNAL Atom AtomCsult; X_API EXTERNAL Term TermCsult;
|
||||||
|
@ -216,7 +217,8 @@ X_API EXTERNAL Atom AtomLOOP; X_API EXTERNAL Term TermLOOP;
|
||||||
X_API EXTERNAL Atom AtomLoopStream; X_API EXTERNAL Term TermLoopStream;
|
X_API EXTERNAL Atom AtomLoopStream; X_API EXTERNAL Term TermLoopStream;
|
||||||
X_API EXTERNAL Atom AtomLT; X_API EXTERNAL Term TermLT;
|
X_API EXTERNAL Atom AtomLT; X_API EXTERNAL Term TermLT;
|
||||||
X_API EXTERNAL Atom AtomLastExecuteWithin; X_API EXTERNAL Term TermLastExecuteWithin;
|
X_API EXTERNAL Atom AtomLastExecuteWithin; X_API EXTERNAL Term TermLastExecuteWithin;
|
||||||
X_API EXTERNAL Atom AtomLeash; X_API EXTERNAL Term TermLeash;
|
X_API EXTERNAL Atom AtomLeash; X_API EXTERNAL Term TermLeash;
|
||||||
|
X_API EXTERNAL Atom AtomLeap; X_API EXTERNAL Term TermLeap;
|
||||||
X_API EXTERNAL Atom AtomLeast; X_API EXTERNAL Term TermLeast;
|
X_API EXTERNAL Atom AtomLeast; X_API EXTERNAL Term TermLeast;
|
||||||
X_API EXTERNAL Atom AtomLength; X_API EXTERNAL Term TermLength;
|
X_API EXTERNAL Atom AtomLength; X_API EXTERNAL Term TermLength;
|
||||||
X_API EXTERNAL Atom AtomList; X_API EXTERNAL Term TermList;
|
X_API EXTERNAL Atom AtomList; X_API EXTERNAL Term TermList;
|
||||||
|
@ -448,6 +450,8 @@ X_API EXTERNAL Atom AtomWriteTerm; X_API EXTERNAL Term TermWriteTerm;
|
||||||
X_API EXTERNAL Atom AtomXml; X_API EXTERNAL Term TermXml;
|
X_API EXTERNAL Atom AtomXml; X_API EXTERNAL Term TermXml;
|
||||||
X_API EXTERNAL Atom AtomYapHacks; X_API EXTERNAL Term TermYapHacks;
|
X_API EXTERNAL Atom AtomYapHacks; X_API EXTERNAL Term TermYapHacks;
|
||||||
X_API EXTERNAL Atom AtomZeroDivisor; X_API EXTERNAL Term TermZeroDivisor;
|
X_API EXTERNAL Atom AtomZeroDivisor; X_API EXTERNAL Term TermZeroDivisor;
|
||||||
|
X_API EXTERNAL Atom AtomZip; X_API EXTERNAL Term TermZip;
|
||||||
|
|
||||||
X_API EXTERNAL Functor FunctorAfInet;
|
X_API EXTERNAL Functor FunctorAfInet;
|
||||||
|
|
||||||
X_API EXTERNAL Functor FunctorAfLocal;
|
X_API EXTERNAL Functor FunctorAfLocal;
|
||||||
|
|
|
@ -33,6 +33,8 @@ LOCAL_INIT(bool, newline, true);
|
||||||
LOCAL_INIT(Atom, AtPrompt, AtomNil);
|
LOCAL_INIT(Atom, AtPrompt, AtomNil);
|
||||||
LOCAL_ARRAY(char, Prompt, MAX_PROMPT + 1);
|
LOCAL_ARRAY(char, Prompt, MAX_PROMPT + 1);
|
||||||
|
|
||||||
|
LOCAL_ARRAY(Term, debugger_state, DEBUG_NUMBER_OF_OPTS);
|
||||||
|
|
||||||
LOCAL_INITF(encoding_t, encoding, Yap_DefaultEncoding());
|
LOCAL_INITF(encoding_t, encoding, Yap_DefaultEncoding());
|
||||||
LOCAL_INIT(bool, quasi_quotations, false);
|
LOCAL_INIT(bool, quasi_quotations, false);
|
||||||
LOCAL_INIT(UInt, default_priority, 1200);
|
LOCAL_INIT(UInt, default_priority, 1200);
|
||||||
|
|
|
@ -473,7 +473,7 @@ b_getval(GlobalVariable, Val) :-
|
||||||
|
|
||||||
|
|
||||||
'$debug_stop' :-
|
'$debug_stop' :-
|
||||||
nb_setval('$debug_state', state(creep,0,stop)),
|
'$set_debugger_state'( zip,0,stop,off ),
|
||||||
b_setval('$trace',off),
|
b_setval('$trace',off),
|
||||||
set_prolog_flag(debug, false),
|
set_prolog_flag(debug, false),
|
||||||
b_setval('$spy_glist',[]),
|
b_setval('$spy_glist',[]),
|
||||||
|
|
131
pl/debug.yap
131
pl/debug.yap
|
@ -16,7 +16,7 @@
|
||||||
*************************************************************************/
|
*************************************************************************/
|
||||||
:- system_module('$_debug',
|
:- system_module('$_debug',
|
||||||
[],
|
[],
|
||||||
['$trace_query'/4, '$init_debugger'/0, '$skipeol'/1]).
|
['$trace_goal'/4, '$init_debugger'/0, '$skipeol'/1]).
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -252,7 +252,7 @@ be lost.
|
||||||
*
|
*
|
||||||
* The debugger is an interpreter. with main predicates:
|
* The debugger is an interpreter. with main predicates:
|
||||||
* - $trace: this is the API
|
* - $trace: this is the API
|
||||||
* - $trace_query: reduce a query to a goal
|
* - $trace_goal: reduce a query to a goal
|
||||||
* - $trace_goal: execute:
|
* - $trace_goal: execute:
|
||||||
* + using the source, Luke
|
* + using the source, Luke
|
||||||
* + hooking into the WAM procedure call mechanism
|
* + hooking into the WAM procedure call mechanism
|
||||||
|
@ -299,7 +299,7 @@ be lost.
|
||||||
%%! The first case matches system_predicates or zip
|
%%! The first case matches system_predicates or zip
|
||||||
'$trace'(Mod:G) :-
|
'$trace'(Mod:G) :-
|
||||||
'$$save_by'(CP),
|
'$$save_by'(CP),
|
||||||
'$trace_query'(G, Mod, CP, _G).
|
'$trace_goal'(G, Mod, CP, _G).
|
||||||
|
|
||||||
|
|
||||||
'$trace'(Mod:G, A1) :-
|
'$trace'(Mod:G, A1) :-
|
||||||
|
@ -394,64 +394,57 @@ be lost.
|
||||||
|
|
||||||
|
|
||||||
'$trace_meta_call'( G, M, CP ) :-
|
'$trace_meta_call'( G, M, CP ) :-
|
||||||
'$trace_query'(G, M, CP, _G ).
|
'$trace_goal'(G, M, CP, _G ).
|
||||||
|
|
||||||
%% @pred '$trace_query'( +G, +M, +CP, +Expanded)
|
|
||||||
|
'$creep'([M|Q]) :-
|
||||||
|
'$yap_strip_module'(G,M,Q),
|
||||||
|
'$current_choicepoint'(CP),
|
||||||
|
'$trace_goal'(Q, M, CP, _G ).
|
||||||
|
|
||||||
|
|
||||||
|
'$creep'(G0, M0, _CP, H) :-
|
||||||
|
'$yap_strip_module'(M0:G0, M, G), % spy a literal
|
||||||
|
'$id_goal'(L),
|
||||||
|
'$current_choicepoint'(CP),
|
||||||
|
'$trace_goal'(G, M, CP,L).
|
||||||
|
|
||||||
|
|
||||||
|
%% @pred '$trace_goal'( +G, +M, +CP, +Expanded)
|
||||||
%
|
%
|
||||||
% debug a complex query
|
% debug a complex query
|
||||||
%
|
%
|
||||||
'$trace_query'(V, M, _CP, _) :-
|
'$trace_goal'(V, M, _,_) :-
|
||||||
var(V),
|
var(V),
|
||||||
!,
|
!,
|
||||||
call(M:V).
|
call(M:V).
|
||||||
'$trace_query'(!, _, CP, _) :-
|
'$trace_goal'(!, _, _,CP) :-
|
||||||
!,
|
!,
|
||||||
'$$cut_by'(CP).
|
'$$cut_by'(CP).
|
||||||
'$trace_query'('$cut_by'(M), _, _, _) :-
|
'$trace_goal'('$cut_by'(M), _, _, _) :-
|
||||||
!,
|
!,
|
||||||
'$$cut_by'(M).
|
'$$cut_by'(M).
|
||||||
'$trace_query'('$$cut_by'(M), _, _, _) :-
|
'$trace_goal'('$$cut_by'(M), _, _, _) :-
|
||||||
!,
|
!,
|
||||||
'$$cut_by'(M).
|
'$$cut_by'(M).
|
||||||
'$trace_query'(M:G, _, CP,S) :-
|
'$trace_goal'(M:G, _, S, CP) :-
|
||||||
!,
|
!,
|
||||||
'$yap_strip_module'(M:G, M0, G0),
|
'$yap_strip_module'(M:G, M0, G0),
|
||||||
'$trace_query'(G0, M0, CP,S ).
|
'$trace_goal'(G0, M0, S, CP ).
|
||||||
'$trace_query'((A,B), M, CP, S) :- !,
|
'$trace_goal'((A,B), M, S, CP) :- !,
|
||||||
'$trace_query'(A, M, CP, S),
|
'$trace_goal'(A, M, S, CP),
|
||||||
'$trace_query'(B, M, CP, S).
|
'$trace_goal'(B, M, S, CP).
|
||||||
'$trace_query'((A->B), M, CP, S) :- !,
|
'$trace_goal'((A->B), M, S, CP) :- !,
|
||||||
'$trace_query'(A, M, CP, S) ->
|
'$trace_goal'(A, M, S, CP) ->
|
||||||
'$trace_query'(B, M, CP, S).
|
'$trace_goal'(B, M, S, CP).
|
||||||
'$trace_query'((A;B), M, CP, S) :- !,
|
'$trace_goal'((A;B), M, S, CP) :- !,
|
||||||
'$trace_query'(A, M, CP, S);
|
'$trace_goal'(A, M, S, CP);
|
||||||
'$trace_query'(B, M, CP, S).
|
'$trace_goal'(B, M, S, CP).
|
||||||
'$trace_query'((A|B), M, CP, S) :- !,
|
'$trace_goal'((A|B), M, S, CP) :- !,
|
||||||
'$trace_query'(A, M, CP, S);
|
'$trace_goal'(A, M, S, CP);
|
||||||
'$trace_query'(B, M, CP, S).
|
'$trace_goal'(B, M, S, CP).
|
||||||
'$trace_query'((\+ A), M, CP, S) :- !,
|
'$trace_goal'((\+ A), M, S, CP) :- !,
|
||||||
'$trace_query'(A, M, CP, S).
|
'$trace_goal'(A, M, S, CP).
|
||||||
'$trace_query'(G, M,_CP,S) :-
|
|
||||||
'$is_metapredicate'(G, prolog),
|
|
||||||
!,
|
|
||||||
'$debugger_expand_meta_call'(M:G, [], G1),
|
|
||||||
strip_module(M:G1, MF, NG),
|
|
||||||
% spy a literal
|
|
||||||
'$id_goal'(L),
|
|
||||||
catch(
|
|
||||||
'$trace_goal'(NG, MF, L, S),
|
|
||||||
E,
|
|
||||||
'$TraceError'(E, G, M, L, S)
|
|
||||||
).
|
|
||||||
'$trace_query'(G, M, _CP, H) :-
|
|
||||||
% spy a literal
|
|
||||||
'$id_goal'(L),
|
|
||||||
catch(
|
|
||||||
'$trace_goal'(G, M, L, H),
|
|
||||||
E,
|
|
||||||
'$TraceError'(E, G, M, L, H)
|
|
||||||
).
|
|
||||||
|
|
||||||
|
|
||||||
%% @pred $trace_goal( +Goal, +Module, +CallId, +CallInfo)
|
%% @pred $trace_goal( +Goal, +Module, +CallId, +CallInfo)
|
||||||
%%
|
%%
|
||||||
|
@ -465,8 +458,8 @@ be lost.
|
||||||
),
|
),
|
||||||
!,
|
!,
|
||||||
gated_call(
|
gated_call(
|
||||||
'$start_user_code',
|
'$set_debugger_state'(debug, false),
|
||||||
'$execute'(G,M),
|
'$execute_nonstop'(G,M),
|
||||||
Port,
|
Port,
|
||||||
'$reenter_debugger'(Port)
|
'$reenter_debugger'(Port)
|
||||||
).
|
).
|
||||||
|
@ -475,8 +468,7 @@ be lost.
|
||||||
'$creep_is_off'(M:G, GoalNumber),
|
'$creep_is_off'(M:G, GoalNumber),
|
||||||
!,
|
!,
|
||||||
gated_call(
|
gated_call(
|
||||||
'$start_user_code',
|
'$set_debugger_state'(debug, false),
|
||||||
% try creeping
|
|
||||||
'$execute_nonstop'(G,M),
|
'$execute_nonstop'(G,M),
|
||||||
Port,
|
Port,
|
||||||
'$trace_port_'( Port, GoalNumber, G, M, H)
|
'$trace_port_'( Port, GoalNumber, G, M, H)
|
||||||
|
@ -617,7 +609,7 @@ be lost.
|
||||||
|
|
||||||
|
|
||||||
%%% - abort: forward throw while the call is newer than goal
|
%%% - abort: forward throw while the call is newer than goal
|
||||||
%% @pred '$re_trace_query'( Exception, +Goal, +Mod, +GoalID )
|
%% @pred '$re_trace_goal'( Exception, +Goal, +Mod, +GoalID )
|
||||||
%
|
%
|
||||||
% debugger code for exceptions. Recognised cases are:
|
% debugger code for exceptions. Recognised cases are:
|
||||||
% - abort always forwarded
|
% - abort always forwarded
|
||||||
|
@ -678,7 +670,7 @@ be lost.
|
||||||
Goal.
|
Goal.
|
||||||
|
|
||||||
'$port'(_P, _G, _M,GoalNumber,_Determinic, _Info ) :- %%> leap
|
'$port'(_P, _G, _M,GoalNumber,_Determinic, _Info ) :- %%> leap
|
||||||
'__NB_getval__'('$debug_state',state(leap,Border,_,_), fail),
|
'$get_debugger_state'( leap,Border,_,_), fail ,
|
||||||
GoalNumber < Border,
|
GoalNumber < Border,
|
||||||
!.
|
!.
|
||||||
'$port'(P,G,Module,L,Deterministic, Info) :-
|
'$port'(P,G,Module,L,Deterministic, Info) :-
|
||||||
|
@ -720,7 +712,7 @@ be lost.
|
||||||
'$unleashed'(redo) :- get_value('$leash',L), L /\ 2'0010 =:= 0. %'
|
'$unleashed'(redo) :- get_value('$leash',L), L /\ 2'0010 =:= 0. %'
|
||||||
'$unleashed'(fail) :- get_value('$leash',L), L /\ 2'0001 =:= 0. %'
|
'$unleashed'(fail) :- get_value('$leash',L), L /\ 2'0001 =:= 0. %'
|
||||||
% the same as fail.
|
% the same as fail.
|
||||||
'$unleashed'(exception(_)) :- get_value('$leash',L), L /\ 2'10000 =:= 0. %'
|
'$unleashed'(exception(_)) :- get_value('$leash',L), L /\ 2'10000 =:= 0. %
|
||||||
|
|
||||||
'$debugger_write'(Stream, G) :-
|
'$debugger_write'(Stream, G) :-
|
||||||
current_prolog_flag( debugger_print_options, OUT ), !,
|
current_prolog_flag( debugger_print_options, OUT ), !,
|
||||||
|
@ -733,7 +725,7 @@ be lost.
|
||||||
'$action'(C,P,CallNumber,G,Module,H).
|
'$action'(C,P,CallNumber,G,Module,H).
|
||||||
'$action'('\n',_,_,_,_,_) :- !, % newline creep
|
'$action'('\n',_,_,_,_,_) :- !, % newline creep
|
||||||
'__NB_getval__'('$trace',Trace,fail),
|
'__NB_getval__'('$trace',Trace,fail),
|
||||||
'__NB_setval__'('$debug_state', state(creep, 0, stop, Trace)).
|
'$set_debugger_state'( creep, 0, stop, Trace ).
|
||||||
'$action'(!,_,_,_,_,_) :- !, % ! 'g execute
|
'$action'(!,_,_,_,_,_) :- !, % ! 'g execute
|
||||||
read(debugger_input, G),
|
read(debugger_input, G),
|
||||||
% don't allow yourself to be caught by creep.
|
% don't allow yourself to be caught by creep.
|
||||||
|
@ -750,7 +742,7 @@ be lost.
|
||||||
!, % <'Depth
|
!, % <'Depth
|
||||||
skip( debugger_input, 10),
|
skip( debugger_input, 10),
|
||||||
'__NB_getval__'('$trace',Trace,fail),
|
'__NB_getval__'('$trace',Trace,fail),
|
||||||
'__NB_setval__'('$debug_state', state(creep, 0, stop,Trace)).
|
'$set_debugger_state'( creep, 0, stop,Trace).
|
||||||
'$action'(^,_,_,G,_,_) :- !, % '
|
'$action'(^,_,_,G,_,_) :- !, % '
|
||||||
'$print_deb_sterm'(G),
|
'$print_deb_sterm'(G),
|
||||||
skip( debugger_input, 10),
|
skip( debugger_input, 10),
|
||||||
|
@ -771,7 +763,7 @@ be lost.
|
||||||
'$action'(c,_,_,_,_,_) :- !, % 'c creep
|
'$action'(c,_,_,_,_,_) :- !, % 'c creep
|
||||||
skip( debugger_input, 10),
|
skip( debugger_input, 10),
|
||||||
'__NB_getval__'('$trace',Trace,fail),
|
'__NB_getval__'('$trace',Trace,fail),
|
||||||
'__NB_setval__'('$debug_state',status(creep,0,stop,Trace)).
|
'$set_debugger_state'( creep,0,stop,Trace ).
|
||||||
'$action'(e,_,_,_,_,_) :- !, % 'e exit
|
'$action'(e,_,_,_,_,_) :- !, % 'e exit
|
||||||
halt.
|
halt.
|
||||||
'$action'(f,_,CallNumber,_,_,_) :- !, % 'f fail
|
'$action'(f,_,CallNumber,_,_,_) :- !, % 'f fail
|
||||||
|
@ -806,22 +798,22 @@ be lost.
|
||||||
'$scan_number'(ScanNumber),
|
'$scan_number'(ScanNumber),
|
||||||
( ScanNumber == 0 -> Goal = CallNumber ; Goal = ScanNumber ),
|
( ScanNumber == 0 -> Goal = CallNumber ; Goal = ScanNumber ),
|
||||||
'__NB_getval__'('$trace',Trace,fail),
|
'__NB_getval__'('$trace',Trace,fail),
|
||||||
'__NB_setval__'('$debug_state', state(leap, Goal, stop,Trace)).
|
'$set_debugger_state'( leap, Goal, stop,Trace ).
|
||||||
'$action'(z,_,_allNumber,_,_,_H) :- !, % 'z zip, fast leap
|
'$action'(z,_,_allNumber,_,_,_H) :- !, % 'z zip, fast leap
|
||||||
'__NB_getval__'('$trace',Trace,fail),
|
'__NB_getval__'('$trace',Trace,fail),
|
||||||
'__NB_setval__'('$debug_state', state(zip, 0, stop, Trace)).
|
'$set_debugger_state'( zip, 0, stop, Trace).
|
||||||
% skip first call (for current goal),
|
% skip first call (for current goal),
|
||||||
% stop next time.
|
% stop next time.
|
||||||
'$action'(k,_,_CallNumber,_,_,_) :- !, % 'k zip, fast leap
|
'$action'(k,_,_CallNumber,_,_,_) :- !, % 'k zip, fast leap
|
||||||
'__NB_getval__'('$trace',Trace,fail),
|
'__NB_getval__'('$trace',Trace,fail),
|
||||||
'__NB_setval__'('$debug_state', state(zip, 0, stop, Trace)).
|
'$set_debugger_state'( zip, 0, stop, Trace).
|
||||||
% skip first call (for current goal),
|
% skip first call (for current goal),
|
||||||
% stop next time.
|
% stop next time.
|
||||||
'$action'(n,_,_,_,_,_) :- !, % 'n nodebug
|
'$action'(n,_,_,_,_,_) :- !, % 'n nodebug
|
||||||
skip( debugger_input, 10), % '
|
skip( debugger_input, 10), % '
|
||||||
% tell debugger never to stop.
|
% tell debugger never to stop.
|
||||||
'__NB_getval__'('$trace',Trace,fail),
|
'__NB_getval__'('$trace',Trace,fail),
|
||||||
'__NB_setval__'('$debug_state', state(zip, 0, ignore, Trace)),
|
'$set_debugger_state'( zip, 0, ignore, Trace),
|
||||||
nodebug.
|
nodebug.
|
||||||
'$action'(r,_,CallNumber,_,_,_) :- !, % r retry
|
'$action'(r,_,CallNumber,_,_,_) :- !, % r retry
|
||||||
'$scan_number'(ScanNumber),
|
'$scan_number'(ScanNumber),
|
||||||
|
@ -832,7 +824,7 @@ be lost.
|
||||||
( ScanNumber == 0 -> Goal = CallNumber ; Goal = ScanNumber ),
|
( ScanNumber == 0 -> Goal = CallNumber ; Goal = ScanNumber ),
|
||||||
( (P==call; P==redo) ->
|
( (P==call; P==redo) ->
|
||||||
'__NB_getval__'('$trace',Trace,fail),
|
'__NB_getval__'('$trace',Trace,fail),
|
||||||
'__NB_setval__'('$debug_state', state(leap, Goal, ignore,Trace) ) ;
|
'$set_debugger_state'( leap, Goal, ignore,Trace),
|
||||||
'$ilgl'(s) % '
|
'$ilgl'(s) % '
|
||||||
).
|
).
|
||||||
'$action'(t,P,CallNumber,_,_,_) :- !, % 't fast skip
|
'$action'(t,P,CallNumber,_,_,_) :- !, % 't fast skip
|
||||||
|
@ -840,7 +832,7 @@ be lost.
|
||||||
( ScanNumber == 0 -> Goal = CallNumber ; Goal = ScanNumber ),
|
( ScanNumber == 0 -> Goal = CallNumber ; Goal = ScanNumber ),
|
||||||
( (P=call; P=redo) ->
|
( (P=call; P=redo) ->
|
||||||
'__NB_getval__'('$trace',Trace,fail),
|
'__NB_getval__'('$trace',Trace,fail),
|
||||||
'__NB_setval__'('$debug_state', state(zip, Goal, ignore,Trace)) ;
|
'$set_debugger_state'( zip, Goal, ignore,Trace),
|
||||||
'$ilgl'(t) % '
|
'$ilgl'(t) % '
|
||||||
).
|
).
|
||||||
'$action'(q,P,CallNumber,_,_,_) :- !, % 'qst skip
|
'$action'(q,P,CallNumber,_,_,_) :- !, % 'qst skip
|
||||||
|
@ -848,7 +840,7 @@ be lost.
|
||||||
( ScanNumber == 0 -> Goal = CallNumber ; Goal = ScanNumber ),
|
( ScanNumber == 0 -> Goal = CallNumber ; Goal = ScanNumber ),
|
||||||
( (P=call; P=redo) ->
|
( (P=call; P=redo) ->
|
||||||
'__NB_getval__'('$trace',Trace,fail),
|
'__NB_getval__'('$trace',Trace,fail),
|
||||||
'__NB_setval__'('$debug_state', state(leap, Goal, stop, Trace)) ;
|
'$set_debugger_state'( leap, Goal, stop, Trace),
|
||||||
'$ilgl'(t) % '
|
'$ilgl'(t) % '
|
||||||
).
|
).
|
||||||
'$action'(+,_,_,G,M,_) :- !, %% spy this
|
'$action'(+,_,_,G,M,_) :- !, %% spy this
|
||||||
|
@ -1019,11 +1011,11 @@ be lost.
|
||||||
'$cps'([]).
|
'$cps'([]).
|
||||||
|
|
||||||
|
|
||||||
'$debugger_skip_trace_query'([CP|CPs],CPs1) :-
|
'$debugger_skip_trace_goal'([CP|CPs],CPs1) :-
|
||||||
yap_hacks:choicepoint(CP,_,prolog,'$trace_query',4,(_;_),_),
|
yap_hacks:choicepoint(CP,_,prolog,'$trace_goal',4,(_;_),_),
|
||||||
!,
|
!,
|
||||||
'$debugger_skip_trace_query'(CPs,CPs1).
|
'$debugger_skip_trace_goal'(CPs,CPs1).
|
||||||
'$debugger_skip_trace_query'(CPs,CPs).
|
'$debugger_skip_trace_goal'(CPs,CPs).
|
||||||
|
|
||||||
'$debugger_skip_traces'([CP|CPs],CPs1) :-
|
'$debugger_skip_traces'([CP|CPs],CPs1) :-
|
||||||
yap_hacks:choicepoint(CP,_,prolog,'$port',4,(_;_),_),
|
yap_hacks:choicepoint(CP,_,prolog,'$port',4,(_;_),_),
|
||||||
|
@ -1069,10 +1061,5 @@ be lost.
|
||||||
'$ldebugger_process_meta_args'([G|BGs], M, [_|BMs], [G|BG1s]) :-
|
'$ldebugger_process_meta_args'([G|BGs], M, [_|BMs], [G|BG1s]) :-
|
||||||
'$ldebugger_process_meta_args'(BGs, M, BMs, BG1s).
|
'$ldebugger_process_meta_args'(BGs, M, BMs, BG1s).
|
||||||
|
|
||||||
|
|
||||||
'$creep'(creep) :- '$creep'.
|
|
||||||
'$creep'(leap) :- '$creep'.
|
|
||||||
'$creep'(zip).
|
|
||||||
|
|
||||||
%% @}
|
%% @}
|
||||||
%% @}
|
%% @}
|
||||||
|
|
|
@ -248,7 +248,7 @@ top_query(G) :-
|
||||||
nb_setval('$debug_run',off),
|
nb_setval('$debug_run',off),
|
||||||
nb_setval('$debug_jump',off),
|
nb_setval('$debug_jump',off),
|
||||||
'__NB_setval__'('$trace',off),
|
'__NB_setval__'('$trace',off),
|
||||||
nb_setval('$debug_state', state(zip, 0, stop,off)),
|
'$set_debugger_state'( zip, 0, stop,off),
|
||||||
set_prolog_flag(break_level, 0),
|
set_prolog_flag(break_level, 0),
|
||||||
catch(user:G, Error, '$Error'(Error)).
|
catch(user:G, Error, '$Error'(Error)).
|
||||||
|
|
||||||
|
|
|
@ -42,15 +42,19 @@ prolog:'$protect' :-
|
||||||
new_system_module( M ),
|
new_system_module( M ),
|
||||||
fail.
|
fail.
|
||||||
prolog:'$protect' :-
|
prolog:'$protect' :-
|
||||||
'$current_predicate'(Name,M,P,_),
|
'$current_predicate'(Name,M,P,_),
|
||||||
'$is_system_module'(M),
|
'$is_system_module'(M),
|
||||||
functor(P,Name,Arity),
|
functor(P,Name,Arity),
|
||||||
'$new_system_predicate'(Name,Arity,M),
|
'$new_system_predicate'(Name,Arity,M),
|
||||||
sub_atom(Name,0,1,_, '$'),
|
|
||||||
functor(P,Name,Arity),
|
|
||||||
'$stash_predicate'(P,M),
|
|
||||||
% '$hide_predicate'(P,M),
|
% '$hide_predicate'(P,M),
|
||||||
fail.
|
fail.
|
||||||
|
prolog:'$protect' :-
|
||||||
|
'$current_predicate'(Name,M,P,_),
|
||||||
|
'$is_system_module'(M),
|
||||||
|
functor(P,Name,Arity),
|
||||||
|
\+ '$visible'(Name),
|
||||||
|
'$set_private'(P,M),
|
||||||
|
fail.
|
||||||
prolog:'$protect' :-
|
prolog:'$protect' :-
|
||||||
current_atom(Name),
|
current_atom(Name),
|
||||||
sub_atom(Name,0,1,_, '$'),
|
sub_atom(Name,0,1,_, '$'),
|
||||||
|
|
36
pl/spy.yap
36
pl/spy.yap
|
@ -206,11 +206,10 @@ debug :-
|
||||||
|
|
||||||
'$start_user_code' :-
|
'$start_user_code' :-
|
||||||
yap_flag(debug, Can),
|
yap_flag(debug, Can),
|
||||||
'__NB_setval__'(debug, Can),
|
'$set_debugger_state'(debug, Can),
|
||||||
'__NB_getval__'('$trace',Trace, fail),
|
'__NB_getval__'('$trace',Trace, fail),
|
||||||
( Trace == on -> Creep = creep; Creep = zip ),
|
( Trace == on -> Creep = creep; Creep = zip ),
|
||||||
'__NB_setval__'('$debug_state',state(Creep,0,stop,Trace) ).
|
'$set_debugger_state'( Creep, 0, stop, Trace ).
|
||||||
|
|
||||||
nodebug :-
|
nodebug :-
|
||||||
set_prolog_flag(debug, false),
|
set_prolog_flag(debug, false),
|
||||||
'$init_debugger',
|
'$init_debugger',
|
||||||
|
@ -378,13 +377,13 @@ notrace(G) :-
|
||||||
).
|
).
|
||||||
|
|
||||||
'$creep_at_port'(retry) :-
|
'$creep_at_port'(retry) :-
|
||||||
'__NB_getval__'(debug, true, fail),
|
'$get_debugger_state'(debug, true),
|
||||||
'__NB_getval__'('$trace',Trace,fail),
|
'__NB_getval__'('$trace',Trace,fail),
|
||||||
Trace = on,
|
Trace = on,
|
||||||
!,
|
!,
|
||||||
'$enable_debugging'.
|
'$enable_debugging'.
|
||||||
'$creep_at_port'(fail) :-
|
'$creep_at_port'(fail) :-
|
||||||
'__NB_getval__'(debug, true, fail),
|
'$get_debugger_state'(debug, true),
|
||||||
'__NB_getval__'('$trace',Trace,fail),
|
'__NB_getval__'('$trace',Trace,fail),
|
||||||
Trace = on,
|
Trace = on,
|
||||||
!,
|
!,
|
||||||
|
@ -400,10 +399,10 @@ notrace(G) :-
|
||||||
'$init_debugger_trace' :-
|
'$init_debugger_trace' :-
|
||||||
'__NB_getval__'('$trace',on,fail),
|
'__NB_getval__'('$trace',on,fail),
|
||||||
!,
|
!,
|
||||||
nb_setval('$debug_state', state(creep, 0, stop, on)).
|
'$set_debugger_state'( creep, 0, stop, on ).
|
||||||
'$init_debugger_trace' :-
|
'$init_debugger_trace' :-
|
||||||
'__NB_setval__'('$trace',off),
|
'__NB_setval__'('$trace',off),
|
||||||
nb_setval('$debug_state', state(zip, 0, stop, off)).
|
'$set_debugger_state'( zip, 0, stop, off ).
|
||||||
|
|
||||||
%% @pred $enter_debugging(G,Mod,CP,G0,NG)
|
%% @pred $enter_debugging(G,Mod,CP,G0,NG)
|
||||||
%%
|
%%
|
||||||
|
@ -448,7 +447,7 @@ notrace(G) :-
|
||||||
'$reenter_debugger'(fail) :-
|
'$reenter_debugger'(fail) :-
|
||||||
'$re_enter_creep_mode'.
|
'$re_enter_creep_mode'.
|
||||||
'$reenter_debugger'(_) :-
|
'$reenter_debugger'(_) :-
|
||||||
'__NB_setval__'(debug, false).
|
'$set_debugger_state'(debug, false).
|
||||||
|
|
||||||
% what to do when you exit the debugger.
|
% what to do when you exit the debugger.
|
||||||
'$continue_debugging'(exit) :-
|
'$continue_debugging'(exit) :-
|
||||||
|
@ -486,29 +485,29 @@ notrace(G) :-
|
||||||
current_prolog_flag( debug, false )
|
current_prolog_flag( debug, false )
|
||||||
-> true
|
-> true
|
||||||
;
|
;
|
||||||
'$is_opaque_zpredicate'(G,Module)
|
'$is_opaque_predicate'(G,Module)
|
||||||
-> true
|
-> true
|
||||||
;
|
;
|
||||||
'$is_private'(G,Module)
|
'$is_private'(G,Module)
|
||||||
-> true
|
-> true
|
||||||
;
|
;
|
||||||
'__NB_getval__'('$debug_state',state(zip, GN, Spy,_), fail)
|
'$get_debugger_state'( creep, zip ) ->
|
||||||
->
|
|
||||||
true
|
true
|
||||||
;
|
;
|
||||||
'$pred_being_spied'(G,Module)
|
'$pred_being_spied'(G,Module)
|
||||||
->
|
->
|
||||||
Spy == ignore
|
'$get_debugger_state'( spy, ignore )
|
||||||
;
|
;
|
||||||
var(GN)
|
var(GN)
|
||||||
->
|
->
|
||||||
false
|
false
|
||||||
;
|
;
|
||||||
GN > GoalNo
|
'$get_debugger_state'( goal_number, GoalNo ) ,
|
||||||
|
GN < GoalNo
|
||||||
).
|
).
|
||||||
'$creep_is_on_at_entry'(G,M,_GoalNo) :-
|
'$creep_is_on_at_entry'(G,M,_GoalNo) :-
|
||||||
\+ '$is_system_predicate'(G,M),
|
\+ '$is_system_predicate'(G,M),
|
||||||
'__NB_getval__'('$debug_state',state(Step, _GN, Spy,_), fail),
|
'$get_debugger_state'(Step, _GN, Spy,_),
|
||||||
(
|
(
|
||||||
Step \= zip
|
Step \= zip
|
||||||
;
|
;
|
||||||
|
@ -518,13 +517,14 @@ notrace(G) :-
|
||||||
|
|
||||||
|
|
||||||
'$trace_on' :-
|
'$trace_on' :-
|
||||||
'__NB_getval__'('$debug_state', state(_Creep, GN, Spy,Trace), fail),
|
'$get_debugger_state'(_Creep, GN, Spy,Trace),
|
||||||
nb_setval('$trace',on),
|
nb_setval('$trace',on),
|
||||||
nb_setval('$debug_state', state(creep, GN, Spy, Trace)).
|
'$set_debugger_state'( creep, GN, Spy, Trace).
|
||||||
|
|
||||||
'$trace_off' :-
|
'$trace_off' :-
|
||||||
'__NB_getval__'('$debug_state', state(_Creep, GN, Spy, Trace),fail),
|
'$get_debugger_state'( _Creep, GN, Spy, Trace),
|
||||||
nb_setval('$debug_state', state(zip, GN, Spy,Trace)).
|
nb_setval('$trace',off),
|
||||||
|
'$set_debugger_state'( creep, GN, Spy, Trace).
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
||||||
|
|
17
pl/top.yap
17
pl/top.yap
|
@ -44,7 +44,7 @@ live :-
|
||||||
|
|
||||||
/* main execution loop */
|
/* main execution loop */
|
||||||
'$read_toplevel'(Goal, Bindings, Pos) :-
|
'$read_toplevel'(Goal, Bindings, Pos) :-
|
||||||
'$prompt',
|
'$prompt',
|
||||||
catch(read_term(user_input,
|
catch(read_term(user_input,
|
||||||
Goal,
|
Goal,
|
||||||
|
|
||||||
|
@ -577,18 +577,9 @@ write_query_answer( Bindings ) :-
|
||||||
'$current_choice_point'(CP),
|
'$current_choice_point'(CP),
|
||||||
'$call'(G, CP, G, M).
|
'$call'(G, CP, G, M).
|
||||||
|
|
||||||
'$user_call'(G, CP, G0, M) :-
|
|
||||||
catch('$trace_query'(G, M, CP, G0), E, '$Error'(E)).
|
|
||||||
|
|
||||||
'$user_call'(G, M) :-
|
'$user_call'(G, M) :-
|
||||||
(
|
'$current_choice_point'(CP),
|
||||||
'$creep_is_off'(Module:G, GoalNo)
|
gated_call('$start_user_code',M:G,Port,'$reenter_debugger'(Port)).
|
||||||
->
|
|
||||||
gated_call('$start_user_code',call(M:G),Port,'$reenter_debugger'(Port))
|
|
||||||
;
|
|
||||||
|
|
||||||
'$trace'(M:G)
|
|
||||||
).
|
|
||||||
|
|
||||||
'$cut_by'(CP) :- '$$cut_by'(CP).
|
'$cut_by'(CP) :- '$$cut_by'(CP).
|
||||||
|
|
||||||
|
@ -1017,7 +1008,7 @@ log_event( String, Args ) :-
|
||||||
DBON = true
|
DBON = true
|
||||||
->
|
->
|
||||||
(
|
(
|
||||||
'__NB_getval__'('$debug_state',state( _, _, _,on), fail),
|
'$get_debugger_state'( trace,on),
|
||||||
(
|
(
|
||||||
var(LF)
|
var(LF)
|
||||||
->
|
->
|
||||||
|
|
Reference in New Issue