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

@ -336,22 +336,22 @@ func (dbp *Process) parseDebugLineInfo(exe *macho.File, wg *sync.WaitGroup) {
var UnsupportedArchErr = errors.New("unsupported architecture - only darwin/amd64 is supported")
func (dbp *Process) findExecutable(path string) (*macho.File, error) {
func (dbp *Process) findExecutable(path string) (*macho.File, string, error) {
if path == "" {
path = C.GoString(C.find_executable(C.int(dbp.Pid)))
}
exe, err := macho.Open(path)
if err != nil {
return nil, err
return nil, path, err
}
if exe.Cpu != macho.CpuAmd64 {
return nil, UnsupportedArchErr
return nil, path, UnsupportedArchErr
}
dbp.dwarf, err = exe.DWARF()
if err != nil {
return nil, err
return nil, path, err
}
return exe, nil
return exe, path, nil
}
func (dbp *Process) trapWait(pid int) (*Thread, error) {