summaryrefslogtreecommitdiff
path: root/rts
diff options
context:
space:
mode:
authorAndreas Klebinger <klebinger.andreas@gmx.at>2020-04-20 16:39:27 +0200
committerBen Gamari <ben@smart-cactus.org>2020-07-15 16:41:02 -0400
commitf47c7208c31bdd695ba46e6bdf4a349ae46c79bc (patch)
tree05e2a092a2e17bfd1dfc2b47f97b13489648e7d4 /rts
parent4c026b6cf5eb25651f656833e4d312621866330d (diff)
downloadhaskell-f47c7208c31bdd695ba46e6bdf4a349ae46c79bc.tar.gz
winio: Add an exported isHeapAlloced function to the RTS
Diffstat (limited to 'rts')
-rw-r--r--rts/sm/Sanity.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/rts/sm/Sanity.c b/rts/sm/Sanity.c
index 2329b02016..c09e28c0aa 100644
--- a/rts/sm/Sanity.c
+++ b/rts/sm/Sanity.c
@@ -32,11 +32,13 @@
#include "sm/NonMoving.h"
#include "sm/NonMovingMark.h"
#include "Profiling.h" // prof_arena
+#include "HeapAlloc.h"
/* -----------------------------------------------------------------------------
Forward decls.
-------------------------------------------------------------------------- */
+int isHeapAlloced ( StgPtr p);
static void checkSmallBitmap ( StgPtr payload, StgWord bitmap, uint32_t );
static void checkLargeBitmap ( StgPtr payload, StgLargeBitmap*, uint32_t );
static void checkClosureShallow ( const StgClosure * );
@@ -46,6 +48,13 @@ static W_ countNonMovingSegments ( struct NonmovingSegment *segs );
static W_ countNonMovingHeap ( struct NonmovingHeap *heap );
/* -----------------------------------------------------------------------------
+ Debugging utility.
+ -------------------------------------------------------------------------- */
+
+// the HEAP_ALLOCED macro in function form. Useful for use in GDB or similar.
+int isHeapAlloced ( StgPtr p) { return HEAP_ALLOCED(p); }
+
+/* -----------------------------------------------------------------------------
Check stack sanity
-------------------------------------------------------------------------- */