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