• A
    cmd/dlv: actually disable C compiler optimizations when building (#1647) · c9c455cc
    Alessandro Arzilli 提交于
    * proc: fix stacktraces when a SIGSEGV happens during a cgo call
    
    When a SIGSEGV happens in a cgo call (for example as a result of
    dereferencing a NULL pointer) the stack layout will look like this:
    
    (system stack) runtime.fatalthrow
    (system stack) runtime.throw
    (system stack) runtime.sigpanic
    (system stack) offending C function
    ... other C functions...
    (system stack) runtime.asmcgocall
    (goroutine stack) call inside cgo
    
    The code in switchStack would switch directly from the
    runtime.fatalthrow frame to the first frame in the goroutine stack,
    hiding important information.
    
    Disable this switch for runtime.fatalthrow and reintroduce the check
    for runtime.mstart that existed before this version of the code was
    implemented in commit 7bec20.
    
    This problem was reported in comment:
    https://github.com/go-delve/delve/issues/935#issuecomment-512182533
    
    * cmd/dlv: actually disable C compiler optimizations when building
    c9c455cc
proc_test.go 136.1 KB