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 golang/vscode-go#3712

Change-Id: I6f759356851938547a5db35c39309899e0200428
GitHub-Last-Rev: c9f186cf7e206205b760925e9e52ed7b48e6c44b
GitHub-Pull-Request: golang/vscode-go#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>
diff --git a/docs/debugging.md b/docs/debugging.md
index 4d2b9e1..ed44d30 100644
--- a/docs/debugging.md
+++ b/docs/debugging.md
@@ -452,6 +452,8 @@
 | `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>|
 | `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> |
 | `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> |
+| `followExec` | (Experimental) Enables or disables follow exec mode.<br/>(Default: `false`)<br/> | <center>_n/a_</center> |
+| `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> |
 | `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>|
 | `hideSystemGoroutines` | Boolean value to indicate whether system goroutines should be hidden from call stack view.<br/>(Default: `false`)<br/> | <center>_same as Launch_</center>|
 | `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/> |
diff --git a/extension/package.json b/extension/package.json
index b24a752..6dab59f 100644
--- a/extension/package.json
+++ b/extension/package.json
@@ -897,6 +897,16 @@
                 },
                 "description": "Configures which pprof lables to show as the goroutine name in the threads view",
                 "default": []
+              },
+              "followExec": {
+                "default": false,
+                "description": "(Experimental) Enables or disables follow exec mode.",
+                "type": "boolean"
+              },
+              "followExecRegex": {
+                "default": "",
+                "description": "(Experimental) Regular expression. Only child processes with a command line that matches this regular expression will be followed during 'target follow-exec'.",
+                "type": "string"
               }
             }
           },