debugger fixes

git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@218 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
vsc 2001-12-07 20:27:03 +00:00
parent 2945f1cafa
commit 43550a67a8
5 changed files with 23 additions and 48 deletions

View File

@ -191,9 +191,9 @@ p_save_cp(void)
}
inline static Int
EnterCreepMode(PredEntry *pen, Term t) {
EnterCreepMode(void) {
PredEntry *PredSpy = RepPredProp(PredPropByFunc(FunctorSpy,0));
ARG1 = MkPairTerm(Module_Name((CODEADDR)(pen)),t);
ARG1 = MkPairTerm(ModuleName[CurrentModule],ARG1);
CreepFlag = CalculateStackGap();
P_before_spy = P;
return (CallPredicate(PredSpy, B));
@ -202,7 +202,9 @@ EnterCreepMode(PredEntry *pen, Term t) {
inline static Int
do_execute(Term t, int mod)
{
if (PredGoalExpansion->OpcodeOfPred != UNDEF_OPCODE) {
if (yap_flags[SPY_CREEP_FLAG]) {
return(EnterCreepMode());
} else if (PredGoalExpansion->OpcodeOfPred != UNDEF_OPCODE) {
return(CallMetaCall(mod));
}
restart_exec:
@ -234,9 +236,6 @@ do_execute(Term t, int mod)
}
return(CallMetaCall(mod));
}
if (yap_flags[SPY_CREEP_FLAG]) {
return(EnterCreepMode(pen, t));
}
/* now let us do what we wanted to do from the beginning !! */
/* I cannot use the standard macro here because
otherwise I would dereference the argument and
@ -264,9 +263,6 @@ do_execute(Term t, int mod)
return(FALSE);
/* call may not define new system predicates!! */
pe = RepPredProp(PredPropByAtom(a, mod));
if (yap_flags[SPY_CREEP_FLAG]) {
return(EnterCreepMode(pe, t));
}
return (CallPredicate(pe, B));
} else if (IsIntTerm(t)) {
return CallError(TYPE_ERROR_CALLABLE, mod);
@ -307,8 +303,11 @@ p_execute_within(void)
SMALLUNSGN mod = LookupModule(tmod);
restart_exec:
if (PredGoalExpansion->OpcodeOfPred != UNDEF_OPCODE) {
if (yap_flags[SPY_CREEP_FLAG]) {
return(EnterCreepMode());
} else if (PredGoalExpansion->OpcodeOfPred != UNDEF_OPCODE) {
return(CallMetaCallWithin());
/* at this point check if we should enter creep mode */
} else if (IsVarTerm(t)) {
return CallError(INSTANTIATION_ERROR, mod);
} else if (IsApplTerm(t)) {
@ -340,10 +339,6 @@ p_execute_within(void)
}
return(CallMetaCallWithin());
}
/* at this point check if we should enter creep mode */
if (yap_flags[SPY_CREEP_FLAG]) {
return(EnterCreepMode(pen,t));
}
/* now let us do what we wanted to do from the beginning !! */
/* I cannot use the standard macro here because
otherwise I would dereference the argument and
@ -397,9 +392,6 @@ p_execute_within(void)
} else {
/* call may not define new system predicates!! */
pe = PredPropByAtom(a, mod);
if (yap_flags[SPY_CREEP_FLAG]) {
return(EnterCreepMode(RepPredProp(pe),t));
}
return (CallPredicate(RepPredProp(pe), B));
}
} else {
@ -415,7 +407,9 @@ p_execute_within2(void)
Term t = Deref(ARG1);
Prop pe;
if (PredGoalExpansion->OpcodeOfPred != UNDEF_OPCODE) {
if (yap_flags[SPY_CREEP_FLAG]) {
return(EnterCreepMode());
} else if (PredGoalExpansion->OpcodeOfPred != UNDEF_OPCODE) {
return(CallMetaCallWithin());
} else if (IsVarTerm(t)) {
return CallError(INSTANTIATION_ERROR, CurrentModule);
@ -441,9 +435,6 @@ p_execute_within2(void)
return(CallMetaCallWithin());
}
/* at this point check if we should enter creep mode */
if (yap_flags[SPY_CREEP_FLAG]) {
return(EnterCreepMode(pen,t));
}
/* now let us do what we wanted to do from the beginning !! */
/* I cannot use the standard macro here because
otherwise I would dereference the argument and
@ -494,9 +485,6 @@ p_execute_within2(void)
}
/* call may not define new system predicates!! */
pe = PredPropByAtom(a, CurrentModule);
if (yap_flags[SPY_CREEP_FLAG]) {
return(EnterCreepMode(RepPredProp(pe),t));
}
return (CallPredicate(RepPredProp(pe), B));
} else if (IsIntTerm(t)) {
return CallError(TYPE_ERROR_CALLABLE, CurrentModule);

View File

@ -41,33 +41,17 @@ send_tracer_message(char *start, char *name, Int arity, char *mname, CELL *args)
{
if (name == NULL) {
#ifdef YAPOR
#ifdef DEPTH_LIMIT
YP_fprintf(YP_stderr, "(%d)%s (D:%ld)", worker_id, start, (CELL)IntegerOfTerm(DEPTH)/2);
#else
YP_fprintf(YP_stderr, "(%d)%s", worker_id, start);
#endif
#else
#ifdef DEPTH_LIMIT
YP_fprintf(YP_stderr, "%s (D:%ld)", start, (CELL)IntegerOfTerm(DEPTH)/2);
#else
YP_fprintf(YP_stderr, "%s", start);
#endif
#endif
} else {
int i;
if (arity) {
#ifdef DEPTH_LIMIT
YP_fprintf(YP_stderr, "%s (D:%ld) %s:%s(", start, (CELL)IntegerOfTerm(DEPTH)/2, mname, name);
#else
YP_fprintf(YP_stderr, "%s %s:%s(", start, mname, name);
#endif
} else {
#ifdef DEPTH_LIMIT
YP_fprintf(YP_stderr, "%s (D:%ld) %s:%s", start, (CELL)IntegerOfTerm(DEPTH)/2, mname, name);
#else
YP_fprintf(YP_stderr, "%s %s:%s", start, mname, name);
#endif
}
for (i= 0; i < arity; i++) {
if (i > 0) YP_fprintf(YP_stderr, ",");
@ -133,7 +117,7 @@ low_level_trace(yap_low_level_port port, PredEntry *pred, CELL *args)
/* if (vsc_count < 13198050) return; */
/* if (vsc_count > 500000) exit(0); */
/* if (gc_calls < 1) return;*/
YP_fprintf(YP_stderr,"%lu ", vsc_count);
YP_fprintf(YP_stderr,"%lu (%x) ", vsc_count, CreepFlag);
/* check_trail_consistency(); */
if (pred == NULL) {
return;

View File

@ -10,7 +10,7 @@
* File: Regs.h *
* mods: *
* comments: YAP abstract machine registers *
* version: $Id: Regs.h,v 1.7 2001-11-25 19:48:34 vsc Exp $ *
* version: $Id: Regs.h,v 1.8 2001-12-07 20:27:03 vsc Exp $ *
*************************************************************************/
@ -96,7 +96,7 @@ typedef struct
Term TermNil_; /* 20 */
#endif
#endif
SMALLUNSGN CurrentModulePtr_;
SMALLUNSGN CurrentModule_;
#if (defined(YAPOR) && defined(SBA)) || defined(TABLING)
CELL *H_FZ_;
choiceptr B_FZ_;
@ -644,7 +644,7 @@ EXTERN inline void restore_B(void) {
#ifdef COROUTINING
#define DelayedVars REGS.DelayedVars_
#endif
#define CurrentModule REGS.CurrentModulePtr_
#define CurrentModule REGS.CurrentModule_
#define REG_SIZE sizeof(REGS)/sizeof(CELL *)

1
TO_DO
View File

@ -6,6 +6,7 @@ BEFORE 4.4:
- document new interface functions.
- mask when installing.
- debugger: leash(full). [-user]. a(X) :- call(setof(Z,call(c(Z)),X)). a(X) :- b(X). b(X) :- c(X). c(1). c(2). end_of_file. spy a/1. a(X).
- debugger: don't stop from within system code.
TO CHECK:
- bad register allocation for a(X,Y) :- X is Y+2.3 ?

View File

@ -247,6 +247,8 @@ debugging :-
'$awoken_goals'(LG), !,
'$creep',
'$wake_up_goal'(G, LG).
'$spy'([_|Mod:G]) :- !,
'$spy'([Mod|G]).
'$spy'([Module|G]) :-
% '$format'(user_error,"$spym(~w,~w)~n",[Module,G]),
( '$hidden'(G)
@ -729,14 +731,14 @@ debugging :-
'$creep_call_undefined'(A,M,CP) :-
functor(A,F,N),
'$recorded'('$import','$import'(S,M,F,N),_), !,
'$creep_call'(S:A,CP).
'$creep_call_undefined'(G, M, _) :-
'$creep_call'(A,S,CP).
'$creep_call_undefined'(G, M, CP) :-
( \+ '$undefined'(unknown_predicate_handler(_,_,_), user),
user:unknown_predicate_handler(G,NM,NG) ->
'$creep_call'(NM:NG) ;
'$creep_call'(NG,NM,CP) ;
'$is_dynamic'(G, M) -> fail ;
'$recorded'('$unknown','$unknown'(M:G,US),_),
'$creep_call'(user:US,_)
'$creep_call'(US,M,CP)
).
%'$creep'(G) :- $current_module(M),write(user_error,[creep,M,G]),nl(user_error),fail.