WIN64 support (sill needs improvement)
This commit is contained in:
36
C/tracer.c
Normal file → Executable file
36
C/tracer.c
Normal file → Executable file
@@ -25,6 +25,7 @@
|
||||
#include "yapio.h"
|
||||
#include "clause.h"
|
||||
#include "tracer.h"
|
||||
#include "SWI-Stream.h"
|
||||
|
||||
static void send_tracer_message(char *, char *, Int, char *, CELL *);
|
||||
|
||||
@@ -33,32 +34,32 @@ send_tracer_message(char *start, char *name, Int arity, char *mname, CELL *args)
|
||||
{
|
||||
if (name == NULL) {
|
||||
#ifdef YAPOR
|
||||
fprintf(GLOBAL_stderr, "(%d)%s", worker_id, start);
|
||||
Sfprintf(GLOBAL_stderr, "(%d)%s", worker_id, start);
|
||||
#else
|
||||
fprintf(GLOBAL_stderr, "%s", start);
|
||||
Sfprintf(GLOBAL_stderr, "%s", start);
|
||||
#endif
|
||||
} else {
|
||||
int i;
|
||||
|
||||
if (arity) {
|
||||
if (args)
|
||||
fprintf(GLOBAL_stderr, "%s %s:%s(", start, mname, name);
|
||||
Sfprintf(GLOBAL_stderr, "%s %s:%s(", start, mname, name);
|
||||
else
|
||||
fprintf(GLOBAL_stderr, "%s %s:%s/%lu", start, mname, name, (unsigned long int)arity);
|
||||
Sfprintf(GLOBAL_stderr, "%s %s:%s/%lu", start, mname, name, (unsigned long int)arity);
|
||||
} else {
|
||||
fprintf(GLOBAL_stderr, "%s %s:%s", start, mname, name);
|
||||
Sfprintf(GLOBAL_stderr, "%s %s:%s", start, mname, name);
|
||||
}
|
||||
if (args) {
|
||||
for (i= 0; i < arity; i++) {
|
||||
if (i > 0) fprintf(GLOBAL_stderr, ",");
|
||||
Yap_plwrite(args[i], NULL, 15, Handle_vars_f|AttVar_Portray_f, 1200);
|
||||
if (i > 0) Sfprintf(GLOBAL_stderr, ",");
|
||||
Yap_plwrite(args[i], GLOBAL_stderr, 15, Handle_vars_f|AttVar_Portray_f, 1200);
|
||||
}
|
||||
if (arity) {
|
||||
fprintf(GLOBAL_stderr, ")");
|
||||
Sfprintf(GLOBAL_stderr, ")");
|
||||
}
|
||||
}
|
||||
}
|
||||
fprintf(GLOBAL_stderr, "\n");
|
||||
Sfprintf(GLOBAL_stderr, "\n");
|
||||
}
|
||||
|
||||
#if defined(__GNUC__)
|
||||
@@ -120,7 +121,7 @@ check_area(void)
|
||||
first = i;
|
||||
found = TRUE;
|
||||
}
|
||||
fprintf(stderr,"%lld changed %d\n",vsc_count,i);
|
||||
Sfprintf(stderr,"%lld changed %d\n",vsc_count,i);
|
||||
}
|
||||
array[i] = ((CELL *)0x187a800)[i];
|
||||
}
|
||||
@@ -146,12 +147,12 @@ low_level_trace(yap_low_level_port port, PredEntry *pred, CELL *args)
|
||||
LOCK(Yap_heap_regs->low_level_trace_lock);
|
||||
sc = Yap_heap_regs;
|
||||
//if (vsc_count == 54) jmp_deb(1);
|
||||
// fprintf(stderr,"B=%p ", B);
|
||||
// Sfprintf(stderr,"B=%p ", B);
|
||||
#ifdef THREADS
|
||||
LOCAL_ThreadHandle.thread_inst_count++;
|
||||
#endif
|
||||
#ifdef COMMENTED
|
||||
fprintf(stderr,"in %p\n");
|
||||
Sfprintf(stderr,"in %p\n");
|
||||
CELL * gc_ENV = ENV;
|
||||
while (gc_ENV != NULL) { /* no more environments */
|
||||
fprintf(stderr,"%ld\n", LCL0-gc_ENV);
|
||||
@@ -180,7 +181,7 @@ low_level_trace(yap_low_level_port port, PredEntry *pred, CELL *args)
|
||||
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]);
|
||||
Sfprintf(GLOBAL_stderr,"VAL %lld %d %x/%x\n",vsc_count,sz,H0[16],H0[16+end]);
|
||||
}
|
||||
} else
|
||||
return;
|
||||
@@ -292,9 +293,9 @@ low_level_trace(yap_low_level_port port, PredEntry *pred, CELL *args)
|
||||
printf("\n");
|
||||
}
|
||||
#endif
|
||||
fprintf(GLOBAL_stderr,"%lld ",vsc_count);
|
||||
Sfprintf(GLOBAL_stderr,"%lld ",vsc_count);
|
||||
#if defined(THREADS) || defined(YAPOR)
|
||||
fprintf(GLOBAL_stderr,"(%d)", worker_id);
|
||||
Sfprintf(GLOBAL_stderr,"(%d)", worker_id);
|
||||
#endif
|
||||
/* check_trail_consistency(); */
|
||||
if (pred == NULL) {
|
||||
@@ -377,6 +378,7 @@ low_level_trace(yap_low_level_port port, PredEntry *pred, CELL *args)
|
||||
}
|
||||
break;
|
||||
}
|
||||
Sflush(GLOBAL_stderr);
|
||||
fflush(NULL);
|
||||
UNLOCK(Yap_heap_regs->low_level_trace_lock);
|
||||
}
|
||||
@@ -389,6 +391,7 @@ toggle_low_level_trace(void)
|
||||
|
||||
static Int p_start_low_level_trace( USES_REGS1 )
|
||||
{
|
||||
GLOBAL_stderr = Sopen_file("LOG", "w");
|
||||
Yap_do_low_level_trace = TRUE;
|
||||
return(TRUE);
|
||||
}
|
||||
@@ -406,7 +409,7 @@ static Int p_reset_total_choicepoints( USES_REGS1 )
|
||||
|
||||
static Int p_show_low_level_trace( USES_REGS1 )
|
||||
{
|
||||
fprintf(stderr,"Call counter=%lld\n",vsc_count);
|
||||
Sfprintf(GLOBAL_stderr,"Call counter=%lld\n",vsc_count);
|
||||
return(TRUE);
|
||||
}
|
||||
|
||||
@@ -425,6 +428,7 @@ static Int p_stop_low_level_trace( USES_REGS1 )
|
||||
{
|
||||
Yap_do_low_level_trace = FALSE;
|
||||
LOCAL_do_trace_primitives = TRUE;
|
||||
debug_locks = TRUE;
|
||||
return(TRUE);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user