-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add make target to enable debugger during test run
Signed-off-by: Yevhen Vydolob <[email protected]>
- Loading branch information
Showing
4 changed files
with
69 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
### Debugging test | ||
|
||
#### MacOS | ||
|
||
You could debug test with [Delve](https://github.com/go-delve/delve) debugger. | ||
Run: | ||
```shell | ||
make test-mac-debug | ||
``` | ||
This command will run build `gvisor` binary with debugger enabled. | ||
|
||
>Note: By default it would use `--continue` `dlv` option to not pause `gvisor` execution on start, if debugger is not connected. | ||
> To pause `gvisor` execution until debugger is connected just remove `"--continue"` parameter from this [line](./test-vfkit/vfkit_suite_test.go#L93) | ||
And debug server with `2345` port, you could use any `delve` client to interact with debugger | ||
|
||
##### CLI Example | ||
|
||
Connect to debugger server with: | ||
```shell | ||
dlv connect :2345 | ||
``` | ||
Example of usage: | ||
```shell | ||
Type 'help' for list of commands. | ||
(dlv) break main.main | ||
Breakpoint 1 set at 0xe735776 for main.main() ./work/redhat/gvisor-tap-vsock/cmd/gvproxy/main.go:59 | ||
(dlv) continue | ||
> [Breakpoint 1] main.main() ./work/redhat/gvisor-tap-vsock/cmd/gvproxy/main.go:59 (hits goroutine(1):1 total:1) (PC: 0xe735776) | ||
54: hostIP = "192.168.127.254" | ||
55: host = "host" | ||
56: gateway = "gateway" | ||
57: ) | ||
58: | ||
=> 59: func main() { | ||
60: version := types.NewVersion("gvproxy") | ||
61: version.AddFlag() | ||
62: flag.Var(&endpoints, "listen", "control endpoint") | ||
63: flag.BoolVar(&debug, "debug", false, "Print debug info") | ||
64: flag.IntVar(&mtu, "mtu", 1500, "Set the MTU") | ||
``` | ||
More info about CLI client [here](https://github.com/go-delve/delve/blob/master/Documentation/cli/README.md) | ||
#### Editor integration | ||
For available editor integration look [there](https://github.com/go-delve/delve/blob/master/Documentation/EditorIntegration.md) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters