Instead of panicing for sending on a closed channel, detect that the
process has exited and return a proper error message.
This patch also cleans up some spots where the Pid is omitted from the
error.
Fixes#920
* proc/native: make sure debugged executable can be deleted on windows
Delve opens debugged executable to read binary info it
contains, but it never closes the file. Windows will not
let you delete file that is opened. So close Process.bi
in Process.postExit, and actually call Process.postExit
from windows Process.Kill.
Also Windows sends some debugging events
(EXIT_PROCESS_DEBUG_EVENT event in particular) after Delve
calls TerminateProcess. The events need to be consumed by
debugger before debugged process will be released by
Windows. So call Process.waitForDebugEvent after
TerminateProcess in Process.Kill.
Fixes#398
* cmd/dlv: make TestIssue398 pass on darwin
* cmd/dlv: add comment for TestIssue398
* proc/native: wait for debuggee to exit before returning from windows Process.Kill
* proc/native: close process handle before returning from windows killProcess
* proc/native: remove not used Process.Process
When stepping through runtime sometimes the current goroutine will
change. It is impossible to handle this in Next, Step and StepOut but
StepInstruction can reset the current goroutine correctly.
* proc: fix interaction of RequestManualStop and conditional breakpoints
A conditional breakpoint that is hit but has the condition evaluate to
false can block a RequestManualStop from working. If the conditional
breakpoint is set on an instruction that is executed very frequently by
multiple goroutines (or many conditional breakpoints are set) it could
prevent all calls to RequestManualStop from working.
This commit fixes the problem by changing proc.Continue to exit
unconditionally after a RequestManualStop is called.
* proc/gdbserial: fix ContinueOnce getting stuck on macOS
Fixes#902
When a Go program is externally linked, the external linker is
responsible for picking the TLS offset. It records its decision in the
runtime.tlsg symbol. Read the offset from that rather than guessing -16.
This implementation causes a regression: 1.4 and earlier will no longer
work.
Implementing proc.Process.Running in a thread safe way is complicated
and nothing actually uses it besides tests, so we are better off
rewriting the tests without Running and removing it.
In particular:
* The call to d.target.Running() in service/debugger/debugger.go
(Restart) can never return true because that line executes while
holding processMutex and all continue operations are also executed
while holding processMutex.
* The call to dbp.Running() pkg/proc/native/proc.go (Detach) can never
return true, because it's only called from
debugger.(*Debugger).detach() which is also always called while
holding processMutex.
Since some tests are hard to write correctly without Process.Running a
simpler interface, Process.NotifyResumed, is introduced.
Fixes#830
RequestManualStop will run concurrently with trapWait, since one writes
dbp.halt and the other reads it dbp.halt should be protected by a
mutex.
Updates #830
While implementing the gdbserial backend everything was changed to call
Detach to "close" a process so that gdbserial could do its clean up in
a single place. However the native implementation of Detach does not
actually kill processes we launched.
Fixes#821
- moved target.Interface into proc as proc.Process
- rename proc.IThread to proc.Thread
- replaced interfaces DisassembleInfo, Continuable and
EvalScopeConvertible with Process.
- removed superfluous Gdbserver prefix from types in the gdbserial
backend.
- removed superfluous Core prefix from types in the core backend.