summaryrefslogtreecommitdiff
path: root/includes/RtsAPI.h
diff options
context:
space:
mode:
authorDavid Eichmann <EichmannD@gmail.com>2020-11-02 13:53:28 +0000
committerDavid Eichmann <EichmannD@gmail.com>2020-11-09 11:02:32 +0000
commitb624c806746d6b375ade398a13695f5e2294b083 (patch)
treeb0b1c49dc766f8b588afe340a79c0b438e28b8e9 /includes/RtsAPI.h
parent1370eda7a53f5dfc88afe705b2ffecb1d5544ec7 (diff)
downloadhaskell-wip/ghc-debug_gc_roots.tar.gz
Add rts_listThreads and rts_listMiscRoots to RtsAPI.hwip/ghc-debug_gc_roots
These are used to find the current roots of the garbage collector. Co-authored-by: Sven Tennie's avatarSven Tennie <sven.tennie@gmail.com> Co-authored-by: Matthew Pickering's avatarMatthew Pickering <matthewtpickering@gmail.com> Co-authored-by: default avatarBen Gamari <bgamari.foss@gmail.com>
Diffstat (limited to 'includes/RtsAPI.h')
-rw-r--r--includes/RtsAPI.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/includes/RtsAPI.h b/includes/RtsAPI.h
index 6c782e504a..36ab4d4b04 100644
--- a/includes/RtsAPI.h
+++ b/includes/RtsAPI.h
@@ -17,8 +17,10 @@ extern "C" {
#include "HsFFI.h"
#include "rts/Time.h"
+#include "rts/Types.h"
#include "rts/EventLogWriter.h"
+
/*
* Running the scheduler
*/
@@ -566,6 +568,16 @@ void rts_resume (PauseToken *pauseToken);
// Returns true if the rts is paused. See rts_pause() and rts_resume().
bool rts_isPaused(void);
+// List all live threads. The RTS must be paused and this must be called on the
+// same thread that called rts_pause().
+typedef void (*ListThreadsCb)(void *user, StgTSO *);
+void rts_listThreads(ListThreadsCb cb, void *user);
+
+// List all non-thread GC roots. The RTS must be paused and this must be called
+// on the same thread that called rts_pause().
+typedef void (*ListRootsCb)(void *user, StgClosure *);
+void rts_listMiscRoots(ListRootsCb cb, void *user);
+
/*
* The RTS allocates some thread-local data when you make a call into
* Haskell using one of the rts_eval() functions. This data is not