mirror of
				https://github.com/go-delve/delve.git
				synced 2025-10-30 18:27:37 +08:00 
			
		
		
		
	proc: Improvements to Variable printing (#444)
* service/api: Removed unused fields of service/api.Function * proc/eval: Set return variable name to input expression * all: fine-grained control of loadValue for better variable printing Makes proc.(*Variable).loadValue loading parameters configurable through one extra argument of type LoadConfig. This interface is also exposed through the API so clients can control how much of a variable delve should read.
This commit is contained in:
		 Alessandro Arzilli
					Alessandro Arzilli
				
			
				
					committed by
					
						 Derek Parker
						Derek Parker
					
				
			
			
				
	
			
			
			 Derek Parker
						Derek Parker
					
				
			
						parent
						
							60946a759c
						
					
				
				
					commit
					473b66387c
				
			| @ -357,3 +357,44 @@ func TestNoVars(t *testing.T) { | ||||
| 		term.AssertExec("vars filterThatMatchesNothing", "(no vars)\n") | ||||
| 	}) | ||||
| } | ||||
|  | ||||
| func TestOnPrefixLocals(t *testing.T) { | ||||
| 	const prefix = "\ti: " | ||||
| 	withTestTerminal("goroutinestackprog", t, func(term *FakeTerminal) { | ||||
| 		term.MustExec("b agobp main.agoroutine") | ||||
| 		term.MustExec("on agobp args -v") | ||||
|  | ||||
| 		seen := make([]bool, 10) | ||||
|  | ||||
| 		for { | ||||
| 			outstr, err := term.Exec("continue") | ||||
| 			if err != nil { | ||||
| 				if strings.Index(err.Error(), "exited") < 0 { | ||||
| 					t.Fatalf("Unexpected error executing 'continue': %v", err) | ||||
| 				} | ||||
| 				break | ||||
| 			} | ||||
| 			out := strings.Split(outstr, "\n") | ||||
|  | ||||
| 			for i := range out { | ||||
| 				if !strings.HasPrefix(out[i], "\ti: ") { | ||||
| 					continue | ||||
| 				} | ||||
| 				id, err := strconv.Atoi(out[i][len(prefix):]) | ||||
| 				if err != nil { | ||||
| 					continue | ||||
| 				} | ||||
| 				if seen[id] { | ||||
| 					t.Fatalf("Goroutine %d seen twice\n", id) | ||||
| 				} | ||||
| 				seen[id] = true | ||||
| 			} | ||||
| 		} | ||||
|  | ||||
| 		for i := range seen { | ||||
| 			if !seen[i] { | ||||
| 				t.Fatalf("Goroutine %d not seen\n", i) | ||||
| 			} | ||||
| 		} | ||||
| 	}) | ||||
| } | ||||
|  | ||||
		Reference in New Issue
	
	Block a user