Commit 77f5a1f
committed
Add
# `hack/codesign/debugserver`
This script wraps the LLDB `debugserver` to `codesign` the target executable.
This is needed for [Delve](https://github.com/go-delve/delve) to work properly
on macOS with the virtualization framework.
## How to use this script with Delve
### Use `DELVE_DEBUGSERVER_PATH` environment variable
Override `debugserver` by setting the `DELVE_DEBUGSERVER_PATH` environment variable.
Ref: [Environment variables - Using Delve](https://github.com/go-delve/delve/blob/master/Documentation/usage/README.md#environment-variables)
e.g. in `.vscode/launch.json`:
```jsonc
{
"version": "0.2.0",
"configurations": [
{
"name": "hostagent for input instance",
"type": "go",
"request": "launch",
"mode": "debug",
// Use integratedTerminal to stop using ctrl+C
"console": "integratedTerminal",
"program": "${workspaceFolder}/cmd/limactl",
"buildFlags": [
"-ldflags=-X github.com/lima-vm/lima/pkg/version.Version=2.0.0-alpha.0",
],
"env": {
"CGO_ENABLED": "1",
"DELVE_DEBUGSERVER_PATH": "${workspaceFolder}/hack/codesign/debugserver",
"LIMA_SSH_PORT_FORWARDER": "true",
},
"cwd": "${userHome}/.lima/${input:targetInstance}",
"args": [
"--debug",
"hostagent",
"--pidfile", "ha.pid",
"--socket", "ha.sock",
"--guestagent", "${workspaceFolder}/_output/share/lima/lima-guestagent.Linux-aarch64",
"${input:targetInstance}"
],
},
],
"inputs": [
{
"id": "targetInstance",
"type": "promptString",
"description": "Input target instance parameter for `limactl` command",
}
]
}
```
### Override `debugserver` in the PATH
You can also override the `debugserver` in the PATH environment variable.
e.g. in `.vscode/launch.json`:
```diff
"env": {
"CGO_ENABLED": "1",
- "DELVE_DEBUGSERVER_PATH": "${workspaceFolder}/hack/codesign/debugserver",
+ "PATH": "${workspaceFolder}/hack/codesign:${env:PATH}",
},
```
Signed-off-by: Norio Nomura <norio.nomura@gmail.com>hack/codesign/debugserver that wraps the LLDB debugserver to codesign the target executable.1 parent 6ef4970 commit 77f5a1f
1 file changed
+113
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
0 commit comments