diff options
| author | Keith Randall <keithr@alum.mit.edu> | 2019-01-05 14:31:23 -0800 |
|---|---|---|
| committer | Keith Randall <khr@golang.org> | 2019-01-08 21:54:04 +0000 |
| commit | 956879dd0bf31b26d2425c2eadbeb19b90812187 (patch) | |
| tree | 7d4bb468334d274917f03a783d7d3441e7478c1e /src/runtime/runtime2.go | |
| parent | 033b6501817aefebc6fc56b6212ff6abf14c8127 (diff) | |
| download | go-956879dd0bf31b26d2425c2eadbeb19b90812187.tar.xz | |
runtime: make FuncForPC return the innermost inlined frame
Returning the innermost frame instead of the outermost
makes code that walks the results of runtime.Caller{,s}
still work correctly in the presence of mid-stack inlining.
Fixes #29582
Change-Id: I2392e3dd5636eb8c6f58620a61cef2194fe660a7
Reviewed-on: https://go-review.googlesource.com/c/156364
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Diffstat (limited to 'src/runtime/runtime2.go')
| -rw-r--r-- | src/runtime/runtime2.go | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/runtime/runtime2.go b/src/runtime/runtime2.go index 290a7bd311..df9cbaef20 100644 --- a/src/runtime/runtime2.go +++ b/src/runtime/runtime2.go @@ -663,6 +663,17 @@ type _func struct { nfuncdata uint8 // must be last } +// Pseudo-Func that is returned for PCs that occur in inlined code. +// A *Func can be either a *_func or a *funcinl, and they are distinguished +// by the first uintptr. +type funcinl struct { + zero uintptr // set to 0 to distinguish from _func + entry uintptr // entry of the real (the "outermost") frame. + name string + file string + line int +} + // layout of Itab known to compilers // allocated in non-garbage-collected memory // Needs to be in sync with |
