Skip to content
  • Ben Gamari's avatar
    StgStartup: Setup unwinding for stg_stop_thread · d9f88628
    Ben Gamari authored
    This is a bit ugly as we need to assume the structure of the C stack as
    left by StgRun. Nevertheless, it allows us to unwind all the way back to
    `_start` on my machine.
    
    ```
    Stack trace:
        set_initial_registers (rts/Libdw.c:272.0)
        dwfl_thread_getframes
    
        dwfl_getthreads
        dwfl_getthread_frames
        libdw_get_backtrace (rts/Libdw.c:243.0)
        base_GHCziExecutionStack_getStackTrace1_info
    (libraries/base/GHC/ExecutionStack.hs:43.1)
        base_GHCziExecutionStack_showStackTrace1_info
    (libraries/base/GHC/ExecutionStack.hs:47.1)
        base_GHCziBase_bindIO1_info (libraries/base/GHC/Base.hs:1085.1)
        base_GHCziBase_thenIO1_info (libraries/base/GHC/Base.hs:1088.1)
        base_GHCziBase_thenIO1_info (libraries/base/GHC/Base.hs:1088.1)
        base_GHCziBase_thenIO1_info (libraries/base/GHC/Base.hs:1088.1)
        base_GHCziBase_thenIO1_info (libraries/base/GHC/Base.hs:1088.1)
        base_GHCziBase_thenIO1_info (libraries/base/GHC/Base.hs:1088.1)
        stg_catch_frame_info (rts/Exception.cmm:370.1)
        stg_stop_thread_info (rts/StgStartup.cmm:42.1)
        scheduleWaitThread (rts/Schedule.c:465.0)
        hs_main (rts/RtsMain.c:65.0)
    
        __libc_start_main (/tmp/buildd/glibc-2.19/csu/libc-start.c:321.0)
        _start
    ```
    d9f88628