|
1 | 1 | ---
|
2 | 2 | title: "launch.vs.json schema reference (C++)"
|
3 | 3 | description: "Describes the schema elements for the `launch.vs.json` file"
|
4 |
| -ms.date: "12/02/2020" |
| 4 | +ms.date: "7/12/2021" |
5 | 5 | helpviewer_keywords: ["launch.vs.json file [C++]"]
|
6 | 6 | ---
|
7 | 7 | # launch.vs.json schema reference (C++)
|
8 | 8 |
|
9 |
| -Use the *launch.vs.json* file to configure debugging parameters. To create the file. right-click on an executable file in **Solution Explorer** and choose **Debug and Launch Settings**. Choose the option that most closely matches your project and then use the following properties to modify the configuration as needed. For more information on debugging CMake projects, see [Configure CMake debugging sessions](./configure-cmake-debugging-sessions.md). |
| 9 | +Starting in Visual Studio 2017, you can open code from nearly any type of directory-based project into Visual Studio without the need for a solution or project file. When there's no project or solution file, you can specify custom build tasks and launch parameters through JSON configuration files. This article describes the `launch.vs.json` file, which specifies debugging parameters. See [Develop code in Visual Studio without projects or solutions](https://docs.microsoft.com/visualstudio/ide/develop-code-in-visual-studio-without-projects-or-solutions) for more information about the "Open Folder" feature. |
| 10 | + |
| 11 | +To create the file, right-click on an executable file in **Solution Explorer** and choose **Debug and Launch Settings**. Choose the option that most closely matches your project and then use the following properties to modify the configuration as needed. For more information on debugging CMake projects, see [Configure CMake debugging sessions](./configure-cmake-debugging-sessions.md). |
10 | 12 |
|
11 | 13 | ## Default properties
|
12 | 14 |
|
@@ -56,6 +58,49 @@ Use the *launch.vs.json* file to configure debugging parameters. To create the f
|
56 | 58 | externalConsole|boolean|If true, a console is launched for the debuggee. If **`false`**, no console is launched. The default for this setting is **`false`**. This option is ignored in some cases for technical reasons.|
|
57 | 59 | |`pipeTransport`|string|When present, this tells the debugger to connect to a remote computer using another executable as a pipe that will relay standard input/output between Visual Studio and the MI-enabled debugger (such as gdb). Allowed values: one or more [Pipe Transport Options](#pipe_transport_options).|
|
58 | 60 |
|
| 61 | +## debugInfo macros |
| 62 | + |
| 63 | +The following macros provide information about the debugging environment. They're useful for customizing the launch of your app for debugging. |
| 64 | + |
| 65 | +|Macro |Description |Example | |
| 66 | +|---|---|---| |
| 67 | +| `addressSanitizerRuntimeFlags` | Runtime flags used to customize behavior of the address sanitizer. Used to set the environment variable `"ASAN_OPTIONS"`. | `"env": {"ASAN_OPTIONS": "${addressSanitizerRuntimeFlags}:anotherFlag=true"`} | |
| 68 | +| `defaultWorkingDirectory` | Set to the directory part of `"fullTargetPath"`. If the CMake variable `VS_DEBUGGER_WORKING_DIRECTORY` is defined, then `defaultWorkingDirectory` is set to that value, instead. | `"cwd":"${debugInfo.defaultWorkingDirectory}"` | |
| 69 | +| `fullTargetPath` | The full path to the binary being debugged. | `"program": "${debugInfo.fullTargetPath}"` | |
| 70 | +| `linuxNatvisPath` | The full windows path to the VS linux `.natvis` file. Usually appears as the value `"visualizerFile"`. | |
| 71 | +| `parentProcessId` | The process ID for the current Visual Studio instance. Used as a parameter to shellexec. | See pipeTransport example below. | |
| 72 | +| `remoteMachineId` | A unique, numeric identifier for the connection to the remote machine. Used as a parameter to shellexec. | See pipeTransport example below. | |
| 73 | +| `remoteWorkspaceRoot` | Linux path to the remote copy of the workspace. | Specify file locations on the remote machine. For example: `"args": ["${debugInfo.remoteWorkspaceRoot}/Data/MyInputFile.dat"]` | |
| 74 | +|`resolvedRemoteMachineName` | The name of the target remote machine. | `"targetMachine"` value in a deployment directive | | |
| 75 | +| `shellexecPath`| The path to the shellexec program that Visual Studio is using to manage the remote machine connection. | See pipeTransport example below | |
| 76 | +| `tty` | gdb will redirect input and output to this device for the program being debugged. Used as a parameter to gdb (-tty). | See pipeTransport example below. | |
| 77 | +| `windowsSubsystemPath` | The full path to the Windows Subsystem for Linux instance. | | |
| 78 | + |
| 79 | +The pipeTransport example below shows how to use some of the `debugInfo` macros defined above: |
| 80 | + |
| 81 | +```json |
| 82 | +"pipeTransport": { |
| 83 | + "pipeProgram": "${debugInfo.shellexecPath}", |
| 84 | + "pipeArgs": [ |
| 85 | + "/s", |
| 86 | + "${debugInfo.remoteMachineId}", |
| 87 | + "/p", |
| 88 | + "${debugInfo.parentProcessId}", |
| 89 | + "/c", |
| 90 | + "${debuggerCommand}", |
| 91 | + "--tty=${debugInfo.tty}" |
| 92 | + ], |
| 93 | + "pipeCmd": [ |
| 94 | + "/s", |
| 95 | + "${debugInfo.remoteMachineId}", |
| 96 | + "/p", |
| 97 | + "${debugInfo.parentProcessId}", |
| 98 | + "/c", |
| 99 | + "${debuggerCommand}" |
| 100 | + ] |
| 101 | + } |
| 102 | +``` |
| 103 | + |
59 | 104 | ## <a name="remote_deploy_debug"></a> C++ Windows remote debug and deploy properties
|
60 | 105 |
|
61 | 106 | Used when debugging and deploying an app on a remote machine.
|
|
0 commit comments