summaryrefslogtreecommitdiff
path: root/testsuite/tests/rts/cloneThreadStack.hs
diff options
context:
space:
mode:
authorSven Tennie <sven.tennie@gmail.com>2021-04-03 19:35:34 +0200
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-09-23 15:59:38 -0400
commit29717ecb0711cd03796510fbe9b4bff58c7da870 (patch)
tree850a449ef01caeedf8fd8e9156e7eedcd5a028ce /testsuite/tests/rts/cloneThreadStack.hs
parent6f7f59901c047882ba8c9ae8812264f86b12483a (diff)
downloadhaskell-29717ecb0711cd03796510fbe9b4bff58c7da870.tar.gz
Use Info Table Provenances to decode cloned stack (#18163)
Emit an Info Table Provenance Entry (IPE) for every stack represeted info table if -finfo-table-map is turned on. To decode a cloned stack, lookupIPE() is used. It provides a mapping between info tables and their source location. Please see these notes for details: - [Stacktraces from Info Table Provenance Entries (IPE based stack unwinding)] - [Mapping Info Tables to Source Positions] Metric Increase: T12545
Diffstat (limited to 'testsuite/tests/rts/cloneThreadStack.hs')
-rw-r--r--testsuite/tests/rts/cloneThreadStack.hs39
1 files changed, 19 insertions, 20 deletions
diff --git a/testsuite/tests/rts/cloneThreadStack.hs b/testsuite/tests/rts/cloneThreadStack.hs
index 11b37d3577..fa2bc66795 100644
--- a/testsuite/tests/rts/cloneThreadStack.hs
+++ b/testsuite/tests/rts/cloneThreadStack.hs
@@ -19,36 +19,35 @@ foreign import ccall "expectStackToBeNotDirty" expectStackToBeNotDirty:: StackSn
-- snapshot is still valid afterwards (is not gc'ed while in use).
main :: IO ()
main = do
- mVarToBeBlockedOn <- newEmptyMVar
- threadId <- forkIO $ immediatelyBlocking mVarToBeBlockedOn
+ mVarToBeBlockedOn <- newEmptyMVar
+ threadId <- forkIO $ immediatelyBlocking mVarToBeBlockedOn
- waitUntilBlocked threadId
+ waitUntilBlocked threadId
- stackSnapshot <- cloneThreadStack threadId
+ stackSnapshot <- cloneThreadStack threadId
- performMajorGC
+ performMajorGC
- let (StackSnapshot stack) = stackSnapshot
- let (ThreadId tid#) = threadId
- expectStacksToBeEqual stack tid#
- expectStackToBeNotDirty stack
+ let (StackSnapshot stack) = stackSnapshot
+ let (ThreadId tid#) = threadId
+ expectStacksToBeEqual stack tid#
+ expectStackToBeNotDirty stack
immediatelyBlocking :: MVar Int -> IO ()
immediatelyBlocking mVarToBeBlockedOn = do
- takeMVar mVarToBeBlockedOn
- return ()
+ takeMVar mVarToBeBlockedOn
+ return ()
waitUntilBlocked :: ThreadId -> IO ()
waitUntilBlocked tid = do
- blocked <- isBlocked tid
- if blocked then
- return ()
- else
- do
- threadDelay 100000
- waitUntilBlocked tid
-
-isBlocked:: ThreadId -> IO Bool
+ blocked <- isBlocked tid
+ if blocked
+ then return ()
+ else do
+ threadDelay 100000
+ waitUntilBlocked tid
+
+isBlocked :: ThreadId -> IO Bool
isBlocked = fmap isThreadStatusBlocked . threadStatus
isThreadStatusBlocked :: ThreadStatus -> Bool