Use symbol table for function lookup in evaluation

This commit is contained in:
Derek Parker 2015-05-03 14:11:17 -05:00
parent 064462e5b5
commit 471615fb0b

@ -945,19 +945,12 @@ func (thread *ThreadContext) readFunctionPtr(addr uintptr) (string, error) {
} }
funcAddr := binary.LittleEndian.Uint64(val) funcAddr := binary.LittleEndian.Uint64(val)
reader := thread.Process.DwarfReader() fn := thread.Process.goSymTable.PCToFunc(uint64(funcAddr))
if fn == nil {
entry, err := reader.SeekToFunction(funcAddr) return "", fmt.Errorf("could not find function for %#v", funcAddr)
if err != nil {
return "", err
} }
n, ok := entry.Val(dwarf.AttrName).(string) return fn.Name, nil
if !ok {
return "", errors.New("Unable to retrieve function name")
}
return n, nil
} }
func (thread *ThreadContext) readMemory(addr uintptr, size int) ([]byte, error) { func (thread *ThreadContext) readMemory(addr uintptr, size int) ([]byte, error) {