summaryrefslogtreecommitdiff
path: root/rts/StgStartup.cmm
diff options
context:
space:
mode:
authorBartosz Nitka <niteria@gmail.com>2018-05-17 08:06:33 -0700
committerBartosz Nitka <niteria@gmail.com>2018-05-17 08:06:34 -0700
commit5d3b15ecbf17b7747c2f7313a981c60a2d22904d (patch)
tree64709fa322560091b7339614e36833a20f364f34 /rts/StgStartup.cmm
parentf27e4f624fe1270e8027ff0a14f03514f5be31b7 (diff)
downloadhaskell-5d3b15ecbf17b7747c2f7313a981c60a2d22904d.tar.gz
Fix unwinding of C -> Haskell FFI calls with -threaded (2nd try)
Summary: See the new note. This should fix cb5c2fe875965b7aedbc189012803fc62e48fb3f enough to unbreak Windows and OS X builds. Test Plan: manual testing with patched gdb Reviewers: bgamari, simonmar, erikd Reviewed By: bgamari Subscribers: rwbarton, thomie, carter Differential Revision: https://phabricator.haskell.org/D4694
Diffstat (limited to 'rts/StgStartup.cmm')
-rw-r--r--rts/StgStartup.cmm18
1 files changed, 3 insertions, 15 deletions
diff --git a/rts/StgStartup.cmm b/rts/StgStartup.cmm
index f67373031b..571e0637fc 100644
--- a/rts/StgStartup.cmm
+++ b/rts/StgStartup.cmm
@@ -62,24 +62,12 @@ INFO_TABLE_RET(stg_stop_thread, STOP_FRAME,
be an info table on top of the stack).
*/
- /*
- Here we setup the stack unwinding annotation necessary to allow
- debuggers to find their way back to the C stack.
-
- This is a bit fiddly as we assume the layout of the stack prepared
- for us by StgRun. Note that in most cases StgRun is written in assembler
- and therefore has no associated unwind information. For this reason we
- need to identify the platform stack pointer and return address values for
- the StgRun's caller.
- */
+ // See Note [Unwinding foreign exports on x86-64].
#if defined(x86_64_HOST_ARCH)
- // offset of 8 in MachSp value due to return address
- unwind MachSp = MachSp + RESERVED_C_STACK_BYTES + STG_RUN_STACK_FRAME_SIZE + 8,
- UnwindReturnReg = W_[MachSp + RESERVED_C_STACK_BYTES + STG_RUN_STACK_FRAME_SIZE];
+ unwind UnwindReturnReg = STG_RUN_JMP;
#else
// FIXME: Fill in for other platforms
- unwind MachSp = return,
- UnwindReturnReg = return;
+ unwind UnwindReturnReg = return;
#endif
Sp = Sp + SIZEOF_StgStopFrame - WDS(2);