Skip to content

Commit 6924509

Browse files
committed
Merge branch '1-0-0-pre0-release-preps' of https://github.com/Open-CMSIS-Pack/vscode-cmsis-debugger into 1-0-0-pre0-release-preps
2 parents f0f436a + 5e81e9c commit 6924509

File tree

4 files changed

+84
-3
lines changed

4 files changed

+84
-3
lines changed

src/debug-configuration/gdbtarget-configuration-provider.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ import {
2121
PYOCD_SERVER_TYPE_REGEXP,
2222
PyocdConfigurationProvider,
2323
JLINK_SERVER_TYPE_REGEXP,
24-
JlinkConfigurationProvider
24+
JlinkConfigurationProvider,
25+
GenericConfigurationProvider
2526
} from './subproviders';
2627
import { BuiltinToolPath } from '../desktop/builtin-tool-path';
2728
import { resolveToolPath } from '../desktop/tool-path-utils';
@@ -43,6 +44,8 @@ const SUPPORTED_SUBPROVIDERS: GDBTargetConfigurationSubProvider[] = [
4344
{ serverRegExp: JLINK_SERVER_TYPE_REGEXP, provider: new JlinkConfigurationProvider() },
4445
];
4546

47+
const GENERIC_SUBPROVIDER: GDBTargetConfigurationSubProvider = { serverRegExp: /^.*/i, provider: new GenericConfigurationProvider() };
48+
4649

4750
export class GDBTargetConfigurationProvider implements vscode.DebugConfigurationProvider {
4851
protected builtinArmNoneEabiGdb = new BuiltinToolPath(ARM_NONE_EABI_GDB_BUILTIN_PATH);
@@ -85,8 +88,8 @@ export class GDBTargetConfigurationProvider implements vscode.DebugConfiguration
8588
logger.debug(`${resolverType}: Check for relevant configuration subproviders`);
8689
const subproviders = this.getRelevantSubproviders(resolverType, serverType);
8790
if (!subproviders.length) {
88-
logger.debug('No relevant configuration subproviders found');
89-
return undefined;
91+
logger.debug('No relevant configuration subproviders found, using generic configuration');
92+
subproviders.push(GENERIC_SUBPROVIDER);
9093
}
9194
if (subproviders.length > 1) {
9295
logger.warn('Multiple configuration subproviders detected. Using first in list:');
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/**
2+
* Copyright 2025 Arm Limited
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
import { gdbTargetConfiguration, targetConfigurationFactory } from '../debug-configuration.factory';
18+
import { GenericConfigurationProvider } from './generic-configuration-provider';
19+
20+
describe('GenericConfigurationProvider', () => {
21+
22+
describe('resolveDebugConfigurationWithSubstitutedVariables', () => {
23+
24+
it('adds gdbserver to minimal configuration serverParameters', async () => {
25+
const configProvider = new GenericConfigurationProvider();
26+
const config = gdbTargetConfiguration({
27+
target: targetConfigurationFactory(),
28+
});
29+
const debugConfig = await configProvider.resolveDebugConfigurationWithSubstitutedVariables(undefined, config, undefined);
30+
expect(debugConfig).toBeDefined();
31+
});
32+
});
33+
34+
});
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
/**
2+
* Copyright 2025 Arm Limited
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
import { BaseConfigurationProvider } from './base-configuration-provider';
18+
import { GDBTargetConfiguration, TargetConfiguration } from '../gdbtarget-configuration';
19+
import { getCmsisPackRootPath } from '../../utils';
20+
import { logger } from '../../logger';
21+
22+
export class GenericConfigurationProvider extends BaseConfigurationProvider {
23+
24+
protected resolveCmsisPackRootPath(target: TargetConfiguration): void {
25+
if (target.environment?.CMSIS_PACK_ROOT) {
26+
return;
27+
}
28+
29+
target.environment ??= {};
30+
target.environment.CMSIS_PACK_ROOT = getCmsisPackRootPath();
31+
}
32+
33+
protected async resolveServerParameters(debugConfiguration: GDBTargetConfiguration): Promise<GDBTargetConfiguration> {
34+
logger.debug('Resolving generic server parameters');
35+
if (!debugConfiguration.target) {
36+
return debugConfiguration;
37+
}
38+
// CMSIS_PACK_ROOT
39+
this.resolveCmsisPackRootPath(debugConfiguration.target);
40+
return debugConfiguration;
41+
}
42+
43+
}

src/debug-configuration/subproviders/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,4 @@
1616

1717
export * from './pyocd-configuration-provider';
1818
export * from './jlink-configuration-provider';
19+
export * from './generic-configuration-provider';

0 commit comments

Comments
 (0)