Debugging Code Generation in Go
summary
Shows exactly which toolchain steps run with go build -x, keeps the temporary work directory with go build -work, and prints compiler intermediate assembly with go build -gcflags "-S". Demonstrates SSA debugging pages via GOSSAFUNC, escape and liveness diagnostics with -gcflags "-m" and -gcflags "-live", object inspection with go tool objdump and nm, benchmark/profile outputs (bench.out, memprofile, traceprofile), and that the race-enabled compile can surface surprising crashes during the demo. Small reproducible programs make all outputs readable.
AI-written summary · about
chapters (19)
- 0:00Start
- 3:19talk a little bit about the internals of the compiler
- 3:31transformations are applied directly on the ast
- 5:20build packages
- 6:53print out all the actual tooling invocations their inputs
- 8:42bring in the final artifacts to the current directory
- 8:52investigate the work in directory
- 12:56pass some arguments the underlying compiler
- 13:31pass flags to the compiler
- 18:38disabling optimizations and inlining your final binary
- 19:18disable the optimizations
- 20:45generate this binary
- 23:20supports highlighting of multiple lines
- 25:52build gc flag
- 27:22the liveness analysis
- 30:28take a look at bench dot out
- 31:51use dash rays to enable the race detector
- 33:22build gc flags
- 36:17prints out all the invocations








