]> Cypherpunks.ru repositories - gostls13.git/commit
runtime: don't elide wrapper functions that call panic or at TOS
authorAustin Clements <austin@google.com>
Thu, 9 Nov 2017 22:55:45 +0000 (17:55 -0500)
committerAustin Clements <austin@google.com>
Mon, 13 Nov 2017 21:43:44 +0000 (21:43 +0000)
commit032678e0fb0a5e0471a6555b758ca4d960249013
treeaf8918e06402fd57b5bd53249b7ef06319d66638
parente8905d2a66caf970d1f8e79d8101e6a670012447
runtime: don't elide wrapper functions that call panic or at TOS

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: Keith Randall <khr@golang.org>
src/runtime/extern.go
src/runtime/stack_test.go
src/runtime/symtab.go
src/runtime/traceback.go