mirror of
https://github.com/go-delve/delve.git
synced 2025-10-27 20:23:41 +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
|
||||
ptraceChan chan func()
|
||||
ptraceDoneChan chan interface{}
|
||||
comm string
|
||||
}
|
||||
|
||||
func New(pid int) *Process {
|
||||
|
||||
@ -29,8 +29,9 @@ const (
|
||||
STATUS_ZOMBIE = 'Z'
|
||||
)
|
||||
|
||||
// Not actually needed for Linux.
|
||||
type OSProcessDetails interface{}
|
||||
type OSProcessDetails struct {
|
||||
comm string
|
||||
}
|
||||
|
||||
// Create and begin debugging a new process. First entry in
|
||||
// `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
|
||||
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 {
|
||||
@ -369,7 +370,7 @@ func (dbp *Process) wait(pid, options int) (int, *sys.WaitStatus, error) {
|
||||
if wpid != 0 {
|
||||
return wpid, &s, err
|
||||
}
|
||||
if status(pid, dbp.comm) == STATUS_ZOMBIE {
|
||||
if status(pid, dbp.os.comm) == STATUS_ZOMBIE {
|
||||
return pid, nil, nil
|
||||
}
|
||||
time.Sleep(200 * time.Millisecond)
|
||||
|
||||
@ -27,7 +27,7 @@ func (t *Thread) halt() (err error) {
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user