debug: fix basic types
This commit is contained in:
44
ssa/di.go
44
ssa/di.go
@@ -597,31 +597,24 @@ func (b Builder) di() diBuilder {
|
||||
return b.Pkg.di
|
||||
}
|
||||
|
||||
func (b Builder) DIDeclare(variable *types.Var, v Expr, dv DIVar, scope DIScope, pos token.Position, blk BasicBlock) {
|
||||
dbgPtr, _, _ := b.constructDebugAddr(v)
|
||||
expr := b.di().createExpression(nil)
|
||||
b.di().dbgDeclare(dbgPtr, dv, scope, pos, expr, blk)
|
||||
// v.impl = dbgVal.impl
|
||||
func (b Builder) DIParam(variable *types.Var, v Expr, dv DIVar, scope DIScope, pos token.Position, blk BasicBlock) {
|
||||
ty := v.Type.RawType().Underlying()
|
||||
if isPtrType(ty) {
|
||||
expr := b.di().createExpression(nil)
|
||||
b.di().dbgDeclare(v, dv, scope, pos, expr, blk)
|
||||
} else {
|
||||
b.DIValue(variable, v, dv, scope, pos, blk)
|
||||
}
|
||||
}
|
||||
|
||||
const (
|
||||
opDeref = 0x06
|
||||
)
|
||||
|
||||
func isBasicTypeOrPtr(t types.Type) bool {
|
||||
switch t.(type) {
|
||||
case *types.Basic:
|
||||
return true
|
||||
case *types.Pointer:
|
||||
return true
|
||||
default:
|
||||
return false
|
||||
}
|
||||
func (b Builder) DIDeclare(variable *types.Var, v Expr, dv DIVar, scope DIScope, pos token.Position, blk BasicBlock) {
|
||||
expr := b.di().createExpression(nil)
|
||||
b.di().dbgDeclare(v, dv, scope, pos, expr, blk)
|
||||
}
|
||||
|
||||
func (b Builder) DIValue(variable *types.Var, v Expr, dv DIVar, scope DIScope, pos token.Position, blk BasicBlock) {
|
||||
ty := v.Type.RawType().Underlying()
|
||||
if isBasicTypeOrPtr(ty) {
|
||||
if isPtrType(ty) {
|
||||
expr := b.di().createExpression(nil)
|
||||
b.di().dbgValue(v, dv, scope, pos, expr, blk)
|
||||
} else {
|
||||
@@ -632,6 +625,19 @@ func (b Builder) DIValue(variable *types.Var, v Expr, dv DIVar, scope DIScope, p
|
||||
}
|
||||
}
|
||||
|
||||
const (
|
||||
opDeref = 0x06
|
||||
)
|
||||
|
||||
func isPtrType(t types.Type) bool {
|
||||
switch t.(type) {
|
||||
case *types.Pointer:
|
||||
return true
|
||||
default:
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
func (b Builder) DIVarParam(f Function, pos token.Position, varName string, vt Type, argNo int) DIVar {
|
||||
t := b.di().diType(vt, pos)
|
||||
return b.di().varParam(f, pos, varName, t, argNo)
|
||||
|
||||
Reference in New Issue
Block a user