diff options
author | Péter Szilágyi <peterke@gmail.com> | 2017-07-11 19:43:33 +0800 |
---|---|---|
committer | Felix Lange <fjl@users.noreply.github.com> | 2017-07-11 19:43:33 +0800 |
commit | bd01cd7183e771984fb9c008e7a7ebf0a0c3f9ba (patch) | |
tree | 757422f3f76a3a0917859ace69767451d28b475f /vendor/github.com/go-stack/stack/stack.go | |
parent | 09587706253a26dc58a81912419ed48672c6ec68 (diff) | |
download | go-tangerine-bd01cd7183e771984fb9c008e7a7ebf0a0c3f9ba.tar.gz go-tangerine-bd01cd7183e771984fb9c008e7a7ebf0a0c3f9ba.tar.zst go-tangerine-bd01cd7183e771984fb9c008e7a7ebf0a0c3f9ba.zip |
vendor: update go-stack to fix a sigpanic panic (#14790)
Diffstat (limited to 'vendor/github.com/go-stack/stack/stack.go')
-rw-r--r-- | vendor/github.com/go-stack/stack/stack.go | 31 |
1 files changed, 2 insertions, 29 deletions
diff --git a/vendor/github.com/go-stack/stack/stack.go b/vendor/github.com/go-stack/stack/stack.go index a614eeebf..8033c4013 100644 --- a/vendor/github.com/go-stack/stack/stack.go +++ b/vendor/github.com/go-stack/stack/stack.go @@ -39,7 +39,7 @@ func Caller(skip int) Call { } c.pc = pcs[1] - if runtime.FuncForPC(pcs[0]) != sigpanic { + if runtime.FuncForPC(pcs[0]).Name() != "runtime.sigpanic" { c.pc-- } c.fn = runtime.FuncForPC(c.pc) @@ -205,33 +205,6 @@ func (cs CallStack) Format(s fmt.State, verb rune) { s.Write(closeBracketBytes) } -// findSigpanic intentionally executes faulting code to generate a stack trace -// containing an entry for runtime.sigpanic. -func findSigpanic() *runtime.Func { - var fn *runtime.Func - var p *int - func() int { - defer func() { - if p := recover(); p != nil { - var pcs [512]uintptr - n := runtime.Callers(2, pcs[:]) - for _, pc := range pcs[:n] { - f := runtime.FuncForPC(pc) - if f.Name() == "runtime.sigpanic" { - fn = f - break - } - } - } - }() - // intentional nil pointer dereference to trigger sigpanic - return *p - }() - return fn -} - -var sigpanic = findSigpanic() - // Trace returns a CallStack for the current goroutine with element 0 // identifying the calling function. func Trace() CallStack { @@ -241,7 +214,7 @@ func Trace() CallStack { for i, pc := range pcs[:n] { pcFix := pc - if i > 0 && cs[i-1].fn != sigpanic { + if i > 0 && cs[i-1].fn.Name() != "runtime.sigpanic" { pcFix-- } cs[i] = Call{ |