fix debugging in the presence of goal_expansion

git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@432 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
vsc 2002-04-06 05:33:44 +00:00
parent ec120bccac
commit 3ef0b143b0
4 changed files with 34 additions and 15 deletions

View File

@ -190,10 +190,11 @@ p_save_cp(void)
return(TRUE); return(TRUE);
} }
inline static Int static Int
EnterCreepMode(SMALLUNSGN mod) { EnterCreepMode(SMALLUNSGN mod) {
PredEntry *PredSpy = RepPredProp(PredPropByFunc(FunctorSpy,0)); PredEntry *PredSpy = RepPredProp(PredPropByFunc(FunctorSpy,0));
ARG1 = MkPairTerm(ModuleName[mod],ARG1); Term tn = MkApplTerm(MkFunctor(AtomMetaCall,1),1,&ARG1);
ARG1 = MkPairTerm(ModuleName[mod],tn);
CreepFlag = CalculateStackGap(); CreepFlag = CalculateStackGap();
P_before_spy = P; P_before_spy = P;
return (CallPredicate(PredSpy, B)); return (CallPredicate(PredSpy, B));
@ -1189,6 +1190,7 @@ p_restore_regs(void)
static Int static Int
p_restore_regs2(void) p_restore_regs2(void)
{ {
Term t = Deref(ARG1), d0; Term t = Deref(ARG1), d0;
choiceptr pt0; choiceptr pt0;
if (IsVarTerm(t)) { if (IsVarTerm(t)) {

View File

@ -750,7 +750,8 @@ not(A) :-
% this is a meta-predicate % this is a meta-predicate
'$flags'(A,CurMod,F,_), F /\ 0x200000 =:= 0x200000 '$flags'(A,CurMod,F,_), F /\ 0x200000 =:= 0x200000
), !, ), !,
'$exec_with_expansion'(A, CurMod, CurMod). '$expand_goal'(A, CurMod, CurMod, NG, NMod),
'$execute0'(NG, NMod).
'$call'(A, _, _, M) :- '$call'(A, _, _, M) :-
'$execute0'(A, M). '$execute0'(A, M).
@ -799,7 +800,8 @@ not(A) :-
% this is a meta-predicate % this is a meta-predicate
'$flags'(A,CurMod,F,_), F /\ 0x200000 =:= 0x200000 '$flags'(A,CurMod,F,_), F /\ 0x200000 =:= 0x200000
), !, ), !,
'$exec_with_expansion'(A, CurMod, CurMod). '$expand_goal'(A, CurMod, CurMod, NG, NMod),
'$execute0'(NG, NMod).
'$spied_call'(A, CP, G0, M) :- '$spied_call'(A, CP, G0, M) :-
( '$undefined'(A, M) -> ( '$undefined'(A, M) ->
functor(A,F,N), functor(A,F,N),
@ -828,7 +830,8 @@ not(A) :-
'$recorded'('$import','$import'(S,M,F,N),_), '$recorded'('$import','$import'(S,M,F,N),_),
S \= M, % can't try importing from the module itself. S \= M, % can't try importing from the module itself.
!, !,
'$exec_with_expansion'(G, S, M). '$expand_goal'(G, S, M, NG, NMod),
'$execute0'(NG, NMod).
'$undefp'([M|G]) :- '$undefp'([M|G]) :-
\+ '$undefined'(unknown_predicate_handler(_,_,_), user), \+ '$undefined'(unknown_predicate_handler(_,_,_), user),
user:unknown_predicate_handler(G,M,NG), !, user:unknown_predicate_handler(G,M,NG), !,

View File

@ -249,6 +249,10 @@ debugging :-
'$wake_up_goal'(G, LG). '$wake_up_goal'(G, LG).
'$spy'([_|Mod:G]) :- !, '$spy'([_|Mod:G]) :- !,
'$spy'([Mod|G]). '$spy'([Mod|G]).
'$spy'([Module|'$call'(G)]) :- !,
'fetch_goal_module'(G, Module, G1, Mod),
'$expand_goal'(G1, Mod, Module, NG, NM),
'$do_spy'(NG, NM).
'$spy'([Module|G]) :- '$spy'([Module|G]) :-
% '$format'(user_error,"$spym(~w,~w)~n",[Module,G]), % '$format'(user_error,"$spym(~w,~w)~n",[Module,G]),
'$hidden'(G), '$hidden'(G),
@ -259,7 +263,12 @@ debugging :-
'$spy'([Mod|G]) :- '$spy'([Mod|G]) :-
'$do_spy'(G,Mod). '$do_spy'(G,Mod).
'fetch_goal_module'(V, M, V, M) :- var(V), !.
'fetch_goal_module'(M:G, _, NG, Mod) :- !,
'fetch_goal_module'(G, M, NG, Mod).
'fetch_goal_module'(G, M, G, M).
'$direct_spy'(G) :- '$direct_spy'(G) :-
'$awoken_goals'(LG), !, '$awoken_goals'(LG), !,
'$creep', '$creep',

View File

@ -317,18 +317,23 @@ module(N) :-
% calling the meta-call expansion facility and expand_goal from % calling the meta-call expansion facility and expand_goal from
% a meta-call. % a meta-call.
% %
'$exec_with_expansion'(G0, GoalMod, CurMod) :- '$expand_goal'(G0, GoalMod, CurMod, G, NM) :-
'$meta_expansion'(GoalMod, CurMod, G0, GF, []), !, '$meta_expansion'(GoalMod, CurMod, G0, GF, []), !,
'$exec_with_expansion2'(GF,GoalMod). '$expand_goal2'(GF,GoalMod,G,NM).
'$exec_with_expansion'(G, GoalMod, _) :- '$expand_goal'(G, GoalMod, _, NG, NM) :-
'$exec_with_expansion2'(G,GoalMod). '$expand_goal2'(G, GoalMod, NG, NM).
'$exec_with_expansion2'(G, M) :- '$expand_goal2'(G, M, NG, NM) :-
'$undefined'(G,M),
functor(G,F,N),
'$recorded'('$import','$import'(ExportingMod,M,F,N),_),
ExportingMod \= M,
!,
'$expand_goal2'(G, ExportingMod, NG, NM).
'$expand_goal2'(G, M, GF, M) :-
'$pred_goal_expansion_on', '$pred_goal_expansion_on',
user:goal_expansion(G,M,GF), !, user:goal_expansion(G,M,GF), !.
'$execute'(M:GF). '$expand_goal2'(G, M, G, M).
'$exec_with_expansion2'(G, M) :- !,
'$execute0'(G, M).
% expand module names in a body % expand module names in a body