下来咱们来通过Goland IDE来debug下golang编译器
一、golang程序源码如下
package mainimport "fmt"type st struct { name string age int}type St stvar ( avg int32 = 123 tag string = "aaa" //ttt int64)const ( A = 111 B = 222)func Echo(t string, f interface{}) { fmt.Printf(t, f)}func init() {}func main() { a := [...]int{1, 2, 3} Echo("a:%+v", a)}
二、端点设置
断点设置go/src/cmd/compile/internal/gc/noder.go:246行
运行至端点后鼠标浮于xtop
变量之上,点击+号浮框展现变量内容:
开展xtop变量察看语法树数组构造如下: