• Austin Clements's avatar
    runtime: hide <autogenerated> methods from call stack · e9720951
    Austin Clements authored
    The compiler generates wrapper methods to forward interface method
    calls (which are always pointer-based) to value methods. These
    wrappers appear in the call stack even though they are an
    implementation detail. This leaves ugly "<autogenerated>" functions in
    stack traces and can throw off skip counts for stack traces.
    
    Fix this by considering these runtime frames in printed stack traces
    so they will only be printed if runtime frames are being printed, and
    by eliding them from the call stack expansion used by CallersFrames
    and Caller.
    
    This removes the test for issue 4388 since that was checking that
    "<autogenerated>" appeared in the stack trace instead of something
    even weirder. We replace it with various runtime package tests.
    
    Fixes #16723.
    
    Change-Id: Ice3f118c66f254bb71478a664d62ab3fc7125819
    Reviewed-on: https://go-review.googlesource.com/45412
    Run-TryBot: Austin Clements <austin@google.com>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
    e9720951
stack_test.go 12.9 KB