Two bugfixes regarding stale executable files, and executables changing between restarts (#689)

* service/debugger: Restore breakpoints using file:line on restart

Restoring by address can cause the breakpoint to be inserted in the
middle of an instruction if the executable file has changed.

* terminal: Warn of stale executable when printing source
This commit is contained in:
Alessandro Arzilli
2016-12-22 17:53:34 +01:00
committed by Derek Parker
parent 8f0646e426
commit f4aaffbbf3
12 changed files with 100 additions and 34 deletions

View File

@ -3,6 +3,7 @@ package rpc2
import (
"errors"
"fmt"
"time"
"github.com/derekparker/delve/service"
"github.com/derekparker/delve/service/api"
@ -33,6 +34,18 @@ func (s *RPCServer) ProcessPid(arg ProcessPidIn, out *ProcessPidOut) error {
return nil
}
type LastModifiedIn struct {
}
type LastModifiedOut struct {
Time time.Time
}
func (s *RPCServer) LastModified(arg LastModifiedIn, out *LastModifiedOut) error {
out.Time = s.debugger.LastModified()
return nil
}
type DetachIn struct {
Kill bool
}
@ -49,6 +62,7 @@ type RestartIn struct {
}
type RestartOut struct {
DiscardedBreakpoints []api.DiscardedBreakpoint
}
// Restart restarts program.
@ -56,7 +70,9 @@ func (s *RPCServer) Restart(arg RestartIn, out *RestartOut) error {
if s.config.AttachPid != 0 {
return errors.New("cannot restart process Delve did not create")
}
return s.debugger.Restart()
var err error
out.DiscardedBreakpoints, err = s.debugger.Restart()
return err
}
type StateIn struct {