From 0d9b1ed29bdcfeedf631cb3f0c2fcdc605429683 Mon Sep 17 00:00:00 2001 From: Derek Parker Date: Tue, 24 Mar 2015 08:31:56 -0500 Subject: [PATCH] Minor function refactor --- proctl/proctl.go | 60 ++++++++++++++++++++++++------------------------ 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/proctl/proctl.go b/proctl/proctl.go index 03e7a3f9..76fe3ac9 100644 --- a/proctl/proctl.go +++ b/proctl/proctl.go @@ -121,37 +121,37 @@ func (dbp *DebuggedProcess) FindLocation(str string) (uint64, error) { return 0, err } return pc, nil - } else { - // Try to lookup by function name - fn := dbp.GoSymTable.LookupFunc(str) - if fn != nil { - return fn.Entry, nil - } - - // Attempt to parse as number for breakpoint id or raw address - id, err := strconv.ParseUint(str, 0, 64) - if err != nil { - return 0, fmt.Errorf("unable to find location for %s", str) - } - - // Use as breakpoint id - for _, bp := range dbp.HWBreakPoints { - if bp == nil { - continue - } - if uint64(bp.ID) == id { - return bp.Addr, nil - } - } - for _, bp := range dbp.BreakPoints { - if uint64(bp.ID) == id { - return bp.Addr, nil - } - } - - // Last resort, use as raw address - return id, nil } + + // Try to lookup by function name + fn := dbp.GoSymTable.LookupFunc(str) + if fn != nil { + return fn.Entry, nil + } + + // Attempt to parse as number for breakpoint id or raw address + id, err := strconv.ParseUint(str, 0, 64) + if err != nil { + return 0, fmt.Errorf("unable to find location for %s", str) + } + + // Use as breakpoint id + for _, bp := range dbp.HWBreakPoints { + if bp == nil { + continue + } + if uint64(bp.ID) == id { + return bp.Addr, nil + } + } + for _, bp := range dbp.BreakPoints { + if uint64(bp.ID) == id { + return bp.Addr, nil + } + } + + // Last resort, use as raw address + return id, nil } // Sends out a request that the debugged process halt