I'm trying to build an unoptimized version of the standard library for debugging.
I tried using GO_GCFLAGS='-N -l' but dlv is telling me the code is optimized.
This is what I did (Notice the "Warning debugging optimized function" coming from delve)
/Volumes/git/goroot/src (master)$ git log --oneline -1
ba6df85c7c (HEAD -> master, origin/master, origin/HEAD) cmd/compile: add MOVBEWstore support for GOAMD64>=3
/Volumes/git/goroot/src (master)$ time GO_GCFLAGS='-N -l' ./make.bash
Building Go cmd/dist using /Users/billmorgan/sdk/go1.18. (go1.18 darwin/amd64)
Building Go toolchain1 using /Users/billmorgan/sdk/go1.18.
Building Go bootstrap cmd/go (go_bootstrap) using Go toolchain1.
Building Go toolchain2 using go_bootstrap and Go toolchain1.
Building Go toolchain3 using go_bootstrap and Go toolchain2.
Building packages and commands for darwin/amd64.
---
Installed Go for darwin/amd64 in /Volumes/git/goroot
Installed commands in /Volumes/git/goroot/bin
real 2m9.101s
user 5m40.243s
sys 0m36.602s
/Volumes/git/goroot/src (master)$ dlv exec ../bin/go -- help
Type 'help' for list of commands.
(dlv) b runtime.main
Breakpoint 1 set at 0x103c68a for runtime.main() ./runtime/proc.go:145
(dlv) c
> runtime.main() ./runtime/proc.go:145 (hits goroutine(1):1 total:1) (PC: 0x103c68a)
Warning: debugging optimized function
140:
141: // Value to use for signal mask for newly created M's.
142: var initSigmask sigset
143:
144: // The main goroutine.
=> 145: func main() {
146: g := getg()
147:
148: // Racectx of m0->g0 is used only as the parent of the main goroutine.
149: // It must not be used for anything else.
150: g.m.g0.racectx = 0
(dlv) q