From 6b1dd7065f30176a518d69d963160c5faafc7adb Mon Sep 17 00:00:00 2001 From: Mark Pizzolato Date: Sat, 1 Mar 2014 17:56:12 -0800 Subject: [PATCH] PDP11, PDP10, VAX, AltairZ80: enhanced the macro which aborts on an unexpected status from an expression with side effects to also write a message to sim_log or sim_deb if they happen to be open. --- sim_defs.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sim_defs.h b/sim_defs.h index 19ac162d..743097c6 100644 --- a/sim_defs.h +++ b/sim_defs.h @@ -747,7 +747,10 @@ typedef struct sim_bitfield BITFIELD; /* This replaces any references to "assert()" which should never be invoked */ /* with an expression which causes side effects (i.e. must be executed for */ /* the program to work correctly) */ -#define ASSURE(_Expression) if (_Expression) {fprintf(stderr, "%s failed at %s line %d\n", #_Expression, __FILE__, __LINE__); abort();} else (void)0 +#define ASSURE(_Expression) if (_Expression) {fprintf(stderr, "%s failed at %s line %d\n", #_Expression, __FILE__, __LINE__); \ + if (sim_log) fprintf(sim_log, "%s failed at %s line %d\n", #_Expression, __FILE__, __LINE__); \ + if (sim_deb) fprintf(sim_deb, "%s failed at %s line %d\n", #_Expression, __FILE__, __LINE__); \ + abort();} else (void)0 /* Asynch/Threaded I/O support */