diff --git a/src/hpc/thread.c b/src/hpc/thread.c index 60b7ff07e3..2a36cc7c1c 100644 --- a/src/hpc/thread.c +++ b/src/hpc/thread.c @@ -1309,12 +1309,21 @@ Region * CurrentRegion(void) return TLS(currentRegion); } +// Kernel debugging information for guards. +// +// When compiled with -DDEBUG_GUARDS, the GAP variable GUARD_ERROR_STACK +// will contain the C stack after an error, allowing us to located where +// it occurred without having to fire up a debugger first. +// +// The variables NumReadErrors and NumWriteErrors track the number of +// failed guard checks. These are used in conjunction with the low-level +// function DISABLE_GUARDS() in order to track how many guard failures +// occur in a given section of code. + #ifdef DEBUG_GUARDS extern GVarDescriptor GUARD_ERROR_STACK; #endif -// These are temporary debugging functions. - static Int NumReadErrors = 0; static Int NumWriteErrors = 0; diff --git a/src/system.h b/src/system.h index f88c077f88..23cec238a2 100644 --- a/src/system.h +++ b/src/system.h @@ -63,10 +63,12 @@ GAP_STATIC_ASSERT(sizeof(void *) == SIZEOF_VOID_P, "sizeof(void *) is wrong"); #endif #endif -// If we are not running HPC-GAP, disable read and write guards. +// If we are not running HPC-GAP, guards should be disabled #ifndef HPCGAP -#undef USE_HPC_GUARDS +#ifdef USE_HPC_GUARDS +#error Do not use --enable-guards without --enable-hpcgap. +#endif #endif /****************************************************************************