diff options
author | Bartosz Nitka <niteria@gmail.com> | 2018-05-03 10:43:38 -0700 |
---|---|---|
committer | Bartosz Nitka <niteria@gmail.com> | 2018-05-11 04:02:03 -0700 |
commit | cb5c2fe875965b7aedbc189012803fc62e48fb3f (patch) | |
tree | bc5d65def3de1b2a08b569f9661a0db602a719ac /rts/StgStartup.cmm | |
parent | 40a76c99624ae82e960bad0f1c832ddec4aece16 (diff) | |
download | haskell-cb5c2fe875965b7aedbc189012803fc62e48fb3f.tar.gz |
Fix unwinding of C -> Haskell FFI calls with -threaded
See the new note.
Test Plan:
manual testing with patched gdb
Reviewers: bgamari, simonmar, erikd
Subscribers: rwbarton, thomie, carter
Differential Revision: https://phabricator.haskell.org/D4666
Diffstat (limited to 'rts/StgStartup.cmm')
-rw-r--r-- | rts/StgStartup.cmm | 18 |
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); |