improve handling of meta-call in setof and debugging
This commit is contained in:
parent
2ba405389b
commit
d3b3a45dde
@ -2585,6 +2585,13 @@ p_free_variables_in_term( USES_REGS1 ) /* variables within term t */
|
|||||||
}
|
}
|
||||||
} else if (f == FunctorModule) {
|
} else if (f == FunctorModule) {
|
||||||
found_module = ArgOfTerm(1, t);
|
found_module = ArgOfTerm(1, t);
|
||||||
|
} else if (f == FunctorCall) {
|
||||||
|
t = ArgOfTerm(1, t);
|
||||||
|
continue;
|
||||||
|
} else if (f == FunctorExecuteInMod) {
|
||||||
|
found_module = ArgOfTerm(2, t);
|
||||||
|
t = ArgOfTerm(1, t);
|
||||||
|
continue;
|
||||||
} else {
|
} else {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
32
pl/debug.yap
32
pl/debug.yap
@ -182,7 +182,7 @@
|
|||||||
% remove any debugging info after an abort.
|
% remove any debugging info after an abort.
|
||||||
%
|
%
|
||||||
|
|
||||||
trace :-
|
trace :-
|
||||||
'$init_debugger',
|
'$init_debugger',
|
||||||
'$nb_getval'('$trace', on, fail), !.
|
'$nb_getval'('$trace', on, fail), !.
|
||||||
trace :-
|
trace :-
|
||||||
@ -407,15 +407,8 @@ debugging :-
|
|||||||
fail.
|
fail.
|
||||||
|
|
||||||
% if we are in
|
% if we are in
|
||||||
'$loop_spy2'(GoalNumber, G0, Module, CalledFromDebugger, CP) :-
|
'$loop_spy2'(GoalNumber, G, Module, CalledFromDebugger, CP) :-
|
||||||
/* the following choice point is where the predicate is called */
|
/* the following choice point is where the predicate is called */
|
||||||
(
|
|
||||||
'$is_metapredicate'(G0, Module)
|
|
||||||
->
|
|
||||||
'$meta_expansion'(G0,Module,Module,Module,G,[])
|
|
||||||
;
|
|
||||||
G = G0
|
|
||||||
),
|
|
||||||
b_getval('$spy_glist',[Info|_]), /* get goal list */
|
b_getval('$spy_glist',[Info|_]), /* get goal list */
|
||||||
Info = info(_,_,_,Retry,Det,false),
|
Info = info(_,_,_,Retry,Det,false),
|
||||||
(
|
(
|
||||||
@ -512,18 +505,25 @@ debugging :-
|
|||||||
'$system_module'(M)
|
'$system_module'(M)
|
||||||
),
|
),
|
||||||
!,
|
!,
|
||||||
(
|
( '$is_metapredicate'(G, M)
|
||||||
'$is_metapredicate'(G,M)
|
->
|
||||||
->
|
'$meta_expansion'(G,M,M,M,G1,[]),
|
||||||
'$creep'(G,M)
|
'$creep'(G1, M)
|
||||||
;
|
;
|
||||||
'$execute'(M:G)
|
'$execute'(M:G)
|
||||||
).
|
).
|
||||||
'$spycall'(G, M, _, _) :-
|
'$spycall'(G, M, _, _) :-
|
||||||
'$tabled_predicate'(G,M),
|
'$tabled_predicate'(G,M),
|
||||||
!,
|
!,
|
||||||
'$continue_debugging_goal'(no, '$execute_nonstop'(G,M)).
|
'$continue_debugging_goal'(no, '$execute_nonstop'(G,M)).
|
||||||
'$spycall'(G, M, CalledFromDebugger, InRedo) :-
|
'$spycall'(G, M, CalledFromDebugger, InRedo) :-
|
||||||
|
'$is_metapredicate'(G, M), !,
|
||||||
|
'$meta_expansion'(G,M,M,M,G1,[]),
|
||||||
|
'$spycall_expanded'(G1, M, CalledFromDebugger, InRedo).
|
||||||
|
'$spycall'(G, M, CalledFromDebugger, InRedo) :-
|
||||||
|
'$spycall_expanded'(G, M, CalledFromDebugger, InRedo).
|
||||||
|
|
||||||
|
'$spycall_expanded'(G, M, CalledFromDebugger, InRedo) :-
|
||||||
'$flags'(G,M,F,F),
|
'$flags'(G,M,F,F),
|
||||||
F /\ 0x08402000 =\= 0, !, % dynamic procedure, logical semantics, or source
|
F /\ 0x08402000 =\= 0, !, % dynamic procedure, logical semantics, or source
|
||||||
% use the interpreter
|
% use the interpreter
|
||||||
@ -531,11 +531,11 @@ debugging :-
|
|||||||
'$clause'(G, M, Cl, _),
|
'$clause'(G, M, Cl, _),
|
||||||
% I may backtrack to here from far away
|
% I may backtrack to here from far away
|
||||||
( '$do_spy'(Cl, M, CP, debugger) ; InRedo = true ).
|
( '$do_spy'(Cl, M, CP, debugger) ; InRedo = true ).
|
||||||
'$spycall'(G, M, CalledFromDebugger, InRedo) :-
|
'$spycall_expanded'(G, M, CalledFromDebugger, InRedo) :-
|
||||||
'$undefined'(G, M), !,
|
'$undefined'(G, M), !,
|
||||||
'$find_goal_definition'(M, G, NM, Goal),
|
'$find_goal_definition'(M, G, NM, Goal),
|
||||||
'$spycall'(Goal, NM, CalledFromDebugger, InRedo).
|
'$spycall'(Goal, NM, CalledFromDebugger, InRedo).
|
||||||
'$spycall'(G, M, _, InRedo) :-
|
'$spycall_expanded'(G, M, _, InRedo) :-
|
||||||
% I lost control here.
|
% I lost control here.
|
||||||
CP is '$last_choice_pt',
|
CP is '$last_choice_pt',
|
||||||
'$static_clause'(G,M,_,R),
|
'$static_clause'(G,M,_,R),
|
||||||
|
@ -473,6 +473,8 @@ expand_goal(G, G).
|
|||||||
% support all/3
|
% support all/3
|
||||||
'$uvar'(same( G, _), LF, L) :-
|
'$uvar'(same( G, _), LF, L) :-
|
||||||
'$uvar'(G, LF, L).
|
'$uvar'(G, LF, L).
|
||||||
|
'$uvar'('^'( _, G), LF, L) :-
|
||||||
|
'$uvar'(G, LF, L).
|
||||||
|
|
||||||
% expand arguments of a meta-predicate
|
% expand arguments of a meta-predicate
|
||||||
% $meta_expansion(ModuleWhereDefined,CurrentModule,Goal,ExpandedGoal,MetaVariables)
|
% $meta_expansion(ModuleWhereDefined,CurrentModule,Goal,ExpandedGoal,MetaVariables)
|
||||||
|
Reference in New Issue
Block a user