From 6aec8333eb846e911949c987b2227f5822f279f1 Mon Sep 17 00:00:00 2001 From: Derek Parker Date: Fri, 5 Sep 2014 14:38:43 -0500 Subject: [PATCH] Move things around because aesthetics --- proctl/proctl_linux_amd64.go | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/proctl/proctl_linux_amd64.go b/proctl/proctl_linux_amd64.go index 1250715a..f3ec7971 100644 --- a/proctl/proctl_linux_amd64.go +++ b/proctl/proctl_linux_amd64.go @@ -272,25 +272,24 @@ func (dbp *DebuggedProcess) Step() (err error) { } func (dbp *DebuggedProcess) NextPotentialLocations(pc uint64) ([]uint64, error) { - addrs := make([]uint64, 0, 3) + var ( + addrs = make([]uint64, 0, 3) + loc = dbp.DebugLine.NextLocAfterPC(pc) + ) + addrs = append(addrs, loc.Address) fde, err := dbp.FrameEntries.FDEForPC(pc) if err != nil { return nil, err } - loc := dbp.DebugLine.NextLocAfterPC(pc) - addrs = append(addrs, loc.Address) - - if !fde.AddressRange.Cover(loc.Address) { - // Next line is outside current frame, use return addr. + if !fde.AddressRange.Cover(loc.Address) { // Next line is outside current frame, use return addr. addr := dbp.ReturnAddressFromOffset(fde.ReturnAddressOffset(pc)) loc = dbp.DebugLine.LocationInfoForPC(addr) addrs = append(addrs, loc.Address) } - if loc.Delta < 0 { - // We are likely in a loop, set breakpoints at entry and exit. + if loc.Delta < 0 { // We are likely in a loop, set breakpoints at entry and exit. entry := dbp.DebugLine.LoopEntryLocation(loc.Line) exit := dbp.DebugLine.LoopExitLocation(loc.Address) addrs = append(addrs, entry.Address, exit.Address) -- GitLab