dbp.Running determined by any thread running
This commit is contained in:
parent
db278d0453
commit
9d1711d376
11
proc/proc.go
11
proc/proc.go
@ -51,7 +51,6 @@ type Process struct {
|
||||
ast *source.Searcher
|
||||
breakpointIDCounter int
|
||||
tempBreakpointIDCounter int
|
||||
running bool
|
||||
halt bool
|
||||
exited bool
|
||||
ptraceChan chan func()
|
||||
@ -130,7 +129,12 @@ func (dbp *Process) Exited() bool {
|
||||
// Returns whether or not Delve thinks the debugged
|
||||
// process is currently executing.
|
||||
func (dbp *Process) Running() bool {
|
||||
return dbp.running
|
||||
for _, th := range dbp.Threads {
|
||||
if th.running {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// Finds the executable and then uses it
|
||||
@ -212,7 +216,6 @@ func (dbp *Process) RequestManualStop() error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
dbp.running = false
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -643,12 +646,10 @@ func (dbp *Process) run(fn func() error) error {
|
||||
if dbp.exited {
|
||||
return fmt.Errorf("process has already exited")
|
||||
}
|
||||
dbp.running = true
|
||||
dbp.halt = false
|
||||
for _, th := range dbp.Threads {
|
||||
th.CurrentBreakpoint = nil
|
||||
}
|
||||
defer func() { dbp.running = false }()
|
||||
if err := fn(); err != nil {
|
||||
if _, ok := err.(ManualStopError); !ok {
|
||||
return err
|
||||
|
@ -7,6 +7,7 @@ import (
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
protest "github.com/derekparker/delve/proc/test"
|
||||
)
|
||||
@ -110,6 +111,7 @@ func TestHalt(t *testing.T) {
|
||||
go func() {
|
||||
for {
|
||||
if p.Running() {
|
||||
time.Sleep(time.Millisecond)
|
||||
if err := p.RequestManualStop(); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
@ -64,8 +64,8 @@ func (thread *Thread) Continue() error {
|
||||
// execute the instruction, and then replace the breakpoint.
|
||||
// Otherwise we simply execute the next instruction.
|
||||
func (thread *Thread) Step() (err error) {
|
||||
thread.singleStepping = true
|
||||
thread.running = true
|
||||
thread.singleStepping = true
|
||||
defer func() {
|
||||
thread.singleStepping = false
|
||||
thread.running = false
|
||||
|
@ -35,8 +35,6 @@ func (t *Thread) resume() (err error) {
|
||||
}
|
||||
|
||||
func (t *Thread) singleStep() (err error) {
|
||||
t.running = true
|
||||
defer func() { t.running = false }()
|
||||
t.dbp.execPtraceFunc(func() { err = sys.PtraceSingleStep(t.Id) })
|
||||
if err != nil {
|
||||
return err
|
||||
|
Loading…
Reference in New Issue
Block a user