mirror of
				https://github.com/go-delve/delve.git
				synced 2025-10-31 18:57:18 +08:00 
			
		
		
		
	service: fix typos in comments, logs, tests, and vars (#3378)
This commit is contained in:
		| @ -449,7 +449,7 @@ func PrettyExamineMemory(address uintptr, memArea []byte, isLittleEndian bool, f | |||||||
| 		cols = 8 | 		cols = 8 | ||||||
| 		colFormat = fmt.Sprintf("0x%%0%dx", colBytes*2) // Always keep one leading '0x' for hex. | 		colFormat = fmt.Sprintf("0x%%0%dx", colBytes*2) // Always keep one leading '0x' for hex. | ||||||
| 	default: | 	default: | ||||||
| 		return fmt.Sprintf("not supprted format %q\n", string(format)) | 		return fmt.Sprintf("not supported format %q\n", string(format)) | ||||||
| 	} | 	} | ||||||
| 	colFormat += "\t" | 	colFormat += "\t" | ||||||
|  |  | ||||||
|  | |||||||
| @ -407,7 +407,7 @@ type DebuggerCommand struct { | |||||||
| 	// UnsafeCall disables parameter escape checking for function calls. | 	// UnsafeCall disables parameter escape checking for function calls. | ||||||
| 	// Go objects can be allocated on the stack or on the heap. Heap objects | 	// Go objects can be allocated on the stack or on the heap. Heap objects | ||||||
| 	// can be used by any goroutine; stack objects can only be used by the | 	// can be used by any goroutine; stack objects can only be used by the | ||||||
| 	// goroutine that owns the stack they are allocated on and can not surivive | 	// goroutine that owns the stack they are allocated on and can not survive | ||||||
| 	// the stack frame of allocation. | 	// the stack frame of allocation. | ||||||
| 	// The Go compiler will use escape analysis to determine whether to | 	// The Go compiler will use escape analysis to determine whether to | ||||||
| 	// allocate an object on the stack or the heap. | 	// allocate an object on the stack or the heap. | ||||||
|  | |||||||
| @ -556,14 +556,14 @@ func (c *Client) ReadMemoryRequest() { | |||||||
| } | } | ||||||
|  |  | ||||||
| // DisassembleRequest sends a 'disassemble' request. | // DisassembleRequest sends a 'disassemble' request. | ||||||
| func (c *Client) DisassembleRequest(memoryReference string, instructionOffset, inctructionCount int) { | func (c *Client) DisassembleRequest(memoryReference string, instructionOffset, instructionCount int) { | ||||||
| 	c.send(&dap.DisassembleRequest{ | 	c.send(&dap.DisassembleRequest{ | ||||||
| 		Request: *c.newRequest("disassemble"), | 		Request: *c.newRequest("disassemble"), | ||||||
| 		Arguments: dap.DisassembleArguments{ | 		Arguments: dap.DisassembleArguments{ | ||||||
| 			MemoryReference:   memoryReference, | 			MemoryReference:   memoryReference, | ||||||
| 			Offset:            0, | 			Offset:            0, | ||||||
| 			InstructionOffset: instructionOffset, | 			InstructionOffset: instructionOffset, | ||||||
| 			InstructionCount:  inctructionCount, | 			InstructionCount:  instructionCount, | ||||||
| 			ResolveSymbols:    false, | 			ResolveSymbols:    false, | ||||||
| 		}, | 		}, | ||||||
| 	}) | 	}) | ||||||
|  | |||||||
| @ -71,7 +71,7 @@ import ( | |||||||
| // a dummy/error response to avoid blocking. | // a dummy/error response to avoid blocking. | ||||||
| // | // | ||||||
| // This is the only goroutine that sends a stop-server signal | // This is the only goroutine that sends a stop-server signal | ||||||
| // via config.DisconnecChan when encountering a client connection | // via config.DisconnectChan when encountering a client connection | ||||||
| // error or responding to a (synchronous) DAP disconnect request. | // error or responding to a (synchronous) DAP disconnect request. | ||||||
| // Once stop is triggered, the goroutine exits. | // Once stop is triggered, the goroutine exits. | ||||||
| // | // | ||||||
| @ -124,7 +124,7 @@ type Session struct { | |||||||
| 	// exceptionErr tracks the runtime error that last occurred. | 	// exceptionErr tracks the runtime error that last occurred. | ||||||
| 	exceptionErr error | 	exceptionErr error | ||||||
| 	// clientCapabilities tracks special settings for handling debug session requests. | 	// clientCapabilities tracks special settings for handling debug session requests. | ||||||
| 	clientCapabilities dapClientCapabilites | 	clientCapabilities dapClientCapabilities | ||||||
|  |  | ||||||
| 	// mu synchronizes access to objects set on start-up (from run goroutine) | 	// mu synchronizes access to objects set on start-up (from run goroutine) | ||||||
| 	// and stopped on teardown (from main goroutine) | 	// and stopped on teardown (from main goroutine) | ||||||
| @ -236,9 +236,9 @@ var defaultArgs = launchAttachArgs{ | |||||||
| 	substitutePathServerToClient: [][2]string{}, | 	substitutePathServerToClient: [][2]string{}, | ||||||
| } | } | ||||||
|  |  | ||||||
| // dapClientCapabilites captures arguments from initialize request that | // dapClientCapabilities captures arguments from initialize request that | ||||||
| // impact handling of subsequent requests. | // impact handling of subsequent requests. | ||||||
| type dapClientCapabilites struct { | type dapClientCapabilities struct { | ||||||
| 	supportsVariableType         bool | 	supportsVariableType         bool | ||||||
| 	supportsVariablePaging       bool | 	supportsVariablePaging       bool | ||||||
| 	supportsRunInTerminalRequest bool | 	supportsRunInTerminalRequest bool | ||||||
| @ -1072,7 +1072,7 @@ func (s *Session) getPackageDir(pkg string) string { | |||||||
| 	cmd := exec.Command("go", "list", "-f", "{{.Dir}}", pkg) | 	cmd := exec.Command("go", "list", "-f", "{{.Dir}}", pkg) | ||||||
| 	out, err := cmd.Output() | 	out, err := cmd.Output() | ||||||
| 	if err != nil { | 	if err != nil { | ||||||
| 		s.config.log.Debugf("failed to determin package directory for %v: %v\n%s", pkg, err, out) | 		s.config.log.Debugf("failed to determine package directory for %v: %v\n%s", pkg, err, out) | ||||||
| 		return "." | 		return "." | ||||||
| 	} | 	} | ||||||
| 	return string(bytes.TrimSpace(out)) | 	return string(bytes.TrimSpace(out)) | ||||||
| @ -2594,7 +2594,7 @@ func (s *Session) convertVariableWithOpts(v *proc.Variable, qualifiedNameOrExpr | |||||||
| 	return value, variablesReference | 	return value, variablesReference | ||||||
| } | } | ||||||
|  |  | ||||||
| // onEvaluateRequest handles 'evalute' requests. | // onEvaluateRequest handles 'evaluate' requests. | ||||||
| // This is a mandatory request to support. | // This is a mandatory request to support. | ||||||
| // Support the following expressions: | // Support the following expressions: | ||||||
| // | // | ||||||
| @ -3127,7 +3127,7 @@ func alignPCs(bi *proc.BinaryInfo, start, end uint64) (uint64, uint64) { | |||||||
| 	// Handle start values: | 	// Handle start values: | ||||||
| 	fn := bi.PCToFunc(start) | 	fn := bi.PCToFunc(start) | ||||||
| 	if fn != nil { | 	if fn != nil { | ||||||
| 		// start is in a funcition. | 		// start is in a function. | ||||||
| 		start = fn.Entry | 		start = fn.Entry | ||||||
| 	} else if b, pc := checkOutOfAddressSpace(start, bi); b { | 	} else if b, pc := checkOutOfAddressSpace(start, bi); b { | ||||||
| 		start = pc | 		start = pc | ||||||
| @ -3142,7 +3142,7 @@ func alignPCs(bi *proc.BinaryInfo, start, end uint64) (uint64, uint64) { | |||||||
|  |  | ||||||
| 	// Handle end values: | 	// Handle end values: | ||||||
| 	if fn := bi.PCToFunc(end); fn != nil { | 	if fn := bi.PCToFunc(end); fn != nil { | ||||||
| 		// end is in a funcition. | 		// end is in a function. | ||||||
| 		end = fn.End | 		end = fn.End | ||||||
| 	} else if b, pc := checkOutOfAddressSpace(end, bi); b { | 	} else if b, pc := checkOutOfAddressSpace(end, bi); b { | ||||||
| 		end = pc | 		end = pc | ||||||
|  | |||||||
| @ -284,7 +284,7 @@ func TestSessionStop(t *testing.T) { | |||||||
| 			defer client.Close() | 			defer client.Close() | ||||||
| 			<-acceptDone | 			<-acceptDone | ||||||
| 			if err != nil { | 			if err != nil { | ||||||
| 				t.Fatalf("cannot accept client requireed for testing: %v", err) | 				t.Fatalf("cannot accept client required for testing: %v", err) | ||||||
| 			} | 			} | ||||||
| 			session := NewSession(conn, &Config{ | 			session := NewSession(conn, &Config{ | ||||||
| 				Config:        &service.Config{DisconnectChan: make(chan struct{})}, | 				Config:        &service.Config{DisconnectChan: make(chan struct{})}, | ||||||
| @ -962,7 +962,7 @@ func checkStackFramesNamed(testName string, t *testing.T, got *dap.StackTraceRes | |||||||
|  |  | ||||||
| // checkScope is a helper for verifying the values within a ScopesResponse. | // checkScope is a helper for verifying the values within a ScopesResponse. | ||||||
| // | // | ||||||
| //	i - index of the scope within ScopesRespose.Body.Scopes array | //	i - index of the scope within ScopesResponse.Body.Scopes array | ||||||
| //	name - name of the scope | //	name - name of the scope | ||||||
| //	varRef - reference to retrieve variables of this scope. If varRef is negative, the reference is not checked. | //	varRef - reference to retrieve variables of this scope. If varRef is negative, the reference is not checked. | ||||||
| func checkScope(t *testing.T, got *dap.ScopesResponse, i int, name string, varRef int) { | func checkScope(t *testing.T, got *dap.ScopesResponse, i int, name string, varRef int) { | ||||||
| @ -1668,7 +1668,7 @@ func TestScopesAndVariablesRequests2(t *testing.T) { | |||||||
| 					client.ScopesRequest(1000) | 					client.ScopesRequest(1000) | ||||||
| 					scopes := client.ExpectScopesResponse(t) | 					scopes := client.ExpectScopesResponse(t) | ||||||
| 					if len(scopes.Body.Scopes) > 1 { | 					if len(scopes.Body.Scopes) > 1 { | ||||||
| 						t.Errorf("\ngot  %#v\nwant len(scopes)=1 (Argumes & Locals)", scopes) | 						t.Errorf("\ngot  %#v\nwant len(scopes)=1 (Arguments & Locals)", scopes) | ||||||
| 					} | 					} | ||||||
| 					checkScope(t, scopes, 0, "Locals", localsScope) | 					checkScope(t, scopes, 0, "Locals", localsScope) | ||||||
|  |  | ||||||
| @ -2109,7 +2109,7 @@ func TestVariablesLoading(t *testing.T) { | |||||||
| 						} | 						} | ||||||
| 					} | 					} | ||||||
|  |  | ||||||
| 					// Fully missing struct auto-loaded when hitting LoadConfig.MaxVariableRecurse (also tests evaluteName corner case) | 					// Fully missing struct auto-loaded when hitting LoadConfig.MaxVariableRecurse (also tests evaluateName corner case) | ||||||
| 					ref = checkVarRegex(t, locals, -1, "aas", "aas", `\[\]main\.a len: 1, cap: 1, \[{aas: \[\]main\.a len: 1, cap: 1, \[\(\*main\.a\)\(0x[0-9a-f]+\)\]}\]`, `\[\]main\.a`, hasChildren) | 					ref = checkVarRegex(t, locals, -1, "aas", "aas", `\[\]main\.a len: 1, cap: 1, \[{aas: \[\]main\.a len: 1, cap: 1, \[\(\*main\.a\)\(0x[0-9a-f]+\)\]}\]`, `\[\]main\.a`, hasChildren) | ||||||
| 					if ref > 0 { | 					if ref > 0 { | ||||||
| 						client.VariablesRequest(ref) | 						client.VariablesRequest(ref) | ||||||
| @ -2146,7 +2146,7 @@ func TestVariablesLoading(t *testing.T) { | |||||||
| 						checkChildren(t, tm, "tm", 1) | 						checkChildren(t, tm, "tm", 1) | ||||||
| 						ref = checkVarExact(t, tm, 0, "v", "tm.v", "[]map[string]main.astruct len: 1, cap: 1, [[...]]", "[]map[string]main.astruct", hasChildren) | 						ref = checkVarExact(t, tm, 0, "v", "tm.v", "[]map[string]main.astruct len: 1, cap: 1, [[...]]", "[]map[string]main.astruct", hasChildren) | ||||||
| 						if ref > 0 { | 						if ref > 0 { | ||||||
| 							// Auto-loading of fully missing map chidlren happens here, but they get trancated at MaxArrayValuess | 							// Auto-loading of fully missing map chidlren happens here, but they get truncated at MaxArrayValuess | ||||||
| 							client.VariablesRequest(ref) | 							client.VariablesRequest(ref) | ||||||
| 							tmV := client.ExpectVariablesResponse(t) | 							tmV := client.ExpectVariablesResponse(t) | ||||||
| 							checkChildren(t, tmV, "tm.v", 1) | 							checkChildren(t, tmV, "tm.v", 1) | ||||||
| @ -4650,7 +4650,7 @@ func testNextParkedHelper(t *testing.T, client *daptest.Client, fixture protest. | |||||||
| 			// ok | 			// ok | ||||||
| 		case *dap.TerminatedEvent: | 		case *dap.TerminatedEvent: | ||||||
| 			// This is very unlikely to happen. But in theory if all sayhi | 			// This is very unlikely to happen. But in theory if all sayhi | ||||||
| 			// gouritines are run serially, there will never be a second parked | 			// goroutines are run serially, there will never be a second parked | ||||||
| 			// sayhi goroutine when another breaks and we will keep trying | 			// sayhi goroutine when another breaks and we will keep trying | ||||||
| 			// until process termination. | 			// until process termination. | ||||||
| 			return -1 | 			return -1 | ||||||
| @ -5772,7 +5772,7 @@ func TestPauseAndContinue(t *testing.T) { | |||||||
| 	}) | 	}) | ||||||
| } | } | ||||||
|  |  | ||||||
| func TestUnupportedCommandResponses(t *testing.T) { | func TestUnsupportedCommandResponses(t *testing.T) { | ||||||
| 	var got *dap.ErrorResponse | 	var got *dap.ErrorResponse | ||||||
| 	runTest(t, "increment", func(client *daptest.Client, fixture protest.Fixture) { | 	runTest(t, "increment", func(client *daptest.Client, fixture protest.Fixture) { | ||||||
| 		seqCnt := 1 | 		seqCnt := 1 | ||||||
|  | |||||||
| @ -253,7 +253,7 @@ type CreateBreakpointOut struct { | |||||||
| } | } | ||||||
|  |  | ||||||
| // CreateBreakpoint creates a new breakpoint. The client is expected to populate `CreateBreakpointIn` | // CreateBreakpoint creates a new breakpoint. The client is expected to populate `CreateBreakpointIn` | ||||||
| // with an `api.Breakpoint` struct describing where to set the breakpoing. For more information on | // with an `api.Breakpoint` struct describing where to set the breakpoint. For more information on | ||||||
| // how to properly request a breakpoint via the `api.Breakpoint` struct see the documentation for | // how to properly request a breakpoint via the `api.Breakpoint` struct see the documentation for | ||||||
| // `debugger.CreateBreakpoint` here: https://pkg.go.dev/github.com/go-delve/delve/service/debugger#Debugger.CreateBreakpoint. | // `debugger.CreateBreakpoint` here: https://pkg.go.dev/github.com/go-delve/delve/service/debugger#Debugger.CreateBreakpoint. | ||||||
| func (s *RPCServer) CreateBreakpoint(arg CreateBreakpointIn, out *CreateBreakpointOut) error { | func (s *RPCServer) CreateBreakpoint(arg CreateBreakpointIn, out *CreateBreakpointOut) error { | ||||||
|  | |||||||
| @ -611,7 +611,7 @@ func TestClientServer_toggleAmendedBreakpoint(t *testing.T) { | |||||||
| 			t.Fatal(err) | 			t.Fatal(err) | ||||||
| 		} | 		} | ||||||
| 		if amended.Cond == "" { | 		if amended.Cond == "" { | ||||||
| 			t.Fatal("breakpoint amendedments not preserved after toggle") | 			t.Fatal("breakpoint amendments not preserved after toggle") | ||||||
| 		} | 		} | ||||||
| 	}) | 	}) | ||||||
| } | } | ||||||
| @ -2188,7 +2188,7 @@ func TestAncestors(t *testing.T) { | |||||||
| 	defer os.Setenv("GODEBUG", savedGodebug) | 	defer os.Setenv("GODEBUG", savedGodebug) | ||||||
| 	withTestClient2("testnextprog", t, func(c service.Client) { | 	withTestClient2("testnextprog", t, func(c service.Client) { | ||||||
| 		_, err := c.CreateBreakpoint(&api.Breakpoint{FunctionName: "main.testgoroutine", Line: -1}) | 		_, err := c.CreateBreakpoint(&api.Breakpoint{FunctionName: "main.testgoroutine", Line: -1}) | ||||||
| 		assertNoError(err, t, "CreateBreakpoin") | 		assertNoError(err, t, "CreateBreakpoint") | ||||||
| 		state := <-c.Continue() | 		state := <-c.Continue() | ||||||
| 		assertNoError(state.Err, t, "Continue()") | 		assertNoError(state.Err, t, "Continue()") | ||||||
| 		ancestors, err := c.Ancestors(-1, 1000, 1000) | 		ancestors, err := c.Ancestors(-1, 1000, 1000) | ||||||
| @ -2259,7 +2259,7 @@ func TestRerecord(t *testing.T) { | |||||||
| 	withTestClient2("testrerecord", t, func(c service.Client) { | 	withTestClient2("testrerecord", t, func(c service.Client) { | ||||||
| 		fp := testProgPath(t, "testrerecord") | 		fp := testProgPath(t, "testrerecord") | ||||||
| 		_, err := c.CreateBreakpoint(&api.Breakpoint{File: fp, Line: 10}) | 		_, err := c.CreateBreakpoint(&api.Breakpoint{File: fp, Line: 10}) | ||||||
| 		assertNoError(err, t, "CreateBreakpoin") | 		assertNoError(err, t, "CreateBreakpoint") | ||||||
|  |  | ||||||
| 		gett := func() int { | 		gett := func() int { | ||||||
| 			state := <-c.Continue() | 			state := <-c.Continue() | ||||||
| @ -2531,7 +2531,7 @@ func TestToggleBreakpointRestart(t *testing.T) { | |||||||
| } | } | ||||||
|  |  | ||||||
| func TestStopServerWithClosedListener(t *testing.T) { | func TestStopServerWithClosedListener(t *testing.T) { | ||||||
| 	// Checks that the error erturned by listener.Accept() is ignored when we | 	// Checks that the error returned by listener.Accept() is ignored when we | ||||||
| 	// are trying to shutdown. See issue #1633. | 	// are trying to shutdown. See issue #1633. | ||||||
| 	if testBackend == "rr" || buildMode == "pie" { | 	if testBackend == "rr" || buildMode == "pie" { | ||||||
| 		t.Skip("N/A") | 		t.Skip("N/A") | ||||||
| @ -3000,7 +3000,7 @@ func TestClientServer_breakpointOnFuncWithABIWrapper(t *testing.T) { | |||||||
| 	protest.AllowRecording(t) | 	protest.AllowRecording(t) | ||||||
| 	withTestClient2("math", t, func(c service.Client) { | 	withTestClient2("math", t, func(c service.Client) { | ||||||
| 		bp, err := c.CreateBreakpoint(&api.Breakpoint{FunctionName: "runtime.schedinit"}) | 		bp, err := c.CreateBreakpoint(&api.Breakpoint{FunctionName: "runtime.schedinit"}) | ||||||
| 		assertNoError(err, t, "CreateBreakpoin()") | 		assertNoError(err, t, "CreateBreakpoint()") | ||||||
| 		t.Log(bp) | 		t.Log(bp) | ||||||
|  |  | ||||||
| 		found := false | 		found := false | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user
	 Oleksandr Redko
					Oleksandr Redko