-
Notifications
You must be signed in to change notification settings - Fork 54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enable debugger for tests on macOS #446
Open
evidolob
wants to merge
4
commits into
containers:main
Choose a base branch
from
evidolob:add-debugger
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
25e8298
test: move test utils files to the test-utils folder
lstocchi d87cebc
test: add basic tests for vfkit
lstocchi d09c9aa
build(deps): bump golang.org/x/crypto from 0.29.0 to 0.31.0
dependabot[bot] 793cc85
Add make target to enable debugger during test run
evidolob File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 `givisor` 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 sever with `2345` port, you could use any `delve` client to interact with debugger | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
||
##### CLI Example | ||
|
||
Connect to debugger sever 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
givisor
typo (extrai
). What do you mean by gvisor though? Is it gvproxy, or is it any program using gvisor-tap-vsock as a package?