From 552d424ee038dd94e07c9ae659144d90bff8e49e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADtor=20Santos=20Costa?= Date: Fri, 3 Dec 2010 12:40:30 +0000 Subject: [PATCH] debugger should use the same code that system uses to find undefined predicates. --- pl/boot.yap | 15 +++++++++------ pl/debug.yap | 12 ++---------- 2 files changed, 11 insertions(+), 16 deletions(-) diff --git a/pl/boot.yap b/pl/boot.yap index 695a2b0fb..512963db8 100755 --- a/pl/boot.yap +++ b/pl/boot.yap @@ -957,6 +957,10 @@ not(G) :- \+ '$execute'(G). % Called by the abstract machine, if no clauses exist for a predicate '$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 % for undefined_predicates. '$enter_undefp', @@ -965,20 +969,19 @@ not(G) :- \+ '$execute'(G). -> '$exit_undefp' ; - once('$find_undefp_handler'(G,M,Goal,NM)) + once('$find_undefp_handler'(G, M, Goal, NM)) ), !, 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) -> - '$meta_expansion'(G, CurMod, M, M, NG,[]) -> - '$execute0'(NG, CurMod) + '$meta_expansion'(G, CurMod, M, M, NG,[]) ; - '$execute0'(G, CurMod) + NG = G ). '$find_undefp_handler'(G,M,NG,user) :- diff --git a/pl/debug.yap b/pl/debug.yap index 9ad9d5103..5e048d372 100755 --- a/pl/debug.yap +++ b/pl/debug.yap @@ -504,16 +504,8 @@ debugging :- ( '$do_spy'(Cl, M, CP, CalledFromDebugger) ; InRedo = true ). '$spycall'(G, M, CalledFromDebugger, InRedo) :- '$undefined'(G, M), !, - ( - recorded('$import','$import'(NM,M,Goal,G,_,_),_) - -> - '$spycall'(Goal, NM, CalledFromDebugger, InRedo) - ; - '$enter_undefp', - '$find_undefp_handler'(G,M,Goal,NM) - -> - '$spycall'(Goal, NM, CalledFromDebugger, InRedo) - ). + '$find_goal_definition'(M, G, NM, Goal), + '$spycall'(Goal, NM, CalledFromDebugger, InRedo). '$spycall'(G, M, _, InRedo) :- % I lost control here. CP is '$last_choice_pt',