Skip to content

Commit 43281cc

Browse files
Lslightlyh9jiang
authored andcommitted
extension: add followExec and followExecRegex options in launch request
Add followExec and followExecRegex options in launch request in launch.json. Before InitializedEvent is sent back from delve, followExec and followExecRegex will be set in delve. If the program being debugged spawns a new child process at the beginning and breakpoints are set in source code line of child process, these breakpoints will be hit and shown to the user. Without these two options, although go-delve/delve#4078 provides delve command to enable follow-exec in console, user have to manually enable follow-exec in console each time launching the debug session. Fixes #3712 Change-Id: I6f759356851938547a5db35c39309899e0200428 GitHub-Last-Rev: c9f186c GitHub-Pull-Request: #3840 Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/696795 Reviewed-by: Hongxiang Jiang <hxjiang@golang.org> Reviewed-by: Michael Knyszek <mknyszek@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
1 parent c1848c4 commit 43281cc

2 files changed

Lines changed: 12 additions & 0 deletions

File tree

docs/debugging.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -452,6 +452,8 @@ Here is the list of attributes specific to Go debugging.
452452
| `dlvFlags` | Extra flags for `dlv`. See `dlv help` for the full list of supported. Flags such as `--log-output`, `--log`, `--log-dest`, `--api-version`, `--output`, `--backend` already have corresponding properties in the debug configuration, and flags such as `--listen` and `--headless` are used internally. If they are specified in `dlvFlags`, they may be ignored or cause an error.<br/> | <center>_same as Launch_</center>|
453453
| `env` | Environment variables passed to the launched debuggee program. Format as string key:value pairs. Merged with `envFile` and `go.toolsEnvVars` with precedence `env` > `envFile` > `go.toolsEnvVars`.<br/> | <center>_n/a_</center> |
454454
| `envFile` | Absolute path to a file containing environment variable definitions, formatted as string key=value pairs. Multiple files can be specified by provided an array of absolute paths. Merged with `env` and `go.toolsEnvVars` with precedence `env` > `envFile` > `go.toolsEnvVars`. <br/> | <center>_n/a_</center> |
455+
| `followExec` | (Experimental) Enables or disables follow exec mode.<br/>(Default: `false`)<br/> | <center>_n/a_</center> |
456+
| `followExecRegex` | (Experimental) Regular expression. Only child processes with a command line that matches this regular expression will be followed during 'target follow-exec'.<br/>(Default: `""`)<br/> | <center>_n/a_</center> |
455457
| `goroutineFilters` | Configures which system goroutines should be shown in the call stack. See https://github.com/go-delve/delve/blob/master/Documentation/cli/README.md#goroutines<br/>(Default: `""`)<br/> | <center>_same as Launch_</center>|
456458
| `hideSystemGoroutines` | Boolean value to indicate whether system goroutines should be hidden from call stack view.<br/>(Default: `false`)<br/> | <center>_same as Launch_</center>|
457459
| `host` | When applied to remote-attach configurations, will look for "dlv ... --headless --listen=<host>:<port>" server started externally. In dlv-dap mode this will apply to all other configurations as well. The extension will try to connect to an external server started with "dlv dap --listen=<host>:<port>" to ask it to launch/attach to the target process.<br/>(Default: `"127.0.0.1"`)<br/> | When applied to remote-attach configurations, will look for "dlv ... --headless --listen=<host>:<port>" server started externally. In dlv-dap mode, this will apply to all other configurations as well. The extension will try to connect to an external server started with "dlv dap --listen=<host>:<port>" to ask it to launch/attach to the target process.<br/>(Default: `"127.0.0.1"`)<br/> |

extension/package.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -897,6 +897,16 @@
897897
},
898898
"description": "Configures which pprof lables to show as the goroutine name in the threads view",
899899
"default": []
900+
},
901+
"followExec": {
902+
"default": false,
903+
"description": "(Experimental) Enables or disables follow exec mode.",
904+
"type": "boolean"
905+
},
906+
"followExecRegex": {
907+
"default": "",
908+
"description": "(Experimental) Regular expression. Only child processes with a command line that matches this regular expression will be followed during 'target follow-exec'.",
909+
"type": "string"
900910
}
901911
}
902912
},

0 commit comments

Comments
 (0)