• Austin Clements's avatar
    runtime: don't elide wrapper functions that call panic or at TOS · 032678e0
    Austin Clements authored
    CL 45412 started hiding autogenerated wrapper functions from call
    stacks so that call stack semantics better matched language semantics.
    This is based on the theory that the wrapper function will call the
    "real" function and all the programmer knows about is the real
    function.
    
    However, this theory breaks down in two cases:
    
    1. If the wrapper is at the top of the stack, then it didn't call
       anything. This can happen, for example, if the "stack" was actually
       synthesized by the user.
    
    2. If the wrapper panics, for example by calling panicwrap or by
       dereferencing a nil pointer, then it didn't call the wrapped
       function and the user needs to see what panicked, even if we can't
       attribute it nicely.
    
    This commit modifies the traceback logic to include the wrapper
    function in both of these cases.
    
    Fixes #22231.
    
    Change-Id: I6e4339a652f73038bd8331884320f0b8edd86eb1
    Reviewed-on: https://go-review.googlesource.com/76770
    Run-TryBot: Austin Clements <austin@google.com>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    Reviewed-by: 's avatarKeith Randall <khr@golang.org>
    032678e0
extern.go 10.9 KB