提交 905d3d99 编写于 作者: A aarzilli 提交者: Derek Parker

debugger: always detach in debugger

GdbserverProcess does its cleanup in Detach we need to always call
that function.
上级 1a0df69c
...@@ -163,10 +163,10 @@ func (d *Debugger) Detach(kill bool) error { ...@@ -163,10 +163,10 @@ func (d *Debugger) Detach(kill bool) error {
} }
func (d *Debugger) detach(kill bool) error { func (d *Debugger) detach(kill bool) error {
if d.config.AttachPid != 0 { if d.config.AttachPid == 0 {
return d.target.Detach(kill) kill = true
} }
return d.target.Kill() return d.target.Detach(kill)
} }
// Restart will restart the target process, first killing // Restart will restart the target process, first killing
...@@ -187,9 +187,9 @@ func (d *Debugger) Restart() ([]api.DiscardedBreakpoint, error) { ...@@ -187,9 +187,9 @@ func (d *Debugger) Restart() ([]api.DiscardedBreakpoint, error) {
if err := stopProcess(d.ProcessPid()); err != nil { if err := stopProcess(d.ProcessPid()); err != nil {
return nil, err return nil, err
} }
if err := d.detach(true); err != nil { }
return nil, err if err := d.detach(true); err != nil {
} return nil, err
} }
p, err := d.Launch(d.config.ProcessArgs, d.config.WorkingDir) p, err := d.Launch(d.config.ProcessArgs, d.config.WorkingDir)
if err != nil { if err != nil {
...@@ -215,9 +215,8 @@ func (d *Debugger) Restart() ([]api.DiscardedBreakpoint, error) { ...@@ -215,9 +215,8 @@ func (d *Debugger) Restart() ([]api.DiscardedBreakpoint, error) {
return nil, err return nil, err
} }
} }
err = d.target.Detach(true)
d.target = p d.target = p
return discarded, err return discarded, nil
} }
// State returns the current state of the debugger. // State returns the current state of the debugger.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册