use flag for debugging

This commit is contained in:
Vitor Santos Costa 2013-10-31 13:16:27 +00:00
parent 4b64eafc3d
commit 8ea594c104
3 changed files with 18 additions and 18 deletions

View File

@ -80,7 +80,7 @@ true :- true.
set_value('$gc',on), set_value('$gc',on),
('$exit_undefp' -> true ; true), ('$exit_undefp' -> true ; true),
prompt1(' ?- '), prompt1(' ?- '),
'$debug_on'(false), '$swi_set_prolog_flag'(debug, false)
% simple trick to find out if this is we are booting from Prolog. % simple trick to find out if this is we are booting from Prolog.
% boot from a saved state % boot from a saved state
( (
@ -200,7 +200,7 @@ true :- true.
fail. fail.
'$enter_top_level' :- '$enter_top_level' :-
'$nb_getval'('$break',BreakLevel,fail), '$nb_getval'('$break',BreakLevel,fail),
'$debug_on'(DBON), '$swi_current_prolog_flag'(debug, DBON),
( (
'$nb_getval'('$trace', on, fail) '$nb_getval'('$trace', on, fail)
-> ->

View File

@ -326,8 +326,8 @@ break :-
nb_setval('$trace',off), nb_setval('$trace',off),
nb_getval('$debug_jump',Jump), nb_getval('$debug_jump',Jump),
nb_getval('$debug_run',Run), nb_getval('$debug_run',Run),
'$debug_on'(Debug), '$swi_current_prolog_flag'(debug, Debug),
'$debug_on'(false), '$swi_set_prolog_flag'(debug, false)
nb_getval('$break',BL), NBL is BL+1, nb_getval('$break',BL), NBL is BL+1,
nb_getval('$spy_gn',SPY_GN), nb_getval('$spy_gn',SPY_GN),
b_getval('$spy_glist',GList), b_getval('$spy_glist',GList),
@ -342,7 +342,7 @@ break :-
nb_setval('$spy_gn',SPY_GN), nb_setval('$spy_gn',SPY_GN),
set_input(InpStream), set_input(InpStream),
set_output(OutStream), set_output(OutStream),
'$debug_on'(Debug), '$swi_set_prolog_flag'(debug, Debug),
nb_setval('$debug_jump',Jump), nb_setval('$debug_jump',Jump),
nb_setval('$debug_run',Run), nb_setval('$debug_run',Run),
nb_setval('$trace',Trace), nb_setval('$trace',Trace),

View File

@ -165,16 +165,16 @@ debug :-
'$start_debugging'(Mode) :- '$start_debugging'(Mode) :-
(Mode == on -> (Mode == on ->
'$debug_on'(true) '$swi_set_prolog_flag'(debug, true)
; ;
'$debug_on'(false) '$swi_set_prolog_flag'(debug, false)
), ),
nb_setval('$debug_run',off), nb_setval('$debug_run',off),
nb_setval('$debug_jump',false). nb_setval('$debug_jump',false).
nodebug :- nodebug :-
'$init_debugger', '$init_debugger',
'$debug_on'(false), '$swi_set_prolog_flag'(debug, false),
nb_setval('$trace',off), nb_setval('$trace',off),
print_message(informational,debug(off)). print_message(informational,debug(off)).
@ -264,7 +264,7 @@ debugging :-
'$init_debugger', '$init_debugger',
prolog:debug_action_hook(nospyall), !. prolog:debug_action_hook(nospyall), !.
debugging :- debugging :-
( '$debug_on'(true) -> ( '$swi_current_prolog_flag'(debug, true) ->
print_message(help,debug(debug)) print_message(help,debug(debug))
; ;
print_message(help,debug(off)) print_message(help,debug(off))
@ -307,7 +307,7 @@ debugging :-
% %
% $spy may be called from user code, so be careful. % $spy may be called from user code, so be careful.
'$spy'([Mod|G]) :- '$spy'([Mod|G]) :-
'$debug_on'(F), F = false, !, '$swi_current_prolog_flag'(debug, false), !,
'$execute_nonstop'(G,Mod). '$execute_nonstop'(G,Mod).
'$spy'([Mod|G]) :- '$spy'([Mod|G]) :-
'$in_system_mode', !, '$in_system_mode', !,
@ -587,7 +587,7 @@ debugging :-
% at this point we are done with leap or skip % at this point we are done with leap or skip
nb_setval('$debug_run',off), nb_setval('$debug_run',off),
% make sure we run this code outside debugging mode. % make sure we run this code outside debugging mode.
'$debug_on'(false), '$swi_set_prolog_flag'(debug, false),
repeat, repeat,
'$trace_msg'(P,G,Module,L,Deterministic), '$trace_msg'(P,G,Module,L,Deterministic),
( (
@ -600,13 +600,13 @@ debugging :-
), ),
(Debug = on (Debug = on
-> ->
'$debug_on'(true) '$swi_set_prolog_flag'(debug, true)
; ;
Debug = zip Debug = zip
-> ->
'$debug_on'(true) '$swi_set_prolog_flag'(debug, true)
; ;
'$debug_on'(false) '$swi_set_prolog_flag'(debug, false)
), ),
!. !.
@ -650,10 +650,10 @@ debugging :-
'$action'(0'!,_,_,_,_,_) :- !, % ! 'g execute '$action'(0'!,_,_,_,_,_) :- !, % ! 'g execute
read(user,G), read(user,G),
% don't allow yourself to be caught by creep. % don't allow yourself to be caught by creep.
'$debug_on'(OldDeb), '$swi_current_prolog_flag'(debug, OldDeb),
'$debug_on'(false), '$swi_set_prolog_flag'(debug, false)
( '$execute'(G) -> true ; true), ( '$execute'(G) -> true ; true),
'$debug_on'(OldDeb), '$swi_set_prolog_flag'(debug, OldDeb),
% '$skipeol'(0'!), % ' % '$skipeol'(0'!), % '
fail. fail.
'$action'(0'<,_,_,_,_,_) :- !, % <'Depth '$action'(0'<,_,_,_,_,_) :- !, % <'Depth
@ -732,7 +732,7 @@ debugging :-
nodebug. nodebug.
'$action'(0'r,_,CallId,_,_,_) :- !, % 'r retry '$action'(0'r,_,CallId,_,_,_) :- !, % 'r retry
'$scan_number'(0'r,CallId,ScanNumber), % ' '$scan_number'(0'r,CallId,ScanNumber), % '
'$debug_on'(true), '$swi_set_prolog_flag'(debug, true),
throw(error('$retry_spy'(ScanNumber),[])). throw(error('$retry_spy'(ScanNumber),[])).
'$action'(0's,P,CallNumber,_,_,on) :- !, % 's skip '$action'(0's,P,CallNumber,_,_,on) :- !, % 's skip
'$skipeol'(0's), % ' '$skipeol'(0's), % '