From 9bdfabc3815ac484b70251dfa47b32b28c5f7577 Mon Sep 17 00:00:00 2001 From: Vitor Santos Costa Date: Tue, 30 Aug 2016 12:32:08 -0500 Subject: [PATCH] protect regs --- H/tracer.h | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/H/tracer.h b/H/tracer.h index 710884067..055a64437 100644 --- a/H/tracer.h +++ b/H/tracer.h @@ -27,10 +27,19 @@ typedef enum { retry_table_loader } yap_low_level_port; -void low_level_trace(yap_low_level_port, PredEntry *, CELL *); -void Yap_InitLowLevelTrace(void); -void toggle_low_level_trace(void); - +#ifdef saveregs +#define low_level_trace(Port, pred, args) \ + { \ + saveregs(); \ + low_level_trace__(Port, pred, args); \ + setregs(); \ + } +#else +#define low_level_trace(Port, pred, args) low_level_trace__(Port, pred, args) #endif +void low_level_trace__(yap_low_level_port, PredEntry *, CELL *); +void Yap_InitLowLevelTrace(void); +void toggle_low_level_trace(void); +#endif