mirror of
				https://github.com/go-delve/delve.git
				synced 2025-10-31 10:47:27 +08:00 
			
		
		
		
	proc: bugfix: cleaning up spurious process exited errors (#599)
Fixes flakiness of TestCmdLineArgs.
This commit is contained in:
		 Alessandro Arzilli
					Alessandro Arzilli
				
			
				
					committed by
					
						 Derek Parker
						Derek Parker
					
				
			
			
				
	
			
			
			 Derek Parker
						Derek Parker
					
				
			
						parent
						
							c7f11149d7
						
					
				
				
					commit
					16f16cf86d
				
			| @ -292,6 +292,10 @@ func (dbp *Process) trapWait(pid int) (*Thread, error) { | ||||
| 			var cloned uint | ||||
| 			dbp.execPtraceFunc(func() { cloned, err = sys.PtraceGetEventMsg(wpid) }) | ||||
| 			if err != nil { | ||||
| 				if err == sys.ESRCH { | ||||
| 					// thread died while we were adding it | ||||
| 					continue | ||||
| 				} | ||||
| 				return nil, fmt.Errorf("could not get event message: %s", err) | ||||
| 			} | ||||
| 			th, err = dbp.addThread(int(cloned), false) | ||||
|  | ||||
| @ -1685,7 +1685,7 @@ func TestCmdLineArgs(t *testing.T) { | ||||
| 		} | ||||
| 		exit, exited := err.(ProcessExitedError) | ||||
| 		if !exited { | ||||
| 			t.Fatalf("Process did not exit!", err) | ||||
| 			t.Fatalf("Process did not exit: %v", err) | ||||
| 		} else { | ||||
| 			if exit.Status != 0 { | ||||
| 				t.Fatalf("process exited with invalid status", exit.Status) | ||||
|  | ||||
| @ -1,6 +1,5 @@ | ||||
| package proc | ||||
|  | ||||
| import "fmt" | ||||
| import "errors" | ||||
|  | ||||
| // Registers is an interface for a generic register type. The | ||||
| @ -21,11 +20,7 @@ var UnknownRegisterError = errors.New("unknown register") | ||||
|  | ||||
| // Registers obtains register values from the debugged process. | ||||
| func (t *Thread) Registers() (Registers, error) { | ||||
| 	regs, err := registers(t) | ||||
| 	if err != nil { | ||||
| 		return nil, fmt.Errorf("could not get registers: %s", err) | ||||
| 	} | ||||
| 	return regs, nil | ||||
| 	return registers(t) | ||||
| } | ||||
|  | ||||
| // PC returns the current PC for this thread. | ||||
|  | ||||
		Reference in New Issue
	
	Block a user