aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/internal
diff options
context:
space:
mode:
authorDavid Finkel <davidf@vimeo.com>2025-05-23 16:04:08 -0400
committerGopher Robot <gobot@golang.org>2025-11-24 20:07:56 -0800
commit6851795fb6cda61e2c8396c36da187a2bd87b29e (patch)
tree26c06ff565a5e5910dfce7b28f180023b8699feb /src/cmd/internal
parent0921e1db83d3e67032999b5a2f54f5ede8ba39b5 (diff)
downloadgo-6851795fb6cda61e2c8396c36da187a2bd87b29e.tar.xz
runtime: add GODEBUG=tracebacklabels=1 to include pprof labels in tracebacks
Copy LabelSet to an internal package as label.Set, and include (escaped) labels within goroutine stack dumps. Labels are added to the goroutine header as quoted key:value pairs, so the line may get long if there are a lot of labels. To handle escaping, we add a printescaped function to the runtime and hook it up to the print function in the compiler with a new runtime.quoted type that's a sibling to runtime.hex. (in fact, we leverage some of the machinery from printhex to generate escape sequences). The escaping can be improved for printable runes outside basic ASCII (particularly for languages using non-latin stripts). Additionally, invalid UTF-8 can be improved. So we can experiment with the output format make this opt-in via a a new tracebacklabels GODEBUG var. Updates #23458 Updates #76349 Change-Id: I08e78a40c55839a809236fff593ef2090c13c036 Reviewed-on: https://go-review.googlesource.com/c/go/+/694119 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Michael Pratt <mpratt@google.com> Auto-Submit: Michael Pratt <mpratt@google.com> Reviewed-by: Alan Donovan <adonovan@google.com>
Diffstat (limited to 'src/cmd/internal')
-rw-r--r--src/cmd/internal/goobj/builtinlist.go1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/cmd/internal/goobj/builtinlist.go b/src/cmd/internal/goobj/builtinlist.go
index b3320808f1..918ade191d 100644
--- a/src/cmd/internal/goobj/builtinlist.go
+++ b/src/cmd/internal/goobj/builtinlist.go
@@ -43,6 +43,7 @@ var builtins = [...]struct {
{"runtime.printcomplex128", 1},
{"runtime.printcomplex64", 1},
{"runtime.printstring", 1},
+ {"runtime.printquoted", 1},
{"runtime.printpointer", 1},
{"runtime.printuintptr", 1},
{"runtime.printiface", 1},