ssa: debug info of global variable
This commit is contained in:
14
ssa/di.go
14
ssa/di.go
@@ -90,7 +90,7 @@ func (b diBuilder) createFile(filename string) DIFile {
|
||||
return &aDIFile{ll: b.di.CreateFile(file, dir)}
|
||||
}
|
||||
|
||||
func (f DIFile) scopeMeta(b diBuilder, cu CompilationUnit, pos token.Position) DIScopeMeta {
|
||||
func (f DIFile) scopeMeta(b diBuilder, pos token.Position) DIScopeMeta {
|
||||
return &aDIScopeMeta{b.file(pos.Filename).ll}
|
||||
}
|
||||
|
||||
@@ -633,6 +633,18 @@ func (b Builder) DIVarAuto(f Function, pos token.Position, varName string, vt Ty
|
||||
return b.Pkg.diBuilder().varAuto(f, pos, varName, t)
|
||||
}
|
||||
|
||||
func (b Builder) DIGlobal(v Expr, name string, pos token.Position) {
|
||||
gv := b.Pkg.diBuilder().createGlobalVariableExpression(
|
||||
b.Pkg.diBuilder().file(pos.Filename),
|
||||
pos,
|
||||
name,
|
||||
name,
|
||||
b.Pkg.diBuilder().diType(v.Type, pos),
|
||||
false,
|
||||
)
|
||||
v.impl.AddMetadata(0, gv.ll)
|
||||
}
|
||||
|
||||
func (b Builder) DISetCurrentDebugLocation(f Function, pos token.Position) {
|
||||
b.impl.SetCurrentDebugLocation(
|
||||
uint(pos.Line),
|
||||
|
||||
Reference in New Issue
Block a user