Fix hanging issue on Linux

This commit is contained in:
Derek Parker
2015-02-28 09:05:37 -05:00
parent 27f68abebd
commit f4ec73bb62
2 changed files with 6 additions and 2 deletions

View File

@ -112,6 +112,7 @@ func (dbp *DebuggedProcess) addThread(tid int, attach bool) (*ThreadContext, err
}
func (dbp *DebuggedProcess) updateThreadList() error {
var attach bool
tids, _ := filepath.Glob(fmt.Sprintf("/proc/%d/task/*", dbp.Pid))
for _, tidpath := range tids {
tidstr := filepath.Base(tidpath)
@ -119,7 +120,10 @@ func (dbp *DebuggedProcess) updateThreadList() error {
if err != nil {
return err
}
if _, err := dbp.addThread(tid, false); err != nil {
if tid != dbp.Pid {
attach = true
}
if _, err := dbp.addThread(tid, attach); err != nil {
return err
}
}

View File

@ -44,7 +44,7 @@ func (t *ThreadContext) blocked() bool {
// TODO(dp) check err
pc, _ := t.CurrentPC()
fn := t.Process.GoSymTable.PCToFunc(pc)
if fn != nil && ((fn.Name == "runtime.futex") || (fn.Name == "runtime.usleep")) {
if fn != nil && ((fn.Name == "runtime.futex") || (fn.Name == "runtime.usleep") || (fn.Name == "runtime.clone")) {
return true
}
return false