From cdaf5f2027ea9678e9f92e9140c79da2daa78360 Mon Sep 17 00:00:00 2001 From: Bartosz Nitka Date: Mon, 18 Sep 2017 07:53:56 -0700 Subject: [RTS] Add getObjectLoadStatus This adds a function to the RTS linker API which lets the user check the status of dynamically linked objects. It was initially proposed by @afarmer in D2068. It's useful for testing the linker and also for detecting retention problems in production. It takes a path, because it's easier to use path as key instead of producing some stable handle. It returns an enum instead of bool, because I see no reason for destroying information. All the complexity is already out in the open, so there's nothing to save the users from. Test Plan: ./validate Reviewers: simonmar, Phyx, bgamari, austin, erikd Reviewed By: Phyx, bgamari Subscribers: rwbarton, afarmer, thomie Differential Revision: https://phabricator.haskell.org/D3963 --- includes/rts/Linker.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'includes') diff --git a/includes/rts/Linker.h b/includes/rts/Linker.h index 793195b3ab..298dc6a366 100644 --- a/includes/rts/Linker.h +++ b/includes/rts/Linker.h @@ -47,6 +47,20 @@ HsInt insertSymbol(pathchar* obj_name, char* key, void* data); /* lookup a symbol in the hash table */ void *lookupSymbol( char *lbl ); +/* See Linker.c Note [runtime-linker-phases] */ +typedef enum { + OBJECT_LOADED, + OBJECT_NEEDED, + OBJECT_RESOLVED, + OBJECT_UNLOADED, + OBJECT_DONT_RESOLVE, + OBJECT_NOT_LOADED /* The object was either never loaded or has been + fully unloaded */ +} OStatus; + +/* check object load status */ +OStatus getObjectLoadStatus( pathchar *path ); + /* delete an object from the pool */ HsInt unloadObj( pathchar *path ); -- cgit v1.2.1