ssa: debug info types.Named -> typedef
This commit is contained in:
@@ -117,8 +117,15 @@ def format_value(var: lldb.SBValue, debugger: lldb.SBDebugger, include_type: boo
|
||||
type_class = var_type.GetTypeClass()
|
||||
type_name = map_type_name(var_type.GetName())
|
||||
|
||||
# Handle typedef types
|
||||
original_type_name = type_name
|
||||
while var_type.IsTypedefType():
|
||||
var_type = var_type.GetTypedefedType()
|
||||
type_name = map_type_name(var_type.GetName())
|
||||
type_class = var_type.GetTypeClass()
|
||||
|
||||
if var_type.IsPointerType():
|
||||
return format_pointer(var, debugger, indent, type_name)
|
||||
return format_pointer(var, debugger, indent, original_type_name)
|
||||
|
||||
if type_name.startswith('[]'): # Slice
|
||||
return format_slice(var, debugger, indent)
|
||||
@@ -127,7 +134,7 @@ def format_value(var: lldb.SBValue, debugger: lldb.SBDebugger, include_type: boo
|
||||
elif type_name == 'string': # String
|
||||
return format_string(var)
|
||||
elif type_class in [lldb.eTypeClassStruct, lldb.eTypeClassClass]:
|
||||
return format_struct(var, debugger, include_type, indent, type_name)
|
||||
return format_struct(var, debugger, include_type, indent, original_type_name)
|
||||
else:
|
||||
value = var.GetValue()
|
||||
summary = var.GetSummary()
|
||||
|
||||
17
ssa/di.go
17
ssa/di.go
@@ -157,9 +157,8 @@ func (b diBuilder) createType(name string, ty Type, pos token.Position) DIType {
|
||||
case *types.Pointer:
|
||||
return b.createPointerType(name, b.prog.rawType(t.Elem()), pos)
|
||||
case *types.Named:
|
||||
ty = b.prog.rawType(t.Underlying())
|
||||
pos = b.positioner.Position(t.Obj().Pos())
|
||||
return b.diTypeEx(name, ty, pos)
|
||||
// Create typedef type for named types
|
||||
return b.createTypedefType(name, ty, pos)
|
||||
case *types.Interface:
|
||||
ty := b.prog.rtType("Iface")
|
||||
return b.createInterfaceType(name, ty)
|
||||
@@ -263,6 +262,18 @@ func (b diBuilder) createAutoVariable(scope DIScope, pos token.Position, name st
|
||||
}
|
||||
}
|
||||
|
||||
func (b diBuilder) createTypedefType(name string, ty Type, pos token.Position) DIType {
|
||||
underlyingType := b.diType(b.prog.rawType(ty.RawType().(*types.Named).Underlying()), pos)
|
||||
typ := b.di.CreateTypedef(llvm.DITypedef{
|
||||
Name: name,
|
||||
Type: underlyingType.ll,
|
||||
File: b.file(pos.Filename).ll,
|
||||
Line: pos.Line,
|
||||
AlignInBits: uint32(b.prog.sizes.Alignof(ty.RawType()) * 8),
|
||||
})
|
||||
return &aDIType{typ}
|
||||
}
|
||||
|
||||
func (b diBuilder) createStringType() DIType {
|
||||
ty := b.prog.rtType("String")
|
||||
return b.doCreateStructType("string", ty, token.Position{}, func(ditStruct DIType) []llvm.Metadata {
|
||||
|
||||
Reference in New Issue
Block a user