summaryrefslogtreecommitdiff
path: root/rts/Arena.c
diff options
context:
space:
mode:
authorÖmer Sinan Ağacan <omeragacan@gmail.com>2019-01-10 12:42:04 +0300
committerÖmer Sinan Ağacan <omeragacan@gmail.com>2019-01-10 12:42:04 +0300
commit82d1a88dec216d761b17252ede760da5c566007f (patch)
treef925f9294d73682ffccda2ea77374a8ceb685c8e /rts/Arena.c
parent6486c6e49c53e75f37ed732b38c5be7ae64785e8 (diff)
downloadhaskell-82d1a88dec216d761b17252ede760da5c566007f.tar.gz
Implement a sanity check for CCS fields in profiling builds
This helped me debug one of the bugs in #15508. I'm not sure if this is a good idea, but it worked for me, so wanted to submit this as a MR.
Diffstat (limited to 'rts/Arena.c')
-rw-r--r--rts/Arena.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/rts/Arena.c b/rts/Arena.c
index cd547e5b33..e0b4ebde30 100644
--- a/rts/Arena.c
+++ b/rts/Arena.c
@@ -117,3 +117,16 @@ arenaBlocks( void )
{
return arena_blocks;
}
+
+#if defined(DEBUG)
+void checkPtrInArena( StgPtr p, Arena *arena )
+{
+ for (bdescr *bd = arena->current; bd; bd = bd->link) {
+ if (p >= bd->start && p < bd->free) {
+ return;
+ }
+ }
+
+ barf("Location %p is not in arena %p", (void*)p, (void*)arena);
+}
+#endif