22:- module(system(
'$debug',[]),
282prolog
:'$spy'(
Mod:G)
:-
283 '$trace'(
Mod:G, outer).
299 '$get_debugger_state'(trace,
Trace),
300 '$set_debugger_state'( creep,
0, yes,
Trace, false ),
302 '$id_goal'(
GoalNumberN),
303 trace_goal(
G,
M,
Ctx,
GoalNumberN,
CP),
327 set_stream(
S,alias(debugger_input)).
331 open(
'/dev/tty', read,
_S, [alias(debugger_input),bom(false)]).
335 open(
'CONIN$', read,
_S, [alias(debugger_input),bom(false)]).
344 set_stream(
S,alias(debugger_output)).
348 open(
'/dev/tty', write,
_S, [alias(debugger_output)]).
352 open(
'CONOUT$', write,
_S, [alias(debugger_output)]).
355'$trace_meta_call'(
G,
CP,
_,
M )
:-
356 trace_goal(
G,
M, outer,
_GN,
CP ).
365 '$yap_strip_module'(
G,
M,
Q),
367 trace_goal(
Q,
M, outer,
_GN,
CP ),
371'$creep'(
G0,
M0,
CP,
GoalNumber)
:-
372 '$yap_strip_module'(
M0:G0,
M,
G),
373 trace_goal(
G,
M, outer,
GoalNumber,
CP),
380trace_goal(
V,
M,
_,
_,
_)
:-
381 '$set_debugger_state'(debug,false),
385trace_goal(!,
_,
_,
_,
CP)
:-
388trace_goal(current_choice_point(
CP),
_,
_,
_,
CP)
:-
390trace_goal(query_to_answer(
G,
Vs,
Port,
Bindings,
Goals),
_,
_,
_,
_)
:-
392 query_to_answer(
G,
Vs,
Port,
Bindings,
Goals).
393trace_goal(cut_by(
M),
_,
_,
_,
_)
:-
396trace_goal(
M:G,
_,
GN0,
GN,
CP)
:-
398 '$yap_strip_module'(
M:G,
M0,
G0),
399 trace_goal(
G0,
M0,
GN0,
GN,
CP ).
400trace_goal((
A,
B),
M,
GN0,
GN,
CP)
:- trace_goal,
401 trace_goal(
A,
M, inner,
GN,
CP),
402 trace_goal(
B,
M,
GN0,
_GN,
CP).
403trace_goal((
A->B;C),
M,
GN0,
GN,
CP)
:- trace_goal,
404 (
trace_goal(
A,
M, inner,
GN,
CP)
->
405 trace_goal(
B,
M,
GN0,
_GN1,
CP)
;
406 trace_goal(
C,
M,
GN0,
_GN2,
CP)).
407trace_goal((
A*->B;C),
M,
GN0,
GN,
CP)
:- trace_goal,
408 (
trace_goal(
A,
M, inner,
GN,
CP)
*->
409 trace_goal(
B,
M,
GN0,
_GN1,
CP)
;
410 trace_goal(
C,
M,
GN0,
_GN2,
CP)).
411trace_goal((
A->B),
M,
GN0,
GN,
CP)
:- trace_goal,
412 (
trace_goal(
A,
M, inner,
GN,
CP)
->
413 trace_goal(
B,
M,
GN0,
_GN,
CP)).
414trace_goal((
A*->B),
M,
GN0,
GN,
CP)
:- trace_goal,
415 (
trace_goal(
A,
M, inner,
GN,
CP)
*->
416 trace_goal(
B,
M,
GN0,
_GN,
CP)).
417trace_goal((
A;B),
M,
GN0,
GN,
CP)
:- trace_goal,
418 (
trace_goal(
A,
M,
GN0,
GN,
CP)
;
419 trace_goal(
B,
M,
GN0,
_GN,
CP)).
420trace_goal((
A|B),
M,
GN0,
GN,
CP)
:- trace_goal,
421 (
trace_goal(
A,
M,
GN0,
GN,
CP)
;
422 trace_goal(
B,
M,
GN0,
_GN,
CP)).
423trace_goal(forall(
A,
B),
M,
GN0,
GN,
CP)
:- trace_goal,
425 trace_goal(
A,
M,
GN0,
GN,
CP),
426 trace_goal(
B,
M,
GN0,
_GN,
CP)
428trace_goal((
\+ A),
M,
GN0,
GN,
CP)
:- trace_goal,
429 \+ trace_goal(
A,
M,
GN0,
GN,
CP).
430trace_goal(once(
A),
M,
GN0,
GN,
CP)
:- trace_goal,
431 once(trace_goal(
A,
M,
GN0,
GN,
CP)).
432trace_goal(ignore(
A),
M,
GN0,
GN,
CP)
:- trace_goal,
433 ignore( trace_goal(
A,
M,
GN0,
GN,
CP) ).
434trace_goal(true,
_M,
_GN0,
_GN,
_CP)
:- trace_goal.
435trace_goal(
G,
M,
Ctx,
GoalNumber0,
CP0)
:-
436 '$imported_predicate'(
G,
M,
NG,
NM),
438 '$imported_predicate',
439 trace_goal(
NG,
NM,
Ctx,
GoalNumber0,
CP0).
440trace_goal(
G,
M,
Ctx,
GoalNumberN,
CP0)
:-
441 '$debuggable'(
G,
M,
GoalNumberN),
443 '$id_goal'(
GoalNumberN),
445 '$predicate_type'(
G,
M,
T),
446 handle_port([call],
GoalNumberN,
G,
M,
Ctx,
CPN,
H),
448 trace_goal_(
T,
G,
M,
Ctx,
GoalNumberN,
CP0,
H),
450 trace_error(
Error,
GoalNumberN,
G,
M,
Ctx,
GoalNumberN,
CP0,
CPN)
453trace_goal(
G,
M,
_Ctx,
_GoalNumber,
_CP0)
:-
454 '$meta_hook'(
M:G,
M:NG),
455 '$execute_nonstop'(
NG,
M).
463trace_goal_(updatable_procedure,
G,
M,
_Ctx,
GoalNumber,
CPN,
H)
:-
464 trace_goal_(source_procedure,
G,
M,
_Ctx,
GoalNumber,
CPN,
H).
465trace_goal_(exo_procedure,
G,
M,
_Ctx,
GoalNumber,
CPN,
H)
:-
466 trace_goal_(source_procedure,
G,
M,
_Ctx,
GoalNumber,
CPN,
H).
467trace_goal_(mega_procedure,
G,
M,
_Ctx,
GoalNumber,
CPN,
H)
:-
468 trace_goal_(source_procedure,
G,
M,
_Ctx,
GoalNumber,
CPN,
H).
469trace_goal_(undefined_procedure,
G,
M,
_Ctx,
_GoalNumber,
_CPN,
_H)
:-
471trace_goal_(source_procedure,
G,
M,
_Ctx,
GoalNumber,
_CP,
H)
:-
472 '$id_goal'(
GoalNumber),
475 '$creep_enumerate_sources'(
479 handle_port([
Port0],
GoalNumber,
G,
M, false,
CP,
H)
481 '$creep_run_sources'(
482 handle_port([call,
Port0],
GoalNumber,
G,
M, false,
CP,
H),
485 handle_port([
Port,
Port0],
GoalNumber,
G,
M, false,
CP,
H)
488trace_goal_(sourceless_procedure,
G,
M,
Ctx,
GoalNumber,
_CP,
H)
:-
489 '$id_goal'(
GoalNumber),
491 '$number_of_clauses'(
G,
M,
N),
493 '$number_of_clauses',
494 '$creep_enumerate_refs'(
500 handle_port([
Port0],
GoalNumber,
G,
M,
Ctx,
CP,
H)
503 handle_port([call,
Port0],
GoalNumber,
G,
M,
Ctx,
CP,
H),
507 handle_port([
Port,
Port0],
GoalNumber,
G,
M,
Ctx,
CP,
H)
509trace_goal_(system_procedure,throw(
G),
_M,
_Ctx,
_GoalNumber,
_CP,
_H)
:-
512trace_goal_(system_procedure,
G,
M,
Ctx,
GoalNumber,
CP,
H)
:-
513 trace_goal_(private_procedure,
G,
M,
Ctx,
GoalNumber,
CP,
H).
515trace_goal_(private_procedure,
G,
M,
Ctx,
GoalNumber,
CP,
H)
:-
516 '$id_goal'(
GoalNumber),
527 '$meta_hook'(
M:G,
M:NG),
530 handle_port([
Port,exit],
GoalNumber,
G,
M,
Ctx,
CP,
H)
533'$creep_enumerate_sources'(
Setup,
M:Goal,
B,
Catcher,
Cleanup)
:-
534 '$setup_call_catcher_cleanup'(
Setup),
535 Task0 = cleanup( true,
Catcher,
Cleanup,
Tag, true,
CP0),
536 TaskF = cleanup( true,
Catcher,
Cleanup,
Tag, false,
CP0),
537 '$tag_cleanup'(
CP0,
Task0),
539 '$cleanup_on_exit'(
CP0,
TaskF).
542'$creep_enumerate_refs'(
Setup,
M:Goal,
_N,
Ref,
Catcher,
Cleanup)
:-
543 '$setup_call_catcher_cleanup'(
Setup),
544 Task0 = cleanup( true,
Catcher,
Cleanup,
Tag, true,
CP0),
545 TaskF = cleanup( true,
Catcher,
Cleanup,
Tag, false,
CP0),
546 '$tag_cleanup'(
CP0,
Task0),
548 '$cleanup_on_exit'(
CP0,
TaskF).
551'$creep_run_sources'(
Setup,
M,
B,
CP,
Catcher,
Cleanup)
:-
552 '$setup_call_catcher_cleanup'(
Setup),
553 Task0 = cleanup( true,
Catcher,
Cleanup,
Tag, true,
CP0),
554 TaskF = cleanup( true,
Catcher,
Cleanup,
Tag, false,
CP0),
555 '$tag_cleanup'(
CP0,
Task0),
556 trace_goal(
B,
M,outer,
_,
CP),
557 '$cleanup_on_exit'(
CP0,
TaskF).
559'$creep_run_private'(
Setup,
M,
G,
_CP,
Catcher,
Cleanup)
:-
560 '$setup_call_catcher_cleanup'(
Setup),
561 Task0 = cleanup( true,
Catcher,
Cleanup,
Tag, true,
CP0),
562 TaskF = cleanup( true,
Catcher,
Cleanup,
Tag, false,
CP0),
563 '$tag_cleanup'(
CP0,
Task0),
564'$execute_nonstop'(
G,
M),
565 '$cleanup_on_exit'(
CP0,
TaskF).
567'$creep_run_refs'(
Setup,
M:Goal,
Ref,
CP,
Catcher,
Cleanup)
:-
568 '$setup_call_catcher_cleanup'(
Setup),
569 Task0 = cleanup( true,
Catcher,
Cleanup,
Tag, true,
CP0),
570 TaskF = cleanup( true,
Catcher,
Cleanup,
Tag, false,
CP0),
571 '$tag_cleanup'(
CP0,
Task0),
572 '$creep_clause'(
Goal,
M,
Ref,
CP ),
573 '$cleanup_on_exit'(
CP0,
TaskF).
576'$meta_hook'(
MG,
M:NG)
:-
577 '$yap_strip_module'(
MG,
M,
G),
578 '$debuggable'(
G,
M,+inf),
583 recorded(
'$m',
meta_predicate(
M,
PredDef),
_),
585 '$debugger_prepare_meta_arguments'(
As,
Ms,
NAs),
587 '$debugger_prepare_meta_arguments',
601'$enter_trace'(
L,
G,
Module,
CP,
Info)
:-
604 '__NB_getval__'(
'$spy_glist',
History,
History=[]),
605 Info = info(
L,
Module,
G,
CP,
_Retry,
_Det,
_HasFoundAnswers),
607 b_setval(
'$spy_glist',
H).
612 (
'__NB_getval__'(
'$spy_gn',
L,fail)
-> '__NB_getval__'
; L = 0 ),
616 '__NB_setval__'(
'$spy_gn',
L1).
620handle_port([exception(redo(
_))
|_],
_GoalNumber,
_G,
_M,
_G0,
_CP,
_H)
:-
622handle_port([exception(fail(
_))
|_],
_GoalNumber,
_G,
_M,
_G0,
_CP,
_H)
:-
624handle_port(
Ports,
GoalNumber,
G,
M,
G0,
CP,
H)
:-
627 '$trace_port'(
Ports,
GoalNumber,
G,
M,
G0,
CP,
H).
642'$trace_port'(
_Ports,
_GoalNumber,
_Ctxt,
_Module,
_From,
_CP,
_Info)
:-
643 prolog_flag( debug, false),
645'$trace_port'(
Ports,
GoalNumber,
_Ctxt,
_Module,
_From,
_CP,
_Info)
:-
647 '$leap'(
Ports,
GoalNumber),
649'$trace_port'(
Ports,
GoalNumber,
Ctxt,
Module,
From,
CP,
Info)
:-
650 (
'$ports_to_port'(
Ports,
Port)
->'$ports_to_port'
;Port='$ports_to_port'),
652 ignore(
'$trace_port_'(
Port,
GoalNumber,
Ctxt,
Module,
CP,
Info)),
653 '$cross_run_deb'(
Port,
From,
GoalNumber).
656'$ports_to_port'([answer,exit], answer).
657'$ports_to_port'([answer,answer], answer).
658'$ports_to_port'([call], call).
659'$ports_to_port'([call,redo], redo).
660'$ports_to_port'([call,exit], internal).
661'$ports_to_port'([exit,exit], exit).
662'$ports_to_port'([exit,answer], answer).
663'$ports_to_port'( [exit], internal).
664'$ports_to_port'([exit,redo], internal).
665'$ports_to_port'([fail,exit], fail).
666'$ports_to_port'([fail,answer], redo).
667'$ports_to_port'([exit,fail], internal).
668'$ports_to_port'( [fail], fail).
669'$ports_to_port'([redo,answer], redo).
670'$ports_to_port'([redo,exit], redo).
671'$ports_to_port'([redo], redo).
672'$ports_to_port'([!,answer], exit).
673'$ports_to_port'([!,exit], exit).
674'$ports_to_port'([!,redo], fail).
675'$ports_to_port'([!,fail], fail).
676'$ports_to_port'([answer,!], exit).
677'$ports_to_port'([exit,!], exit).
678'$ports_to_port'([redo,!], redo).
679'$ports_to_port'([fail,!], fail).
680'$ports_to_port'([!], internal).
681'$ports_to_port'([exception(
E),
_], exception(
E)).
682'$ports_to_port'([exception(
E)],exception(
E)).
683'$ports_to_port'([external_exception(
E),
_], exception(
E)).
684'$ports_to_port'([external_exception(
E)],exception(
E)).
687'$trace_port_'(call,
GoalNumber,
G,
Module,
CP,
Info)
:-
688 '$enter_trace'(
GoalNumber,
G,
Module,
CP,
Info),
689 '$port'(call,
G,
Module,
GoalNumber,deterministic,
CP,
Info).
690'$trace_port_'(exit,
GoalNumber,
G,
Module,
CP,
Info)
:-
691 '$port'(exit,
G,
Module,
GoalNumber,deterministic,
CP,
Info).
692'$trace_port_'(answer,
GoalNumber,
G,
Module,
CP,
Info)
:-
693 '$port'(exit,
G,
Module,
GoalNumber,nondeterministic,
CP,
Info).
694'$trace_port_'(redo,
GoalNumber,
G,
Module,
CP,
Info)
:-
695 '$port'(redo,
G,
Module,
GoalNumber,nondeterministic,
CP,
Info).
696'$trace_port_'(fail,
GoalNumber,
G,
Module,
CP,
Info)
:-
697 '$port'(fail,
G,
Module,
GoalNumber,deterministic,
CP,
Info).
698'$trace_port_'(! ,
_GoalNumber,
_G,
_Module,
_CP,
_Info)
:-
700'$trace_port_'(exception(redo(
_)),
_GoalNumber,
_G,
_Module,
_CP,
_Info)
:-
702'$trace_port_'(exception(fail(
_)),
_GoalNumber,
_G,
_Module,
_CP,
_Info)
:-
704'$trace_port_'(exception(
E),
GoalNumber,
G,
Module,
CP,
Info)
:-
705 '$port'(exception(
E),
G,
Module,
GoalNumber,deterministic,
CP,
Info).
706'$trace_port_'(internal,
_GoalNumber,
_G,
_Module,
_CP,
_Info).
722trace_error(abort,
_GoalNumber,
_G,
_Module,
_Ctx,
_GoalNumber0,
_CP0,
_CP)
:-
725trace_error(event(fail,
G0),
_GoalNumber,
_G,
_Module,
_Ctx,
GoalNumber0,
_CP0,
_CP)
:-
730 throw(event(fail,
G0))
734trace_error(redo(
G0),
_GoalNumber,
G,
M,
Ctx,
GoalNumber0,
CP0,
_CP)
:-
741 '$get_debugger_state'(trace,
Trace),
742 '$set_debugger_state'( creep,
0, yes,
Trace, false ),
743 trace_goal(
G,
M,
Ctx,
GoalNumber0,
CP0)
749trace_error(
Event,
_,
_,
_,
_,
_,
_,
_)
:-
754'$loop_fail'(
_GoalNumber,
_G,
_Module,
_Creep)
:-
768'$port'(
P,
G,
Module,
L,
Deterministic,
_CP,
Info)
:-
771 '$get_debugger_state'(trace,
Trace),
772 '$set_debugger_state'( creep,
L, yes,
Trace, false ),
773 '$set_debugger_state',
774 '$set_debugger_state',
775 '$clear_input'(debugger_input),
776 '$trace_msg'(
P,
G,
Module,
L,
Deterministic),
779 '$action'(
'\n',
P,
L,
G,
Module,
Info),
785 '$action'(
C,
P,
L,
G,
Module,
_Info)
789'$trace_msg'(
P,
G,
Module,
L,
Deterministic)
:-
791 (
P = exit,
Deterministic \= deterministic
-> Det = '?' ; Det = ' '),
792 (
'$pred_being_spied'(
G,
Module)
-> CSPY = '*' ; CSPY = ' '),
804 format(debugger_output,
'~N~a~a~a (~d) ~q:',[
Det,
CSPY,
SLL,
L,
P0]),
805 '$debugger_write'(debugger_output,
GW).
807'$unleashed'(call)
:- get_value(
'$leash',
L),
L /\ 0get_value
=:= 0.
808'$unleashed'(exit)
:- get_value(
'$leash',
L),
L /\ 0get_value
=:= 0.
809'$unleashed'(redo)
:- get_value(
'$leash',
L),
L /\ 0get_value
=:= 0.
810'$unleashed'(fail)
:- get_value(
'$leash',
L),
L /\ 0get_value
=:= 0.
812'$unleashed'(exception(
_))
:- get_value(
'$leash',
L),
L /\ 0get_value
=:= 0. %
814'$debugger_write'(
Stream,
G)
:-
815 prolog_flag( debugger_print_options,
OUT ),
prolog_flag,
817'$debugger_write'(
Stream,
G)
:-
820'$action'(
'\r',
P,
CallNumber,
G,
Module,
H)
:- '$action',
822 '$action'(
C,
P,
CallNumber,
G,
Module,
H).
823'$action'(
'\n',
_,
_,
_,
_,
_)
:- '$action',
824 '$get_debugger_state'(trace,
Trace),
825 '$set_debugger_state'( creep,
0, stop,
Trace, false ).
826'$action'(!,
_,
_,
_,
_,
_)
:- '$action',
827 read(debugger_input,
G),
830 skip( debugger_input,
10),
832'$action'(<,
_,
_,
_,
_,
_)
:- '$action',
834 skip( debugger_input,
10),
836'$action'(
'C',
_,
_,
_,
_,
_)
:-
840 skip( debugger_input,
10),
841 '__NB_getval__'(
'$trace',
Trace,fail),
842 '$set_debugger_state'( creep,
0, stop,
Trace,false).
843'$action'(^,
_,
_,
G,
_,
_)
:- '$action',
844 '$print_deb_sterm'(
G),
845 skip( debugger_input,
10),
847'$action'(a,
_,
_,
_,
_,
_)
:- '$action',
848 skip( debugger_input,
10),
851'$action'(b,
_,
_,
_,
_,
_)
:- '$action',
853 skip( debugger_input,
10),
856'$action'(
'A',
_,
_,
_,
_,
_)
:- '$action',
857 skip( debugger_input,
10),
860'$action'(c,
_,
_,
_,
_,
_)
:- '$action',
861 skip( debugger_input,
10),
862 '$get_debugger_state'(trace,
Trace),
863 '$set_debugger_state'( creep,
0,stop,
Trace, false ).
864'$action'(e,
_,
_,
_,
_,
_)
:- '$action',
866'$action'(f,
_,
CallNumber,
_,
_,
_)
:- '$action',
867 '$scan_number'(
ScanNumber),
868 (
ScanNumber == 0 -> Goal = CallNumber ; Goal = ScanNumber ),
869 throw(event(fail,
Goal)).
870'$action'(h,
_,
_,
_,
_,
_)
:- '$action',
872 skip( debugger_input,
10),
874'$action'(?,
_,
_,
_,
_,
_)
:- '$action',
876 skip( debugger_input,
10),
878'$action'(p,
_,
_,
G,
Module,
_)
:- '$action',
879 ((
Module = prolog
; Module = user)
->
880 print(user_error,
G),
nl(user_error)
882 print(user_error,
Module:G),
nl(user_error)
884 skip( debugger_input,
10),
886'$action'(d,
_,
_,
G,
Module,
_)
:- '$action',
887 ((
Module = prolog
; Module = user)
->
890 display(user_error,
Module:G),
nl(user_error)
892 skip( debugger_input,
10),
894'$action'(l,
_,
CallNumber,
_,
_,
_)
:- '$action',
895 '$scan_number'(
ScanNumber),
896 (
ScanNumber == 0 -> Goal = CallNumber ; Goal = ScanNumber ),
897 '$get_debugger_state'(trace,
Trace),
898 '$set_debugger_state'( leap,
0, stop,
Trace, false ).
899'$action'(z,
_,
CallNumber,
_,
_,
_CP)
:- '$action',
900 '$scan_number'(
ScanNumber),
901 '$get_debugger_state'(trace,
Trace),
902 (
'$scan_number'(
ScanNumber)
-> Goal = CallNumber ; Goal = ScanNumber ),
903 '$set_debugger_state'( zip ,
Goal, stop,
Trace, false ).
906'$action'(k,
_,
_CallNumber,
_,
_,
_)
:- '$action',
907 skip( debugger_input,
10),
908 '$get_debugger_state'(trace,
Trace),
909 '$set_debugger_state'( zip,
0, stop,
Trace, false).
912'$action'(n,
_,
_,
_,
_,
_)
:- '$action',
913 skip( debugger_input,
10),
916'$action'(
r,
P,
CallNumber,
_,
_,
_)
:- '$action',
917 '$scan_number'(
ScanNumber),
918 (
ScanNumber == 0 -> Goal = CallNumber ; Goal = ScanNumber ),
925'$action'(s,
P,
CallNumber,
_,
_,
_)
:- '$action',
926 '$scan_number'(
ScanNumber),
927 (
ScanNumber == 0 -> Goal = CallNumber ; Goal = ScanNumber ),
928 ( (
P==call
; P==redo)
->
929 '$get_debugger_state'(trace,
Trace),
930 '$set_debugger_state'( leap,
Goal, ignore,
Trace,false)
934'$action'(t,
P,
CallNumber,
_,
_,
_)
:- '$action',
935 '$scan_number'(
ScanNumber),
936 (
ScanNumber == 0 -> Goal = CallNumber ; Goal = ScanNumber ),
937 ( (
P=call
; P=redo)
->
938 '$get_debugger_state'(trace,
Trace),
939 '$set_debugger_state'( zip,
Goal, ignore,
Trace, false)
943'$action'(q,
P,
CallNumber,
_,
_,
_)
:- '$action',
944 '$scan_number'(
ScanNumber),
945 (
ScanNumber == 0 -> Goal = CallNumber ; Goal = ScanNumber ),
946 ( (
P=call
; P=redo)
->
947 '$get_debugger_state'(trace,
Trace),
948 '$set_debugger_state'( leap,
Goal, stop,
Trace, false)
952'$action'(+,
_,
_,
G,
M,
_)
:- '$action',
954 skip( debugger_input,
10),
956'$action'(-,
_,
_,
G,
M,
_)
:- '$action',
958 skip( debugger_input,
10),
960'$action'(g,
_,
_,
_,
_,
_)
:- '$action',
961 '$scan_number'(
HowMany),
962 '$show_ancestors'(
HowMany),
964'$action'(
'T',exception(
G),
_,
_,
_,
_)
:- '$action',
966'$action'(
C,
_,
_,
_,
_,
_)
:-
967 skip( debugger_input,
10),
971'$show_ancestors'(
HowMany)
:-
972 '__NB_getval__'(
'$spy_glist',[
_|History], fail),
978 '$show_ancestors'(
History,
HowMany),
982'$show_ancestors'([],
_).
983'$show_ancestors'([
_|_],
0)
:- '$show_ancestors'.
984'$show_ancestors'([info(
L,
M,
G,
_CP,
Retry,
Det,
_Exited)
|History],
HowMany)
:-
985 '$show_ancestor'(
L,
M,
G,
Retry,
Det,
HowMany,
HowMany1),
986 '$show_ancestors'(
History,
HowMany1).
989'$show_ancestor'(
_,
_,
_,
_,
Det,
HowMany,
HowMany)
:-
992'$show_ancestor'(
GoalNumber,
M,
G,
Retry,
_,
HowMany,
HowMany1)
:-
994 HowMany1 is HowMany-1,
995 '$trace_msg'(redo,
G,
M,
GoalNumber,
_),
nl(user_error).
996'$show_ancestor'(
GoalNumber,
M,
G,
_,
_,
HowMany,
HowMany1)
:-
997 HowMany1 is HowMany-1,
998 '$trace_msg'(call,
G,
M,
GoalNumber,
_),
nl(user_error).
1002 format(user_error,
'newline creep a abort~n', []),
1003 format(user_error,
'c creep e exit~n', []),
1004 format(user_error,
'f Goal fail h help~n', []),
1005 format(user_error,
'l leap r Goal retry~n', []),
1006 format(user_error,
's skip t fastskip~n', []),
1007 format(user_error,
'q quasiskip k quasileap~n', []),
1008 format(user_error,
'b break n no debug~n', []),
1009 format(user_error,
'p print d display~n', []),
1010 format(user_error,
'<D depth D < full term~n', []),
1011 format(user_error,
'+ spy this - nospy this~n', []),
1012 format(user_error,
'^ view subg ^^ view using~n', []),
1013 format(user_error,
'A choices g [N] ancestors~n', []),
1014 format(user_error,
'T throw ~n', []),
1015 format(user_error,
'! g execute goal~n', []).
1022'$scan_number'(
Nb)
:-
1023 findall(
C,
'$get_deb_code'(
C),
S),
1029'$get_deb_code'(
C)
:-
1032 (
C == 10 -> !, fail
;
1033 C == -1 -> !, fail
;
1039'$print_deb_sterm'(
G)
:-
1040 '$get_sterm_list'(
L),
'$get_sterm_list',
1041 '$deb_get_sterm_in_g'(
L,
G,
A),
1042 recorda(
'$debug_ub_skel',
L,
_),
1043 format(user_error,
'~n~w~n~n',[
A]).
1044'$print_deb_sterm'(
_)
:- skip( debugger_input,
10).
1046'$get_sterm_list'(
L)
:-
1048 '$deb_inc_in_sterm_oldie'(
C,
L0,
CN),
1049 '$get_sterm_list'(
L0,
CN,
0,
L).
1051'$deb_inc_in_sterm_oldie'(
94,
L0,
CN)
:- '$deb_inc_in_sterm_oldie',
1053 (
recorded(
'$debug_sub_skel',
L0,
_)
-> recorded
;
1055'$deb_inc_in_sterm_oldie'(
C,[],
C).
1057'$get_sterm_list'(
L0,
C,
N,
L)
:-
1058 (
C =:= "^",
N =\= 0 ->
1060 '$get_sterm_list'([
N|L0],
CN,
0,
L)
1062 C >= "0",
C =< "9" ->
1063 NN is 10*N+C-"0",
get_code(debugger_input,
CN),
1064 '$get_sterm_list'(
L0,
CN,
NN,
L)
1067 (
N =:= 0 -> L = L0 ; L=[
N|L0])
1070'$deb_get_sterm_in_g'([],
G,
G).
1071'$deb_get_sterm_in_g'([
H|T],
G,
A)
:-
1072 '$deb_get_sterm_in_g'(
T,
G,
A1),
1077 '$get_deb_depth'(
C,
D),
1078 '$set_deb_depth'(
D).
1080'$get_deb_depth'(
10,
10)
:- '$get_deb_depth'.
1081'$get_deb_depth'(
C,
XF)
:-
1082 '$get_deb_depth_char_by_char'(
C,
0,
XF).
1084'$get_deb_depth_char_by_char'(
10,
X,
X)
:- '$get_deb_depth_char_by_char'.
1085'$get_deb_depth_char_by_char'(
C,
X0,
XF)
:-
1086 C >= "0",
C =< "9",
'$get_deb_depth_char_by_char',
1089 '$get_deb_depth_char_by_char'(
NC,
XI,
XF).
1091'$get_deb_depth_char_by_char'(
_C,
X,
X).
1093'$set_deb_depth'(
D)
:-
1095 '$delete_if_there'(
L, max_depth(
_), max_depth(
D),
LN),
1098'$delete_if_there'([],
_,
TN, [
TN]).
1099'$delete_if_there'([
T|L],
T,
TN, [
TN|L])
:- '$delete_if_there'.
1100'$delete_if_there'([
Q|L],
T,
TN, [
Q|LN])
:-
1101 '$delete_if_there'(
L,
T,
TN,
LN).
1103'$debugger_deterministic_goal'(exit).
1104'$debugger_deterministic_goal'(fail).
1105'$debugger_deterministic_goal'(!).
1106'$debugger_deterministic_goal'(exception(
_)).
1107'$debugger_deterministic_goal'(external_exception(
_)).
1111 '$cps'
:choicepoint(
CP,
_A_,
_B,
_C,
_D,
_E,
_F),
1116'$debugger_skip_trace_goal'([
CP|CPs],
CPs1)
:-
1117 '$debugger_skip_trace_goal'
:choicepoint(
CP,
_,prolog,trace_goal,
4,(
_;_),
_),
1119 '$debugger_skip_trace_goal'(
CPs,
CPs1).
1120'$debugger_skip_trace_goal'(
CPs,
CPs).
1122'$debugger_skip_traces'([
CP|CPs],
CPs1)
:-
1123 '$debugger_skip_traces'
:choicepoint(
CP,
_,prolog,
'$port',
4,(
_;_),
_),
1125 '$debugger_skip_traces'(
CPs,
CPs1).
1126'$debugger_skip_traces'(
CPs,
CPs).
1128'$debugger_skip_loop_spy2'([
CP|CPs],
CPs1)
:-
1129 '$debugger_skip_loop_spy2'
:choicepoint(
CP,
_,prolog,
'$loop_spy2',
5,(
_;_),
_),
1131 '$debugger_skip_loop_spy2'(
CPs,
CPs1).
1132'$debugger_skip_loop_spy2'(
CPs,
CPs).
1134'$debugger_prepare_meta_arguments'([], [], []).
1135'$debugger_prepare_meta_arguments'([
A|As], [
M|Ms], [
'$trace'(
MA:GA,outer)
|NAs])
:-
1138 '$yap_strip_module'(
A,
MA,
GA),
1139 '$debugger_prepare_meta_arguments'(
As,
Ms,
NAs).
1140'$debugger_prepare_meta_arguments'([
A|As], [
_|Ms], [
A|NAs])
:-
1141 '$debugger_prepare_meta_arguments'(
As,
Ms,
NAs).
1144catch( : Goal,+ Exception,+ Action)
stream_property( Stream, Prop )
yap_flag( ?Param, ?Value)
write_term(+ S, + T, + Opts)
current_prolog_flag(? Flag,- Value)
set_prolog_flag(+ Flag,+ Value)
print_message(+ Severity, +Term)
current_choice_point( -CP )
memberchk(+ Element, + Set)