Skip to content

Commit

Permalink
better debugger support
Browse files Browse the repository at this point in the history
  • Loading branch information
matepek committed Nov 19, 2018
1 parent 24ab658 commit d1e8fcf
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 20 deletions.
11 changes: 1 addition & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -145,16 +145,7 @@
"object",
"null"
],
"default": {
"type": "cppdbg",
"MIMode": "lldb",
"program": "${exec}",
"args": "${args}",
"cwd": "${cwd}",
"env": "${envObj}",
"stopAtEntry": false,
"externalConsole": true
},
"default": null,
"scope": "resource"
}
}
Expand Down
31 changes: 21 additions & 10 deletions src/C2TestAdapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,14 +182,15 @@ export class C2TestAdapter implements TestAdapter, vscode.Disposable {
const template =
this._getDebugConfigurationTemplate(this._getConfiguration());
let resolveDebugVariables: [string, any][] = this._variableToValue;
const args =
[testInfo.getEscapedTestName(), '--reporter', 'console', '--break'];

resolveDebugVariables = resolveDebugVariables.concat([
['${label}', testInfo.label], ['${exec}', testInfo.parent.execPath],
[
'${args}',
[testInfo.getEscapedTestName(), '--reporter', 'console', '--break']
],
['${label}', testInfo.label],
['${exec}', testInfo.parent.execPath],
['${args}', args],
['${cwd}', testInfo.parent.execOptions.cwd!],
['${envObj}', testInfo.parent.execOptions.env!]
['${envObj}', testInfo.parent.execOptions.env!],
]);

if (template !== null) {
Expand All @@ -199,11 +200,21 @@ export class C2TestAdapter implements TestAdapter, vscode.Disposable {
debug[prop] = resolveVariables(val, resolveDebugVariables);
}
}

return debug;
} else {
// lets try to recognise existing extensions
vscode.extensions.getExtension('');
} else if (vscode.extensions.getExtension('vadimcn.vscode-lldb')) {
debug['type'] = 'lldb';
debug['program'] = testInfo.parent.execPath;
debug['args'] = args;
debug['cwd'] = testInfo.parent.execOptions.cwd!;
debug['env'] = testInfo.parent.execOptions.env!;
return debug;
} else if (vscode.extensions.getExtension('ms-vscode.cpptools')) {
debug['type'] = 'cppvsdbg';
debug['program'] = testInfo.parent.execPath;
debug['args'] = args;
debug['cwd'] = testInfo.parent.execOptions.cwd!;
debug['environment'] = [testInfo.parent.execOptions.env!];
return debug;
}

throw 'Catch2: For debug \'debugConfigTemplate\' should be set.';
Expand Down

0 comments on commit d1e8fcf

Please sign in to comment.