proc: Format & refactor
This commit is contained in:
parent
a8512ba11a
commit
56d57ee97a
@ -125,6 +125,10 @@ func newVariable(name string, addr uintptr, dwarfType dwarf.Type, thread *Thread
|
||||
}
|
||||
|
||||
func (v *Variable) toField(field *dwarf.StructField) (*Variable, error) {
|
||||
if v.Addr == 0 {
|
||||
return nil, fmt.Errorf("%s is nil", v.Name)
|
||||
}
|
||||
|
||||
name := ""
|
||||
if v.Name != "" {
|
||||
parts := strings.Split(field.Name, ".")
|
||||
@ -134,9 +138,6 @@ func (v *Variable) toField(field *dwarf.StructField) (*Variable, error) {
|
||||
name = fmt.Sprintf("%s.%s", v.Name, field.Name)
|
||||
}
|
||||
}
|
||||
if v.Addr == 0 {
|
||||
return nil, fmt.Errorf("%s is nil", v.Name)
|
||||
}
|
||||
return newVariable(name, uintptr(int64(v.Addr)+field.ByteOffset), field.Type, v.thread)
|
||||
}
|
||||
|
||||
@ -472,7 +473,7 @@ func (v *Variable) structMember(memberName string) (*Variable, error) {
|
||||
(field.Type.String() == ("struct " + field.Name)) ||
|
||||
(len(field.Name) > 1 &&
|
||||
field.Name[0] == '*' &&
|
||||
field.Type.String()[1:] == ("struct " + field.Name[1:]))
|
||||
field.Type.String()[1:] == ("struct "+field.Name[1:]))
|
||||
if !isEmbeddedStructMember {
|
||||
continue
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user