You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [email protected] with any additional questions or comments.
*[Build and debug the extension](Documentation/Getting%20started.md#build-and-debug-the-cpptools-extension).
5
-
* File an [issue](https://github.com/Microsoft/vscode-cpptools/issues) and a [pull request](https://github.com/Microsoft/vscode-cpptools/pulls) with the change and we will review it.
6
-
* If the change affects functionality, add a line describing the change to [CHANGELOG.md](Extension/CHANGELOG.md).
7
-
* Try and add a test in [test/extension.test.ts](Extension/test/unitTests/extension.test.ts).
8
-
* Run tests via opening the [Extension](https://github.com/Microsoft/vscode-cpptools/tree/master/Extension) folder in Visual Studio Code, selecting the `Launch Tests` configuration in the Debug pane, and choosing `Start Debugging`.
3
+
## Contribution Steps
4
+
5
+
*[Build and debug the extension](Documentation/Getting%20started.md#build-and-debug-the-cpptools-extension).
6
+
* File an [issue](https://github.com/Microsoft/vscode-cpptools/issues) and a [pull request](https://github.com/Microsoft/vscode-cpptools/pulls) with the change and we will review it.
7
+
* If the change affects functionality, add a line describing the change to [**CHANGELOG.md**](Extension/CHANGELOG.md).
8
+
* Try and add a test in [**test/extension.test.ts**](Extension/test/unitTests/extension.test.ts).
9
+
* Run tests via opening the [**Extension**](https://github.com/Microsoft/vscode-cpptools/tree/master/Extension) folder in Visual Studio Code, selecting the "Launch Tests" configuration in the Debug pane, and choosing "Start Debugging".
9
10
10
11
## About the Code
11
-
* Execution starts in the `activate` method in [main.ts](Extension/src/main.ts).
12
-
*`processRuntimeDependencies` handles the downloading and installation of the OS-dependent files. Downloading code exists in [packageManager.ts](Extension/src/packageManager.ts).
13
-
*`downloadCpptoolsJsonPkg` handles the `cpptools.json`, which can be used to enable changes to occur mid-update, such as turning the `intelliSenseEngine` to `"Default"` for a certain percentage of users.
14
-
* The debugger code is in the [Debugger](https://github.com/Microsoft/vscode-cpptools/tree/master/Extension/src/Debugger) folder.
15
-
*[LanguageServer/client.ts](Extension/src/LanguageServer/client.ts) handles various language server functionality.
16
-
*[LanguageServer/configurations.ts](Extension/src/LanguageServer/configurations.ts) handles functionality related to `c_cpp_properties.json`.
17
-
*[telemetry.ts](Extension/src/telemetry.ts): Telemetry data gets sent to either `logLanguageServerEvent` or `logDebuggerEvent`.
18
-
* The Tag Parser (symbol database) doesn't automatically expand macros, so the [cpp.hint](Extension/cpp.hint) file contains definitions of macros that should be expanded in order for symbols to be parsed correctly.
12
+
13
+
* Execution starts in the `activate` method in [**main.ts**](Extension/src/main.ts).
14
+
*`processRuntimeDependencies` handles the downloading and installation of the OS-dependent files. Downloading code exists in [**packageManager.ts**](Extension/src/packageManager.ts).
15
+
*`downloadCpptoolsJsonPkg` handles the **cpptools.json**, which can be used to enable changes to occur mid-update, such as turning the `intelliSenseEngine` to `"Default"` for a certain percentage of users.
16
+
* The debugger code is in the [**Debugger**](https://github.com/Microsoft/vscode-cpptools/tree/master/Extension/src/Debugger) folder.
17
+
*[**LanguageServer/client.ts**](Extension/src/LanguageServer/client.ts) handles various language server functionality.
18
+
*[**LanguageServer/configurations.ts**](Extension/src/LanguageServer/configurations.ts) handles functionality related to **c_cpp_properties.json**.
19
+
*[**telemetry.ts**](Extension/src/telemetry.ts): Telemetry data gets sent to either `logLanguageServerEvent` or `logDebuggerEvent`.
20
+
* The Tag Parser (symbol database) doesn't automatically expand macros, so the [**cpp.hint**](Extension/cpp.hint) file contains definitions of macros that should be expanded in order for symbols to be parsed correctly.
Copy file name to clipboardExpand all lines: Documentation/Debugger/How To Debug MIEngine.md
+16-12Lines changed: 16 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,15 +1,16 @@
1
1
# How To Debug MIEngine (Work in Progress)
2
+
2
3
*This is a work in progress. Please create a pull request with updates if there is anything wrong with it.*
3
4
4
-
MIEngine is one of the components used to enable the C/C++ debugging scenario with the Microsoft C/C++ extension with VS Code. This document is to help enable users who want to debug and contribute to MIEngine to fix issues or extend functionality. MIEngine is used to communicate with `gdb/lldb` using the MI protocol.
5
+
MIEngine is one of the components used to enable the C/C++ debugging scenario with the Microsoft C/C++ extension with VS Code. This document is to help enable users who want to debug and contribute to MIEngine to fix issues or extend functionality. MIEngine is used to communicate with `gdb`/`lldb` using the MI protocol.
To build MIEngine, you will either need Visual Studio 2015+ installed or at the very least [MSBuild](https://github.com/Microsoft/msbuild) installed. The configuration you want to build is `Desktop.Debug`.
11
12
12
-
You can open the solution file `MIDebugEngine.sln` located under `src` and change the configuration and build. You will want to look in the `bin\Desktop.Debug` folder for the compiled bits. You will need to copy the following files to your `.vscode\extensions\ms-vscode.cpptools-<version>\debugadapters\bin` folder in your users/home folder:
13
+
You can open the solution file **MIDebugEngine.sln** located under **src** and change the configuration and build. You will want to look in the **bin\Desktop.Debug** folder for the compiled bits. You will need to copy the following files to your **.vscode\extensions\ms-vscode.cpptools-\<version\>\debugadapters\bin** folder in your users/home folder:
13
14
14
15
* Microsoft.MICore.dll
15
16
* Microsoft.MICore.XmlSerializers.dll
@@ -27,7 +28,7 @@ The symbol files are as follows:
27
28
28
29
### Debugging On Windows
29
30
30
-
On Windows, the easiest way to debug is to use Visual Studio. Locate the `package.json` file in the extension folder and open it in an editor.
31
+
On Windows, the easiest way to debug is to use Visual Studio. Locate the **package.json** file in the **Extension** folder and open it in an editor.
31
32
32
33
Locate the following line:
33
34
```json
@@ -49,29 +50,32 @@ On Linux and Mac OS X, we use `mono` as our framework. You can download Xamarin
49
50
2. Install [Xamarin Studio v5.10.1.6](http://download.xamarin.com/studio/Windows/XamarinStudio-5.10.1.6-0.msi)
50
51
51
52
Remote attach functionality behind a flag. You can run it like this:
52
-
```
53
-
cd "\Program Files (x86)\MonoDevelop\bin"
54
-
set MONODEVELOP_SDB_TEST=1
55
-
MonoDevelop.exe
53
+
```PowerShell
54
+
cd "\Program Files (x86)\MonoDevelop\bin"
55
+
set MONODEVELOP_SDB_TEST=1
56
+
MonoDevelop.exe
56
57
```
57
58
58
59
#### Create an empty project for attaching (one-time setup)
60
+
59
61
1. Launch MonoDevelop
60
62
2. File -> New Solution
61
63
3. Misc/Generic Project
62
64
4. Name project and hit "Create"
63
65
5. Right-click the project node (blue square) and do "Options"
64
-
6. Under Run -> Custom Commands, select "Execute" in the lower dropdown and choose a command (I use c:\windows\notepad.exe - it doesn't matter what the command is, but MonoDevelop requires it to exist before it'll light up the Run menu).
66
+
6. Under Run -> Custom Commands, select "Execute" in the lower dropdown and choose a command (I use `c:\windows\notepad.exe` - it doesn't matter what the command is, but MonoDevelop requires it to exist before it'll light up the Run menu).
65
67
66
68
#### Configure the extension to enable remote debugging
67
-
Open the `~/.vscode/extensions/ms-vscode.cpptools-<version>/debugAdapters/OpenDebugAD7` file with a text editor and locate and uncomment the line at the bottom. When you start debugging, it will now hang until the remote debugger is attached from Xamarin Studio.
69
+
70
+
Open the **~/.vscode/extensions/ms-vscode.cpptools-\<version\>/debugAdapters/OpenDebugAD7** file with a text editor and locate and uncomment the line at the bottom. When you start debugging, it will now hang until the remote debugger is attached from Xamarin Studio.
68
71
69
72
#### Attach the remote debugger
73
+
70
74
In MonoDevelop: Run -> Run With -> Custom Command Mono Soft Debugger
71
75
Fill in the IP and port of the Linux/Mac OS X machine and hit "Connect" to start debugging
72
76
73
-
After you've done this once, you can hit the MonoDevelop "Play" button or F5 to bring up the connect dialog again.
77
+
After you've done this once, you can hit the MonoDevelop "Play" button or <kbd>F5</kbd> to bring up the connect dialog again.
74
78
75
79
Note: If you are debugging to CentOS, you will need to make an exception in the firewall
The `pipeArgs` can be any set of arguments necessary to setup and authenticate the pipe connection. In the example, a password is used but you can also use an ssh key.
19
21
20
22
You may also need to add a `sourceFileMap` to map the path of where the code exists on the remote shell to where it is locally:
21
-
```
22
-
"sourceFileMap": {
23
-
// "remote": "local"
24
-
"/home/user/src": "/src/projectA/src"
25
-
}
23
+
```json
24
+
"sourceFileMap": {
25
+
// "remote": "local"
26
+
"/home/user/src": "/src/projectA/src"
27
+
}
26
28
```
27
29
28
30
## Attach
31
+
29
32
You can also use the above `pipeTransport` block to attach to a remote process. In the attach case, you will need to specify a `processId`. We have added the ability to query processes from the remote machine. To do this, change `"processId": "${command.pickProcess}"` to `"processId": "${command.pickRemoteProcess}"`. The `pipeTransport` settings will be used to query the processes on the remote machine. Then select the process from the drop down list. As with `launch`, you may need to configure `sourceFileMap`.
30
33
31
34
## Docker example
32
35
33
-
The `pipeTransport` can also be used to debug a process in a Docker container. For an attach, the `launch.json` will include:
34
-
36
+
The `pipeTransport` can also be used to debug a process in a Docker container. For an attach, **launch.json** will include:
37
+
38
+
```json
39
+
"pipeTransport": {
40
+
"pipeCwd": "${workspaceRoot}",
41
+
"pipeProgram": "docker",
42
+
"pipeArgs": [
43
+
"exec",
44
+
"-i",
45
+
"hello_gdb",
46
+
"sh",
47
+
"-c"
48
+
],
49
+
"debuggerPath": "/usr/bin/gdb"
50
+
},
35
51
```
36
-
"pipeTransport": {
37
-
"pipeCwd": "${workspaceRoot}",
38
-
"pipeProgram": "docker",
39
-
"pipeArgs": [
40
-
"exec",
41
-
"-i",
42
-
"hello_gdb",
43
-
"sh",
44
-
"-c"
45
-
],
46
-
"debuggerPath": "/usr/bin/gdb"
47
-
},
48
-
```
49
-
50
52
Where `hello_gdb` is the name of your container.
51
53
52
-
Launching a process is accomplished by starting a container and then using the same `pipeTransport` launch additional processes in the container. See this [`launch.json`](https://github.com/andyneff/hello-world-gdb/blob/master/.vscode/launch.json) for a [full example](https://github.com/andyneff/hello-world-gdb/)
54
+
Launching a process is accomplished by starting a container and then using the same `pipeTransport` launch additional processes in the container. See this [**launch.json**](https://github.com/andyneff/hello-world-gdb/blob/master/.vscode/launch.json) for a [full example](https://github.com/andyneff/hello-world-gdb/).
0 commit comments