Golang编译器源码分析(2)

下来咱们来经过Goland IDE来debug下golang编译器node

1、golang程序源码以下
package main

import "fmt"

type st struct {
    name string
    age  int
}
type St st
var (
    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)
}
2、端点设置

断点设置go/src/cmd/compile/internal/gc/noder.go:246行
image.png
运行至端点后鼠标浮于xtop变量之上,点击+号浮框展现变量内容:
image
展开xtop变量观察语法树数组结构以下:
image
上图展现的是xtop[0]和xtop[2]及部分xtop[8]golang

相关文章
相关标签/搜索