mirror of
https://github.com/go-delve/delve.git
synced 2025-10-28 04:35:19 +08:00
proc: refactor: move Process.comm to Process.os.comm
Only used under Linux, no need to have it available on Process itself.
This commit is contained in:
@ -54,7 +54,6 @@ type Process struct {
|
|||||||
exited bool
|
exited bool
|
||||||
ptraceChan chan func()
|
ptraceChan chan func()
|
||||||
ptraceDoneChan chan interface{}
|
ptraceDoneChan chan interface{}
|
||||||
comm string
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func New(pid int) *Process {
|
func New(pid int) *Process {
|
||||||
|
|||||||
@ -29,8 +29,9 @@ const (
|
|||||||
STATUS_ZOMBIE = 'Z'
|
STATUS_ZOMBIE = 'Z'
|
||||||
)
|
)
|
||||||
|
|
||||||
// Not actually needed for Linux.
|
type OSProcessDetails struct {
|
||||||
type OSProcessDetails interface{}
|
comm string
|
||||||
|
}
|
||||||
|
|
||||||
// Create and begin debugging a new process. First entry in
|
// Create and begin debugging a new process. First entry in
|
||||||
// `cmd` is the program to run, and then rest are the arguments
|
// `cmd` is the program to run, and then rest are the arguments
|
||||||
@ -321,7 +322,7 @@ func (dbp *Process) loadProcessInformation(wg *sync.WaitGroup) {
|
|||||||
}
|
}
|
||||||
// removes newline character
|
// removes newline character
|
||||||
comm = comm[:len(comm)-1]
|
comm = comm[:len(comm)-1]
|
||||||
dbp.comm = strings.Replace(string(comm), "%", "%%", -1)
|
dbp.os.comm = strings.Replace(string(comm), "%", "%%", -1)
|
||||||
}
|
}
|
||||||
|
|
||||||
func status(pid int, comm string) rune {
|
func status(pid int, comm string) rune {
|
||||||
@ -369,7 +370,7 @@ func (dbp *Process) wait(pid, options int) (int, *sys.WaitStatus, error) {
|
|||||||
if wpid != 0 {
|
if wpid != 0 {
|
||||||
return wpid, &s, err
|
return wpid, &s, err
|
||||||
}
|
}
|
||||||
if status(pid, dbp.comm) == STATUS_ZOMBIE {
|
if status(pid, dbp.os.comm) == STATUS_ZOMBIE {
|
||||||
return pid, nil, nil
|
return pid, nil, nil
|
||||||
}
|
}
|
||||||
time.Sleep(200 * time.Millisecond)
|
time.Sleep(200 * time.Millisecond)
|
||||||
|
|||||||
@ -27,7 +27,7 @@ func (t *Thread) halt() (err error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (thread *Thread) stopped() bool {
|
func (thread *Thread) stopped() bool {
|
||||||
state := status(thread.Id, thread.dbp.comm)
|
state := status(thread.Id, thread.dbp.os.comm)
|
||||||
return state == STATUS_TRACE_STOP
|
return state == STATUS_TRACE_STOP
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user