proc/variables: unsafe.Pointer support

This commit is contained in:
aarzilli
2015-11-05 18:27:50 +01:00
committed by Derek Parker
parent 943c12030a
commit 7a36967b5e
4 changed files with 21 additions and 3 deletions

View File

@ -130,10 +130,13 @@ func newVariable(name string, addr uintptr, dwarfType dwarf.Type, thread *Thread
switch t := v.RealType.(type) {
case *dwarf.PtrType:
structtyp, isstruct := t.Type.(*dwarf.StructType)
_, isvoid := t.Type.(*dwarf.VoidType)
if isstruct && strings.HasPrefix(structtyp.StructName, "hchan<") {
v.Kind = reflect.Chan
} else if isstruct && strings.HasPrefix(structtyp.StructName, "hash<") {
v.Kind = reflect.Map
} else if isvoid {
v.Kind = reflect.UnsafePointer
} else {
v.Kind = reflect.Ptr
}
@ -711,7 +714,7 @@ func (v *Variable) loadValueInternal(recurseLevel int) {
}
v.loaded = true
switch v.Kind {
case reflect.Ptr:
case reflect.Ptr, reflect.UnsafePointer:
v.Len = 1
v.Children = []Variable{*v.maybeDereference()}
// Don't increase the recursion level when dereferencing pointers