Skip to content

Commit

Permalink
add initialBreakpoint as launch json argument
Browse files Browse the repository at this point in the history
  • Loading branch information
brianignacio5 committed Aug 5, 2024
1 parent 1f6251a commit afa4a5f
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
6 changes: 3 additions & 3 deletions docs/DEBUGGING.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,7 @@ In case the user wants more customized control, the basic arguments in launch.js
"initCommands": [
"set remote hardware-watchpoint-limit {IDF_TARGET_CPU_WATCHPOINT_NUM}",
"mon reset halt",
"maintenance flush register-cache",
"thb app_main"
"maintenance flush register-cache"
],
"gdb": "${command:espIdf.getToolchainGdb}",
"target": {
Expand All @@ -62,7 +61,8 @@ In case the user wants more customized control, the basic arguments in launch.js
```

- `program`: ELF file of your project build directory to execute the debug session. The command `${command:espIdf.getProjectName}` will query the extension to find the current build directory project name.
- `initCommands`: GDB Commands to initialize GDB and target.
- `initCommands`: GDB Commands to initialize GDB and target. The default value is `["set remote hardware-watchpoint-limit {IDF_TARGET_CPU_WATCHPOINT_NUM}", "mon reset halt", "maintenance flush register-cache"]`.
- `initialBreakpoint`: When `initCommands` is not defined, this command will add to default initCommands a hardward breakpoint at the given function name. For example `app_main`, the default value, will add `thb app_main` to default initCommmands. If set to "", an empty string, no initial breakpoint will be set.
- `gdb`: GDB executable to be used. By default `"${command:espIdf.getToolchainGdb}"` will query the extension to find the ESP-IDF toolchain GDB for the current `IDF_TARGET` of your esp-idf project (esp32, esp32c6, etc.).

> **NOTE** `{IDF_TARGET_CPU_WATCHPOINT_NUM}` is resolved by the extension according to the current `IDF_TARGET` of your esp-idf project (esp32, esp32c6, etc.).
Expand Down
10 changes: 10 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -1579,6 +1579,11 @@
},
"default": []
},
"initialBreakpoint": {
"type": "string",
"description": "Hardware breakpoint being set initially as 'thb <value>'. For a value 'app_main' result in 'thb app_main' in initCommands. Ignored if user defines initCommands",
"default": "app_main"
},
"preRunCommands": {
"type": "array",
"description": "List of GDB commands sent after loading image on target before resuming target.",
Expand Down Expand Up @@ -1843,6 +1848,11 @@
},
"default": []
},
"initialBreakpoint": {
"type": "string",
"description": "Hardware breakpoint being set initially as 'thb <value>'. For a value 'app_main' result in 'thb app_main' in initCommands. Ignored if user defines initCommands",
"default": "app_main"
},
"preRunCommands": {
"type": "array",
"description": "List of GDB commands sent after loading image on target before resuming target.",
Expand Down
5 changes: 3 additions & 2 deletions src/cdtDebugAdapter/debugConfProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,10 @@ export class CDTDebugConfigurationProvider
"set remote hardware-watchpoint-limit {IDF_TARGET_CPU_WATCHPOINT_NUM}",
"mon reset halt",
"maintenance flush register-cache",
"thb app_main",
"c"
];
if (config.initialBreakpoint) {
config.initCommands.push(`thb ${config.initialBreakpoint.trim()}`, "c");
}
}

if (config.initCommands && Array.isArray(config.initCommands)) {
Expand Down

0 comments on commit afa4a5f

Please sign in to comment.