Skip to content

Commit 09e2ef7

Browse files
committed
moving to cdt gdb adapter
1 parent 922268e commit 09e2ef7

33 files changed

+5762
-199
lines changed

docs/DEBUGGING.md

+44-2
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,17 @@
77
88
The Visual Studio Code uses `.vscode/launch.json` to configure debug as specified in [Visual Studio Code Debugging](https://code.visualstudio.com/docs/editor/debugging#_launch-configurations).
99

10-
We recommend using our Eclipse CDT GDB configuration to debug your ESP-IDF projects, but you can configure launch.json for any GDB debugger extension like [Microsoft C/C++ Extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools) and [Native Debug](https://marketplace.visualstudio.com/items?itemName=webfreak.debug). The ESP-IDF Debug adapter will be deprecated and removed in the next major release.
10+
We recommend using our Eclipse CDT GDB Adapter configuration to debug your ESP-IDF projects, but you can configure launch.json for any GDB debugger extension like [Microsoft C/C++ Extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools) and [Native Debug](https://marketplace.visualstudio.com/items?itemName=webfreak.debug). The ESP-IDF Debug adapter will be deprecated and removed in the next major release.
1111

1212
Our extension implements a `ESP-IDF: Peripheral View` tree view in the `Run and Debug` view which will use the SVD file defined in the `IDF SVD File Path (idf.svdFilePath)` configuration setting to be defined in the [settings.json](../SETTINGS.md) to populate a set of peripherals registers values for the active debug session target. You could find Espressif SVD files from [Espressif SVD](https://github.com/espressif/svd).
1313

14+
If `initCommands`, `gdbinitFile` or `initGdbCommands` are defined in launch.json, make sure to include the following commands for debug session to properly work as shown in [JTAG Debugging with command line](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/jtag-debugging/using-debugger.html#command-line).
15+
1416
## Using the Eclipse CDT GDB Debug Adapter
1517

16-
The Eclipse CDT team have published a GDB debug adapter as NPM package which we include in our extension dependencies. For more information about the debug adapter please review [CDT-GDB-Adapter Github Repository](https://github.com/eclipse-cdt-cloud/cdt-gdb-adapter). The arguments in launch.json are
18+
The Eclipse CDT team have published a GDB debug adapter as NPM package which we include in our extension dependencies. For more information about the debug adapter please review [CDT-GDB-Adapter Github Repository](https://github.com/eclipse-cdt-cloud/cdt-gdb-adapter).
19+
20+
The basic arguments in launch.json are
1721

1822
```JSON
1923
{
@@ -38,6 +42,44 @@ The Eclipse CDT team have published a GDB debug adapter as NPM package which we
3842
}
3943
```
4044

45+
where `program` and `gdb` can be resolved by extension. Some additional arguments you might use are:
46+
47+
- `runOpenOCD`: (Default: true). Run extension openOCD Server.
48+
- `verifyAppBinBeforeDebug`: (Default: false) Verify that current ESP-IDF project binary is the same as binary in chip.
49+
- `logFile`: Absolute path to the file to log interaction with gdb.
50+
- `verbose`: Produce verbose log output.
51+
- `environment`: Environment variables to apply to the ESP-IDF Debug Adapter. It will replace global environment variables and environment variables used by the extension.
52+
53+
```json
54+
"environment": {
55+
"VAR": "Value"
56+
}
57+
```
58+
59+
- `imageAndSymbols`:
60+
61+
```json
62+
"imageAndSymbols": {
63+
"symbolFileName": "If specified, a symbol file to load at the given (optional) offset",
64+
"symbolOffset": "If symbolFileName is specified, the offset used to load",
65+
"imageFileName": "If specified, an image file to load at the given (optional) offset",
66+
"imageOffset": "If imageFileName is specified, the offset used to load"
67+
}
68+
```
69+
70+
- `target`: Configuration for target to be attached.
71+
72+
```json
73+
"target": {
74+
"type": "The kind of target debugging to do. This is passed to -target-select (defaults to remote)",
75+
"host": "Target host to connect to (defaults to 'localhost', ignored if parameters is set)",
76+
"port": "Target port to connect to (defaults to value captured by serverPortRegExp, ignored if parameters is set)",
77+
"parameters": "Target parameters for the type of target. Normally something like localhost:12345. (defaults to `${host}:${port}`)"
78+
}
79+
```
80+
81+
Other arguments please review this extension's package.json `gdbtarget` debugger contribution.
82+
4183
## Use Microsoft C/C++ Extension to Debug
4284

4385
The user can also use [Microsoft C/C++ Extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools) to debug, the community recommend this launch.json configuration:

package.json

+12-9
Original file line numberDiff line numberDiff line change
@@ -1464,8 +1464,7 @@
14641464
},
14651465
{
14661466
"type": "gdbtarget",
1467-
"label": "GDB Target",
1468-
"program": "./node_modules/cdt-gdb-adapter/dist/debugTargetAdapter.js",
1467+
"label": "Eclipse GDB Target",
14691468
"runtime": "node",
14701469
"configurationAttributes": {
14711470
"launch": {
@@ -1479,6 +1478,11 @@
14791478
"type": "string",
14801479
"description": "Working directory (cwd) to use when launching gdb. Defaults to the directory of the 'program'"
14811480
},
1481+
"runOpenOCD": {
1482+
"type": "boolean",
1483+
"description": "Run OpenOCD Server",
1484+
"default": true
1485+
},
14821486
"environment": {
14831487
"additionalProperties": {
14841488
"type": [
@@ -1917,14 +1921,12 @@
19171921
"type": "gdbtarget",
19181922
"request": "attach",
19191923
"name": "Eclipse CDT GDB Adapter",
1920-
"program": "${workspaceFolder}/build/${command:espIdf.getProjectName}.elf",
19211924
"initCommands": [
19221925
"set remote hardware-watchpoint-limit 2",
19231926
"mon reset halt",
19241927
"maintenance flush register-cache",
19251928
"thb app_main"
19261929
],
1927-
"gdb": "${command:espIdf.getXtensaGdb}",
19281930
"target": {
19291931
"port": "3333"
19301932
}
@@ -1938,14 +1940,12 @@
19381940
"type": "gdbtarget",
19391941
"request": "attach",
19401942
"name": "Eclipse CDT GDB Adapter",
1941-
"program": "^\"\\${workspaceFolder}/build/\\${command:espIdf.getProjectName}.elf\"",
19421943
"initCommands": [
19431944
"set remote hardware-watchpoint-limit 2",
19441945
"mon reset halt",
19451946
"maintenance flush register-cache",
19461947
"thb app_main"
19471948
],
1948-
"gdb": "^\"\\${command:espIdf.getXtensaGdb}\"",
19491949
"target": {
19501950
"port": "3333"
19511951
}
@@ -2035,14 +2035,15 @@
20352035
"@types/ws": "^7.2.5",
20362036
"@types/xml2js": "^0.4.11",
20372037
"@types/yauzl": "^2.9.1",
2038-
"@vscode/debugadapter": "^1.53.0",
2038+
"@vscode/debugadapter": "^1.65.0",
20392039
"@vscode/debugadapter-testsupport": "^1.51.0",
2040-
"@vscode/debugprotocol": "^1.53.0",
2040+
"@vscode/debugprotocol": "^1.65.0",
20412041
"@vscode/extension-telemetry": "0.4.8",
20422042
"@vscode/test-electron": "^2.1.2",
20432043
"@vue/compiler-sfc": "^3.3.4",
20442044
"bulma": "^0.9.3",
20452045
"chai": "^4.3.4",
2046+
"copy-webpack-plugin": "^12.0.2",
20462047
"css-loader": "^3.1.0",
20472048
"d3-scale": "^4.0.2",
20482049
"file-loader": "^6.2.0",
@@ -2062,6 +2063,7 @@
20622063
"reflect-metadata": "^0.1.13",
20632064
"sass": "^1.49.8",
20642065
"sass-loader": "^10",
2066+
"string-replace-loader": "^3.1.0",
20652067
"style-loader": "^3.3.1",
20662068
"ts-loader": "^9.4.4",
20672069
"typescript": "^5.2.2",
@@ -2081,7 +2083,6 @@
20812083
"assert": "^2.1.0",
20822084
"axios": "^1.6.0",
20832085
"bignumber.js": "^9.0.1",
2084-
"cdt-gdb-adapter": "^0.0.32",
20852086
"del": "^4.1.1",
20862087
"es6-promisify": "^6.0.0",
20872088
"follow-redirects": "^1.15.4",
@@ -2097,9 +2098,11 @@
20972098
"plotly.js-dist-min": "^2.26.1",
20982099
"postcss": "^8.4.31",
20992100
"sanitize-html": "^2.7.0",
2101+
"serialport": "^12.0.0",
21002102
"stream-browserify": "^3.0.0",
21012103
"tar-fs": "^2.0.0",
21022104
"tree-kill": "^1.2.2",
2105+
"utf8": "^3.0.0",
21032106
"vscode-languageclient": "^5.2.1",
21042107
"vscode-languageserver": "^5.2.1",
21052108
"vscode-nls": "^4.0.0",

0 commit comments

Comments
 (0)