mirror of
https://github.com/go-delve/delve.git
synced 2025-11-02 21:40:22 +08:00
Fix hanging issue on Linux
This commit is contained in:
@ -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
|
||||
}
|
||||
}
|
||||
|
||||
@ -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
|
||||
|
||||
Reference in New Issue
Block a user