This commit is contained in:
Li Jie
2024-09-15 15:14:56 +08:00
parent 24995f46cb
commit 9978a370f1
2 changed files with 10 additions and 9 deletions

View File

@@ -306,6 +306,7 @@ func (p *context) debugParams(b llssa.Builder, f *ssa.Function) {
argNo := i + 1 argNo := i + 1
div := b.DIVarParam(p.fn, pos, param.Name(), b.Prog.Type(ty, llssa.InGo), argNo) div := b.DIVarParam(p.fn, pos, param.Name(), b.Prog.Type(ty, llssa.InGo), argNo)
b.DIDeclare(v, div, p.fn, pos, p.fn.Block(0)) b.DIDeclare(v, div, p.fn, pos, p.fn.Block(0))
b.DIValue(v, div, p.fn, pos, p.fn.Block(0))
} }
} }

View File

@@ -11,9 +11,9 @@ import (
) )
type aDIBuilder struct { type aDIBuilder struct {
di *llvm.DIBuilder di *llvm.DIBuilder
prog Program prog Program
diTypes map[Type]DIType types map[Type]DIType
} }
type diBuilder = *aDIBuilder type diBuilder = *aDIBuilder
@@ -36,9 +36,9 @@ func newDIBuilder(prog Program, pkg Package) diBuilder {
}), }),
) )
return &aDIBuilder{ return &aDIBuilder{
di: llvm.NewDIBuilder(m), di: llvm.NewDIBuilder(m),
prog: prog, prog: prog,
diTypes: make(map[*aType]DIType), types: make(map[*aType]DIType),
} }
} }
@@ -280,7 +280,7 @@ func (b diBuilder) createStructType(ty Type, pos token.Position) (ret DIType) {
Name: ty.RawType().String(), Name: ty.RawType().String(),
}, },
)} )}
b.diTypes[ty] = ret b.types[ty] = ret
// Create struct type // Create struct type
structType := ty.RawType().(*types.Struct) structType := ty.RawType().(*types.Struct)
@@ -379,11 +379,11 @@ func (b diBuilder) dbgValue(v Expr, dv DIVar, scope DIScope, pos token.Position,
} }
func (b diBuilder) diType(t Type, pos token.Position) DIType { func (b diBuilder) diType(t Type, pos token.Position) DIType {
if ty, ok := b.diTypes[t]; ok { if ty, ok := b.types[t]; ok {
return ty return ty
} }
ty := b.createType(t, pos) ty := b.createType(t, pos)
b.diTypes[t] = ty b.types[t] = ty
return ty return ty
} }