debugger should use the same code that system uses to find undefined predicates.

This commit is contained in:
Vítor Santos Costa 2010-12-03 12:40:30 +00:00
parent f8806bed9f
commit 552d424ee0
2 changed files with 11 additions and 16 deletions

View File

@ -957,6 +957,10 @@ not(G) :- \+ '$execute'(G).
% Called by the abstract machine, if no clauses exist for a predicate % Called by the abstract machine, if no clauses exist for a predicate
'$undefp'([M|G]) :- '$undefp'([M|G]) :-
'$find_goal_definition'(M, G, NM, NG),
'$execute0'(NG, NM).
'$find_goal_definition'(M, G, NM, NG) :-
% make sure we do not loop on undefined predicates % make sure we do not loop on undefined predicates
% for undefined_predicates. % for undefined_predicates.
'$enter_undefp', '$enter_undefp',
@ -965,20 +969,19 @@ not(G) :- \+ '$execute'(G).
-> ->
'$exit_undefp' '$exit_undefp'
; ;
once('$find_undefp_handler'(G,M,Goal,NM)) once('$find_undefp_handler'(G, M, Goal, NM))
), ),
!, !,
Goal \= fail, Goal \= fail,
'$complete_goal'(M, Goal, NM, G). '$complete_goal'(M, Goal, NM, G, NG).
'$complete_goal'(M, G, CurMod, G0) :- '$complete_goal'(M, G, CurMod, G0, NG) :-
( (
'$is_metapredicate'(G,CurMod) '$is_metapredicate'(G,CurMod)
-> ->
'$meta_expansion'(G, CurMod, M, M, NG,[]) -> '$meta_expansion'(G, CurMod, M, M, NG,[])
'$execute0'(NG, CurMod)
; ;
'$execute0'(G, CurMod) NG = G
). ).
'$find_undefp_handler'(G,M,NG,user) :- '$find_undefp_handler'(G,M,NG,user) :-

View File

@ -504,16 +504,8 @@ debugging :-
( '$do_spy'(Cl, M, CP, CalledFromDebugger) ; InRedo = true ). ( '$do_spy'(Cl, M, CP, CalledFromDebugger) ; InRedo = true ).
'$spycall'(G, M, CalledFromDebugger, InRedo) :- '$spycall'(G, M, CalledFromDebugger, InRedo) :-
'$undefined'(G, M), !, '$undefined'(G, M), !,
( '$find_goal_definition'(M, G, NM, Goal),
recorded('$import','$import'(NM,M,Goal,G,_,_),_) '$spycall'(Goal, NM, CalledFromDebugger, InRedo).
->
'$spycall'(Goal, NM, CalledFromDebugger, InRedo)
;
'$enter_undefp',
'$find_undefp_handler'(G,M,Goal,NM)
->
'$spycall'(Goal, NM, CalledFromDebugger, InRedo)
).
'$spycall'(G, M, _, InRedo) :- '$spycall'(G, M, _, InRedo) :-
% I lost control here. % I lost control here.
CP is '$last_choice_pt', CP is '$last_choice_pt',