Skip to content

Commit

Permalink
allow symbolFiles to be simple files instead of objects
Browse files Browse the repository at this point in the history
  • Loading branch information
haneefdm committed Aug 23, 2023
1 parent a17c1ac commit 59330a7
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 8 deletions.
2 changes: 1 addition & 1 deletion debug_attributes.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ If the type is marked as `{...}` it means that it is a complex item can have mul
| swoConfig<br>.swoFrequency | number | Both | SWO frequency in Hz. |
| swoConfig<br>.swoPath | string | Both | Path name when source is "file" or "serial". Typically a /path-name or a serial-port-name |
| swoConfig<br>.swoPort | string | Both | When server is "external" && source is "socket", port to connect to. Format [host:]port |
| symbolFiles | object[] | Both | List of ELF files to load symbols from instead of the executable file. Program information is ignored (see `loadFiles`). Can be an empty list to specify none. If this property does not exist, then the executable is used for symbols |
| symbolFiles | object[] | Both | Array of ELF files to load symbols from instead of the executable file. Each item in the array cab be a string or an object. Program information is ignored (see `loadFiles`). Can be an empty list to specify none. If this property does not exist, then the executable is used for symbols |
| targetId | string &#124; number | Both | On BMP this is the ID number that should be passed to the attach command (defaults to 1); for PyOCD this is the target identifier (only needed for custom hardware) |
| targetProcessor | number | Both | The processor you want to debug. Zero based integer index. Must be less than 'numberOfProcessors' |
| toolchainPrefix | string | Both | This setting can be used to override the toolchainPrefix user setting for a particular launch configuration. Default = "arm-none-eabi" |
Expand Down
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "1.12.1-pre1",
"version": "1.12.1-pre2",
"preview": false,
"activationEvents": [
"onDebugResolve:cortex-debug",
Expand Down Expand Up @@ -678,10 +678,10 @@
"type": "string"
},
"symbolFiles": {
"description": "List of ELF files to load symbols from instead of the executable file. Program information is ignored (see `loadFiles`). Can be an empty list to specify none. If this property does not exist, then the executable is used for symbols",
"description": "Array of ELF files to load symbols from instead of the executable file. Each item in the array cab be a string or an object. Program information is ignored (see `loadFiles`). Can be an empty list to specify none. If this property does not exist, then the executable is used for symbols",
"type": "array",
"items": {
"type": "object",
"type": ["object", "string"],
"properties": {
"file": {
"type": "string",
Expand Down Expand Up @@ -1782,10 +1782,10 @@
"default": null
},
"symbolFiles": {
"description": "List of ELF files to load symbols from instead of the executable file. Program information is ignored (see `loadFiles`). Can be an empty list to specify none. If this property does not exist, then the executable is used for symbols",
"description": "Array of ELF files to load symbols from instead of the executable file. Each item in the array cab be a string or an object. Program information is ignored (see `loadFiles`). Can be an empty list to specify none. If this property does not exist, then the executable is used for symbols",
"type": "array",
"items": {
"type": "object",
"type": ["object", "string"],
"properties": {
"file": {
"type": "string",
Expand Down
6 changes: 5 additions & 1 deletion src/frontend/configprovider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ export class CortexDebugConfigurationProvider implements vscode.DebugConfigurati
// Right now, we don't consider a bad executable as fatal. Technically, you don't need an executable but
// users will get a horrible debug experience ... so many things don't work.
const def = defSymbolFile(config.executable);
const symFiles: SymbolFile[] = config.symbolFiles || [def];
const symFiles: SymbolFile[] = config.symbolFiles?.map((v) => { return typeof v === 'string' ? defSymbolFile(v) : v}) || [def];
if (!symFiles || (symFiles.length === 0)) {
vscode.window.showWarningMessage('No "executable" or "symbolFiles" specified. We will try to run program without symbols');
} else {
Expand Down Expand Up @@ -310,6 +310,10 @@ export class CortexDebugConfigurationProvider implements vscode.DebugConfigurati
fName = path.normalize(fName).replace(/\\/g, '/');
config.loadFiles[ix] = fName;
}
} else if (config.executable && config.symbolFiles) {
// This is a special case when you have symbol files, we don't pass anything to gdb on the command line
// and a target load will fail. Create a loadFiles from the executable if it exists.
config.loadFiles = [ config.executable ];
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/gdb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ export class GDBDebugSession extends LoggingDebugSession {
`Cortex-Debug: VSCode debugger extension version ${args.pvtVersion} git(${__COMMIT_HASH__}). ` +
'Usage info: https://github.com/Marus/cortex-debug#usage');

if (this.args.pvtShowDevDebugOutput === ADAPTER_DEBUG_MODE.VSCODE) {
if (this.args.showDevDebugOutput) {
this.handleMsg('log', '"configuration": ' + JSON.stringify(args, undefined, 4) + '\n');
}

Expand Down

0 comments on commit 59330a7

Please sign in to comment.