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)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user