From 3e360b035f4c3014e9564f4994c68ccc296ef629 Mon Sep 17 00:00:00 2001 From: Austin Clements Date: Tue, 14 Feb 2023 12:25:11 -0500 Subject: runtime: new API for filling PC traceback buffers Currently, filling PC traceback buffers is one of the jobs of gentraceback. This moves it into a new function, tracebackPCs, with a simple API built around unwinder, and changes all callers to use this new API. Updates #54466. Change-Id: Id2038bded81bf533a5a4e71178a7c014904d938c Reviewed-on: https://go-review.googlesource.com/c/go/+/468300 Reviewed-by: Michael Pratt TryBot-Result: Gopher Robot Run-TryBot: Austin Clements --- src/runtime/export_test.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/runtime/export_test.go') diff --git a/src/runtime/export_test.go b/src/runtime/export_test.go index 25758972f1..31d32eabeb 100644 --- a/src/runtime/export_test.go +++ b/src/runtime/export_test.go @@ -483,7 +483,9 @@ func LockOSCounts() (external, internal uint32) { func TracebackSystemstack(stk []uintptr, i int) int { if i == 0 { pc, sp := getcallerpc(), getcallersp() - return gentraceback(pc, sp, 0, getg(), 0, &stk[0], len(stk), nil, nil, _TraceJumpStack) + var u unwinder + u.initAt(pc, sp, 0, getg(), unwindJumpStack) // Don't ignore errors, for testing + return tracebackPCs(&u, 0, stk) } n := 0 systemstack(func() { -- cgit v1.3-5-g9baa