From 471615fb0b69c654f2f6595e911d7d55ed4efade Mon Sep 17 00:00:00 2001 From: Derek Parker Date: Sun, 3 May 2015 14:11:17 -0500 Subject: [PATCH] Use symbol table for function lookup in evaluation --- proctl/variables.go | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/proctl/variables.go b/proctl/variables.go index 6634b921..261ed6db 100644 --- a/proctl/variables.go +++ b/proctl/variables.go @@ -945,19 +945,12 @@ func (thread *ThreadContext) readFunctionPtr(addr uintptr) (string, error) { } funcAddr := binary.LittleEndian.Uint64(val) - reader := thread.Process.DwarfReader() - - entry, err := reader.SeekToFunction(funcAddr) - if err != nil { - return "", err + fn := thread.Process.goSymTable.PCToFunc(uint64(funcAddr)) + if fn == nil { + return "", fmt.Errorf("could not find function for %#v", funcAddr) } - n, ok := entry.Val(dwarf.AttrName).(string) - if !ok { - return "", errors.New("Unable to retrieve function name") - } - - return n, nil + return fn.Name, nil } func (thread *ThreadContext) readMemory(addr uintptr, size int) ([]byte, error) {