2001-04-09 20:54:03 +01:00
|
|
|
/*************************************************************************
|
|
|
|
* *
|
|
|
|
* YAP Prolog @(#)amidefs.h 1.3 3/15/90
|
|
|
|
* *
|
|
|
|
* Yap Prolog was developed at NCCUP - Universidade do Porto *
|
|
|
|
* *
|
|
|
|
* Copyright L.Damas, V.S.Costa and Universidade do Porto 1985-1997 *
|
|
|
|
* *
|
|
|
|
**************************************************************************
|
|
|
|
* *
|
|
|
|
* File: tracer.h *
|
|
|
|
* Last rev: *
|
|
|
|
* mods: *
|
|
|
|
* comments: definitions for low level tracer *
|
|
|
|
* *
|
|
|
|
*************************************************************************/
|
|
|
|
|
|
|
|
#include "Yap.h"
|
|
|
|
|
|
|
|
#ifdef LOW_LEVEL_TRACER
|
|
|
|
|
|
|
|
#include "Yatom.h"
|
2001-08-08 22:17:27 +01:00
|
|
|
#include "Heap.h"
|
2001-04-09 20:54:03 +01:00
|
|
|
#include "yapio.h"
|
|
|
|
#include "tracer.h"
|
|
|
|
|
|
|
|
STATIC_PROTO(int TracePutchar, (int, int));
|
|
|
|
STATIC_PROTO(void send_tracer_message, (char *, char *, Int, char *, CELL *));
|
|
|
|
|
|
|
|
static int do_trace_primitives = TRUE;
|
|
|
|
|
2001-06-13 18:52:33 +01:00
|
|
|
static int
|
2001-04-09 20:54:03 +01:00
|
|
|
TracePutchar(int sno, int ch)
|
|
|
|
{
|
2002-11-18 18:18:05 +00:00
|
|
|
return(putc(ch, Yap_stderr)); /* use standard error stream, which is supposed to be 2*/
|
2001-04-09 20:54:03 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
send_tracer_message(char *start, char *name, Int arity, char *mname, CELL *args)
|
|
|
|
{
|
2006-03-30 02:11:10 +01:00
|
|
|
UInt omax_depth, omax_list, omax_write_args;
|
|
|
|
|
2001-04-09 20:54:03 +01:00
|
|
|
if (name == NULL) {
|
|
|
|
#ifdef YAPOR
|
2002-11-18 18:18:05 +00:00
|
|
|
fprintf(Yap_stderr, "(%d)%s", worker_id, start);
|
2001-04-09 20:54:03 +01:00
|
|
|
#else
|
2002-11-18 18:18:05 +00:00
|
|
|
fprintf(Yap_stderr, "%s", start);
|
2001-04-09 20:54:03 +01:00
|
|
|
#endif
|
|
|
|
} else {
|
|
|
|
int i;
|
|
|
|
|
|
|
|
if (arity) {
|
2008-09-14 05:11:35 +01:00
|
|
|
if (args)
|
|
|
|
fprintf(Yap_stderr, "%s %s:%s(", start, mname, name);
|
|
|
|
else
|
|
|
|
fprintf(Yap_stderr, "%s %s:%s/%d", start, mname, name, arity);
|
2001-04-09 20:54:03 +01:00
|
|
|
} else {
|
2002-11-18 18:18:05 +00:00
|
|
|
fprintf(Yap_stderr, "%s %s:%s", start, mname, name);
|
2001-04-09 20:54:03 +01:00
|
|
|
}
|
2008-09-14 05:11:35 +01:00
|
|
|
if (args) {
|
|
|
|
for (i= 0; i < arity; i++) {
|
|
|
|
if (i > 0) fprintf(Yap_stderr, ",");
|
2001-04-09 20:54:03 +01:00
|
|
|
#if DEBUG
|
|
|
|
#if COROUTINING
|
2008-09-14 05:11:35 +01:00
|
|
|
Yap_Portray_delays = FALSE;
|
2001-04-09 20:54:03 +01:00
|
|
|
#endif
|
|
|
|
#endif
|
2008-09-14 05:11:35 +01:00
|
|
|
omax_depth = max_depth;
|
|
|
|
omax_list = max_list;
|
|
|
|
omax_write_args = max_write_args;
|
|
|
|
max_depth = 5;
|
|
|
|
max_list = 5;
|
|
|
|
max_write_args = 10;
|
|
|
|
Yap_plwrite(args[i], TracePutchar, Handle_vars_f);
|
|
|
|
max_depth = omax_depth;
|
|
|
|
max_list = omax_list;
|
|
|
|
max_write_args = omax_write_args;
|
2001-04-09 20:54:03 +01:00
|
|
|
#if DEBUG
|
|
|
|
#if COROUTINING
|
2008-09-14 05:11:35 +01:00
|
|
|
Yap_Portray_delays = FALSE;
|
2001-04-09 20:54:03 +01:00
|
|
|
#endif
|
|
|
|
#endif
|
2008-09-14 05:11:35 +01:00
|
|
|
}
|
2008-09-23 22:49:44 +01:00
|
|
|
if (arity) {
|
|
|
|
fprintf(Yap_stderr, ")");
|
|
|
|
}
|
2001-04-09 20:54:03 +01:00
|
|
|
}
|
|
|
|
}
|
2002-11-18 18:18:05 +00:00
|
|
|
fprintf(Yap_stderr, "\n");
|
2001-04-09 20:54:03 +01:00
|
|
|
}
|
|
|
|
|
2002-01-03 16:27:00 +00:00
|
|
|
#if defined(__GNUC__)
|
|
|
|
unsigned long long vsc_count;
|
|
|
|
#else
|
2001-04-09 20:54:03 +01:00
|
|
|
unsigned long vsc_count;
|
2002-01-03 16:27:00 +00:00
|
|
|
#endif
|
2001-04-09 20:54:03 +01:00
|
|
|
|
2004-02-21 20:25:45 +00:00
|
|
|
#if THREADS
|
|
|
|
static int thread_trace;
|
|
|
|
#endif
|
|
|
|
|
2001-04-09 20:54:03 +01:00
|
|
|
/*
|
|
|
|
static int
|
|
|
|
check_trail_consistency(void) {
|
|
|
|
tr_fr_ptr ptr = TR;
|
2002-11-18 18:18:05 +00:00
|
|
|
while (ptr > (CELL *)Yap_TrailBase) {
|
2001-04-09 20:54:03 +01:00
|
|
|
ptr = --ptr;
|
|
|
|
if (!IsVarTerm(TrailTerm(ptr))) {
|
|
|
|
if (IsApplTerm(TrailTerm(ptr))) {
|
|
|
|
CELL *cptr = (CELL *)ptr;
|
|
|
|
ptr = (tr_fr_ptr)(cptr-1);
|
|
|
|
} else {
|
|
|
|
if (IsPairTerm(TrailTerm(ptr))) {
|
|
|
|
CELL *p = RepPair(TrailTerm(ptr));
|
|
|
|
if (p < H0) continue;
|
|
|
|
}
|
|
|
|
printf("Oops at call %ld, B->cp(%p) TR(%p) pt(%p)\n", vsc_count,B->cp_tr, TR, ptr);
|
|
|
|
return(FALSE);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return(TRUE);
|
|
|
|
}
|
|
|
|
*/
|
|
|
|
|
2001-05-08 21:39:01 +01:00
|
|
|
|
2003-11-12 12:33:31 +00:00
|
|
|
CELL old_value = 0L, old_value2 = 0L;
|
|
|
|
|
2005-11-15 00:50:49 +00:00
|
|
|
void jmp_deb(int);
|
|
|
|
|
|
|
|
void
|
2004-08-27 21:18:52 +01:00
|
|
|
jmp_deb(int i) {if (i) printf("Here we go\n"); else jmp_deb(0);}
|
2004-06-17 23:07:23 +01:00
|
|
|
|
2005-11-04 01:17:17 +00:00
|
|
|
struct various_codes *sc;
|
|
|
|
|
2006-04-28 14:23:23 +01:00
|
|
|
/*
|
|
|
|
CELL array[332];
|
|
|
|
|
|
|
|
int found = FALSE;
|
|
|
|
|
|
|
|
static void
|
|
|
|
check_area(void)
|
|
|
|
{
|
|
|
|
int i, first = -1;
|
|
|
|
for (i= 0; i < 332; i++) {
|
|
|
|
if (array[i] !=((CELL *)0x187a800)[i]) {
|
|
|
|
if (first != -1) {
|
|
|
|
first = i;
|
|
|
|
found = TRUE;
|
|
|
|
}
|
|
|
|
fprintf(stderr,"%lld changed %d\n",vsc_count,i);
|
|
|
|
}
|
|
|
|
array[i] = ((CELL *)0x187a800)[i];
|
|
|
|
}
|
|
|
|
if (first != -1)
|
|
|
|
jmp_deb(i);
|
|
|
|
}
|
|
|
|
*/
|
|
|
|
|
2008-01-25 00:21:28 +00:00
|
|
|
PredEntry *old_p[10000];
|
|
|
|
Term old_x1[10000], old_x2[10000], old_x3[10000];
|
2008-01-24 22:47:14 +00:00
|
|
|
|
2001-04-09 20:54:03 +01:00
|
|
|
void
|
|
|
|
low_level_trace(yap_low_level_port port, PredEntry *pred, CELL *args)
|
|
|
|
{
|
|
|
|
char *s;
|
|
|
|
char *mname;
|
|
|
|
Int arity;
|
2002-01-18 15:55:33 +00:00
|
|
|
/* extern int gc_calls; */
|
2001-04-09 20:54:03 +01:00
|
|
|
|
2006-04-20 18:29:46 +01:00
|
|
|
LOCK(Yap_heap_regs->low_level_trace_lock);
|
2005-11-04 01:17:17 +00:00
|
|
|
sc = Yap_heap_regs;
|
2007-01-08 08:27:19 +00:00
|
|
|
vsc_count++;
|
2008-05-11 00:24:13 +01:00
|
|
|
#ifdef THREADS
|
|
|
|
Yap_heap_regs->thread_handle[worker_id].thread_inst_count++;
|
|
|
|
#endif
|
2008-01-24 10:20:42 +00:00
|
|
|
#ifdef COMMENTED
|
2008-01-23 17:57:56 +00:00
|
|
|
//*(H0+(0xb65f2850-0xb64b2008)/sizeof(CELL))==0xc ||
|
|
|
|
//0x4fd4d
|
2007-11-07 09:25:27 +00:00
|
|
|
if (vsc_count == 40650191LL)
|
|
|
|
jmp_deb(1);
|
|
|
|
return;
|
2006-12-27 01:32:38 +00:00
|
|
|
if (vsc_count > 1388060LL && vsc_count < 1388070LL) {
|
|
|
|
if (vsc_count==1388061LL)
|
|
|
|
jmp_deb(1);
|
|
|
|
if (vsc_count % 1LL == 0) {
|
|
|
|
UInt sz = Yap_regp->H0_[17];
|
|
|
|
UInt end = sizeof(MP_INT)/sizeof(CELL)+sz+1;
|
|
|
|
fprintf(stderr,"VAL %lld %d %x/%x\n",vsc_count,sz,H0[16],H0[16+end]);
|
|
|
|
}
|
|
|
|
} else
|
|
|
|
return;
|
|
|
|
Yap_DebugPlWrite(Yap_XREGS[2]);
|
2006-05-04 18:47:28 +01:00
|
|
|
if (worker_id != 04 || worker_id != 03) return;
|
2004-02-19 19:24:46 +00:00
|
|
|
// if (vsc_count == 218280)
|
|
|
|
// vsc_xstop = 1;
|
2004-04-20 23:08:57 +01:00
|
|
|
if (vsc_count < 1468068888) {
|
2004-12-02 06:06:47 +00:00
|
|
|
UNLOCK(Yap_heap_regs->low_level_trace_lock);
|
2004-02-19 19:24:46 +00:00
|
|
|
return;
|
|
|
|
}
|
2003-11-12 12:33:31 +00:00
|
|
|
if (port != enter_pred ||
|
|
|
|
!pred ||
|
|
|
|
pred->ArityOfPE != 4 ||
|
2006-04-20 18:29:46 +01:00
|
|
|
strcmp(RepAtom(NameOfFunctor(pred->FunctorOfPred))->StrOfAE,"in_between_target_phrases")) {
|
|
|
|
UNLOCK(Yap_heap_regs->low_level_trace_lock);
|
2003-11-12 12:33:31 +00:00
|
|
|
return;
|
2006-04-20 18:29:46 +01:00
|
|
|
}
|
|
|
|
if (vsc_count < 1246949400LL) {
|
|
|
|
UNLOCK(Yap_heap_regs->low_level_trace_lock);
|
2003-11-12 12:33:31 +00:00
|
|
|
return;
|
2006-04-20 18:29:46 +01:00
|
|
|
}
|
2003-11-12 12:33:31 +00:00
|
|
|
if (vsc_count == 1246949493LL)
|
|
|
|
vsc_xstop = TRUE;
|
2006-04-20 18:29:46 +01:00
|
|
|
if (vsc_count < 5646100000LL) {
|
|
|
|
UNLOCK(Yap_heap_regs->low_level_trace_lock);
|
2003-10-30 22:52:46 +00:00
|
|
|
return;
|
2006-04-20 18:29:46 +01:00
|
|
|
}
|
2003-10-30 22:52:46 +00:00
|
|
|
if (vsc_count == 5646100441LL)
|
|
|
|
vsc_xstop = TRUE;
|
2003-10-28 01:16:03 +00:00
|
|
|
if (vsc_count < 2923351500LL) {
|
2006-04-20 18:29:46 +01:00
|
|
|
UNLOCK(Yap_heap_regs->low_level_trace_lock);
|
2003-09-15 18:56:27 +01:00
|
|
|
return;
|
|
|
|
}
|
2003-10-14 19:37:56 +01:00
|
|
|
if (vsc_count == 123536441LL) vsc_xstop = 1;
|
2003-08-27 14:37:10 +01:00
|
|
|
if (vsc_count < 5530257LL) {
|
2006-04-20 18:29:46 +01:00
|
|
|
UNLOCK(Yap_heap_regs->low_level_trace_lock);
|
2003-08-27 14:37:10 +01:00
|
|
|
return;
|
|
|
|
}
|
2004-04-29 04:45:50 +01:00
|
|
|
if (vsc_count == 9414280LL) {
|
2003-08-27 14:37:10 +01:00
|
|
|
vsc_xstop = TRUE;
|
|
|
|
}
|
|
|
|
if (vsc_count < 3399741LL) {
|
2006-04-20 18:29:46 +01:00
|
|
|
UNLOCK(Yap_heap_regs->low_level_trace_lock);
|
2003-08-27 14:37:10 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (vsc_count == 51021) {
|
|
|
|
printf("Here I go\n");
|
|
|
|
}
|
2006-04-20 18:29:46 +01:00
|
|
|
if (vsc_count < 52000) {
|
|
|
|
UNLOCK(Yap_heap_regs->low_level_trace_lock);
|
|
|
|
return;
|
|
|
|
}
|
2003-08-27 14:37:10 +01:00
|
|
|
if (vsc_count > 52000) exit(0);
|
2006-04-20 18:29:46 +01:00
|
|
|
UNLOCK(Yap_heap_regs->low_level_trace_lock);
|
2003-04-30 18:46:05 +01:00
|
|
|
return;
|
2003-08-27 14:37:10 +01:00
|
|
|
if (vsc_count == 837074) {
|
2003-02-11 16:33:24 +00:00
|
|
|
printf("Here I go\n");
|
|
|
|
}
|
2006-04-20 18:29:46 +01:00
|
|
|
if (gc_calls < 1) {
|
|
|
|
UNLOCK(Yap_heap_regs->low_level_trace_lock);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
{
|
2008-03-17 18:31:16 +00:00
|
|
|
CELL *env_ptr = ENV;
|
2006-04-20 18:29:46 +01:00
|
|
|
PredEntry *p;
|
|
|
|
|
|
|
|
while (env_ptr) {
|
|
|
|
PredEntry *pe = EnvPreg(env_ptr[E_CP]);
|
|
|
|
|
|
|
|
printf("%p->",env_ptr,pe);
|
|
|
|
if (vsc_count == 52LL) printf("\n");
|
|
|
|
if (p == pe) {
|
|
|
|
UNLOCK(Yap_heap_regs->low_level_trace_lock);
|
|
|
|
return;
|
2004-06-09 04:32:03 +01:00
|
|
|
}
|
2006-04-20 18:29:46 +01:00
|
|
|
if (env_ptr != NULL)
|
|
|
|
env_ptr = (CELL *)(env_ptr[E_E]);
|
|
|
|
}
|
|
|
|
printf("\n");
|
2004-06-09 04:32:03 +01:00
|
|
|
}
|
2003-02-11 16:33:24 +00:00
|
|
|
#endif
|
2006-05-04 18:47:28 +01:00
|
|
|
fprintf(Yap_stderr,"%lld ",vsc_count);
|
2004-01-23 02:23:51 +00:00
|
|
|
#if defined(THREADS) || defined(YAPOR)
|
|
|
|
fprintf(Yap_stderr,"(%d)", worker_id);
|
2002-01-14 22:26:53 +00:00
|
|
|
#endif
|
2001-04-09 20:54:03 +01:00
|
|
|
/* check_trail_consistency(); */
|
2006-04-20 18:29:46 +01:00
|
|
|
if (pred == NULL) {
|
|
|
|
UNLOCK(Yap_heap_regs->low_level_trace_lock);
|
2001-04-09 20:54:03 +01:00
|
|
|
return;
|
2006-04-20 18:29:46 +01:00
|
|
|
}
|
|
|
|
if (pred->ModuleOfPred == 0 && !do_trace_primitives) {
|
|
|
|
UNLOCK(Yap_heap_regs->low_level_trace_lock);
|
2001-04-09 20:54:03 +01:00
|
|
|
return;
|
2006-04-20 18:29:46 +01:00
|
|
|
}
|
2001-04-09 20:54:03 +01:00
|
|
|
switch (port) {
|
|
|
|
case enter_pred:
|
2004-02-12 12:37:12 +00:00
|
|
|
mname = RepAtom(AtomOfTerm(Yap_Module_Name(pred)))->StrOfAE;
|
2001-04-09 20:54:03 +01:00
|
|
|
arity = pred->ArityOfPE;
|
2001-10-30 16:42:05 +00:00
|
|
|
if (arity == 0)
|
|
|
|
s = RepAtom((Atom)pred->FunctorOfPred)->StrOfAE;
|
2008-01-23 17:57:56 +00:00
|
|
|
else
|
|
|
|
s = RepAtom(NameOfFunctor((pred->FunctorOfPred)))->StrOfAE;
|
2001-04-09 20:54:03 +01:00
|
|
|
/* if ((pred->ModuleOfPred == 0) && (s[0] == '$'))
|
|
|
|
return; */
|
|
|
|
send_tracer_message("CALL: ", s, arity, mname, args);
|
|
|
|
break;
|
|
|
|
case try_or:
|
|
|
|
send_tracer_message("TRY_OR ", NULL, 0, NULL, args);
|
|
|
|
break;
|
|
|
|
case retry_or:
|
|
|
|
send_tracer_message("FAIL ", NULL, 0, NULL, args);
|
|
|
|
send_tracer_message("RETRY_OR ", NULL, 0, NULL, args);
|
|
|
|
break;
|
2005-07-06 20:34:12 +01:00
|
|
|
case retry_table_generator:
|
2001-04-09 20:54:03 +01:00
|
|
|
send_tracer_message("FAIL ", NULL, 0, NULL, args);
|
2005-07-06 20:34:12 +01:00
|
|
|
mname = RepAtom(AtomOfTerm(Yap_Module_Name(pred)))->StrOfAE;
|
|
|
|
arity = pred->ArityOfPE;
|
|
|
|
if (arity == 0)
|
|
|
|
s = RepAtom((Atom)pred->FunctorOfPred)->StrOfAE;
|
|
|
|
else
|
|
|
|
s = RepAtom(NameOfFunctor((pred->FunctorOfPred)))->StrOfAE;
|
|
|
|
send_tracer_message("RETRY GENERATOR: ", s, arity, mname, args);
|
2001-04-09 20:54:03 +01:00
|
|
|
break;
|
|
|
|
case retry_table_consumer:
|
|
|
|
send_tracer_message("FAIL ", NULL, 0, NULL, args);
|
2005-07-06 20:34:12 +01:00
|
|
|
mname = RepAtom(AtomOfTerm(Yap_Module_Name(pred)))->StrOfAE;
|
|
|
|
arity = pred->ArityOfPE;
|
2008-09-14 05:11:35 +01:00
|
|
|
if (arity == 0) {
|
2005-07-06 20:34:12 +01:00
|
|
|
s = RepAtom((Atom)pred->FunctorOfPred)->StrOfAE;
|
2008-09-14 05:11:35 +01:00
|
|
|
send_tracer_message("RETRY CONSUMER: ", s, 0, mname, NULL);
|
|
|
|
} else {
|
2005-07-06 20:34:12 +01:00
|
|
|
s = RepAtom(NameOfFunctor((pred->FunctorOfPred)))->StrOfAE;
|
2008-09-14 05:11:35 +01:00
|
|
|
send_tracer_message("RETRY CONSUMER: ", s, pred->ArityOfPE, mname, NULL);
|
|
|
|
}
|
2005-07-06 20:34:12 +01:00
|
|
|
break;
|
|
|
|
case retry_table_loader:
|
|
|
|
send_tracer_message("FAIL ", NULL, 0, NULL, args);
|
|
|
|
if (pred == UndefCode) {
|
|
|
|
send_tracer_message("RETRY LOADER ", NULL, 0, NULL, NULL);
|
2001-04-09 20:54:03 +01:00
|
|
|
} else {
|
2004-02-12 12:37:12 +00:00
|
|
|
mname = RepAtom(AtomOfTerm(Yap_Module_Name(pred)))->StrOfAE;
|
2001-04-09 20:54:03 +01:00
|
|
|
arity = pred->ArityOfPE;
|
2001-10-30 16:42:05 +00:00
|
|
|
if (arity == 0)
|
|
|
|
s = RepAtom((Atom)pred->FunctorOfPred)->StrOfAE;
|
|
|
|
else
|
|
|
|
s = RepAtom(NameOfFunctor((pred->FunctorOfPred)))->StrOfAE;
|
2005-07-06 20:34:12 +01:00
|
|
|
send_tracer_message("RETRY LOADER: ", s, 0, mname, NULL);
|
2001-04-09 20:54:03 +01:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case retry_pred:
|
2003-08-27 14:37:10 +01:00
|
|
|
send_tracer_message("FAIL ", NULL, 0, NULL, args);
|
2003-10-28 16:20:44 +00:00
|
|
|
if (pred != NULL) {
|
2004-02-12 12:37:12 +00:00
|
|
|
mname = RepAtom(AtomOfTerm(Yap_Module_Name(pred)))->StrOfAE;
|
2003-10-28 16:20:44 +00:00
|
|
|
arity = pred->ArityOfPE;
|
2004-02-12 12:37:12 +00:00
|
|
|
if (pred->ModuleOfPred == IDB_MODULE) {
|
2003-10-28 16:20:44 +00:00
|
|
|
s = "recorded";
|
|
|
|
arity = 3;
|
|
|
|
} else if (arity == 0) {
|
|
|
|
s = RepAtom((Atom)pred->FunctorOfPred)->StrOfAE;
|
|
|
|
} else {
|
|
|
|
s = RepAtom(NameOfFunctor((pred->FunctorOfPred)))->StrOfAE;
|
|
|
|
}
|
|
|
|
send_tracer_message("RETRY: ", s, arity, mname, args);
|
2003-08-27 14:37:10 +01:00
|
|
|
}
|
2001-04-09 20:54:03 +01:00
|
|
|
break;
|
|
|
|
}
|
2006-05-04 18:47:28 +01:00
|
|
|
fflush(NULL);
|
2004-12-02 06:06:47 +00:00
|
|
|
UNLOCK(Yap_heap_regs->low_level_trace_lock);
|
2001-04-09 20:54:03 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
toggle_low_level_trace(void)
|
|
|
|
{
|
2002-11-18 18:18:05 +00:00
|
|
|
Yap_do_low_level_trace = !Yap_do_low_level_trace;
|
2001-04-09 20:54:03 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static Int p_start_low_level_trace(void)
|
|
|
|
{
|
2002-11-18 18:18:05 +00:00
|
|
|
Yap_do_low_level_trace = TRUE;
|
2001-04-09 20:54:03 +01:00
|
|
|
return(TRUE);
|
|
|
|
}
|
|
|
|
|
2008-08-06 18:32:22 +01:00
|
|
|
static Int p_show_low_level_trace(void)
|
|
|
|
{
|
|
|
|
fprintf(stderr,"Call counter=%lld\n",vsc_count);
|
|
|
|
return(TRUE);
|
|
|
|
}
|
|
|
|
|
2004-02-21 20:25:45 +00:00
|
|
|
#ifdef THREADS
|
|
|
|
static Int p_start_low_level_trace2(void)
|
|
|
|
{
|
|
|
|
thread_trace = IntegerOfTerm(Deref(ARG1))+1;
|
|
|
|
Yap_do_low_level_trace = TRUE;
|
|
|
|
return(TRUE);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2001-04-09 20:54:03 +01:00
|
|
|
static Int p_stop_low_level_trace(void)
|
|
|
|
{
|
2002-11-18 18:18:05 +00:00
|
|
|
Yap_do_low_level_trace = FALSE;
|
2001-04-09 20:54:03 +01:00
|
|
|
do_trace_primitives = TRUE;
|
|
|
|
return(TRUE);
|
|
|
|
}
|
|
|
|
|
2006-08-05 04:06:31 +01:00
|
|
|
volatile int vsc_wait;
|
|
|
|
|
|
|
|
static Int p_vsc_wait(void)
|
|
|
|
{
|
2006-08-22 17:12:46 +01:00
|
|
|
fprintf(stderr,"attach %d\n",(int)getpid());
|
2006-08-05 04:06:31 +01:00
|
|
|
while (!vsc_wait);
|
|
|
|
vsc_wait=1;
|
|
|
|
return(TRUE);
|
|
|
|
}
|
|
|
|
|
2001-04-09 20:54:03 +01:00
|
|
|
void
|
2002-11-18 18:18:05 +00:00
|
|
|
Yap_InitLowLevelTrace(void)
|
2001-04-09 20:54:03 +01:00
|
|
|
{
|
2002-11-18 18:18:05 +00:00
|
|
|
Yap_InitCPred("start_low_level_trace", 0, p_start_low_level_trace, SafePredFlag);
|
2004-02-21 20:25:45 +00:00
|
|
|
#if THREADS
|
|
|
|
Yap_InitCPred("start_low_level_trace", 1, p_start_low_level_trace2, SafePredFlag);
|
|
|
|
#endif
|
2002-11-18 18:18:05 +00:00
|
|
|
Yap_InitCPred("stop_low_level_trace", 0, p_stop_low_level_trace, SafePredFlag);
|
2008-08-06 18:32:22 +01:00
|
|
|
Yap_InitCPred("show_low_level_trace", 0, p_show_low_level_trace, SafePredFlag);
|
2006-08-05 04:06:31 +01:00
|
|
|
Yap_InitCPred("vsc_wait", 0, p_vsc_wait, SafePredFlag);
|
2001-04-09 20:54:03 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
2004-02-26 13:37:24 +00:00
|
|
|
|
2005-10-28 18:38:50 +01:00
|
|
|
|