Skip to content

Commit 18225f2

Browse files
authored
Merge branch 'main' into codeclimate
2 parents fd56842 + 34ffc54 commit 18225f2

File tree

5 files changed

+113
-3
lines changed

5 files changed

+113
-3
lines changed
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Bug Report
2+
description: Report a bug
3+
title: "[Bug]: "
4+
type: "Bug"
5+
projects: "github/21"
6+
labels: []
7+
assignees: []
8+
9+
body:
10+
- type: markdown
11+
attributes:
12+
value: "### Thank you for reporting a problem!"
13+
14+
- type: input
15+
id: summary
16+
attributes:
17+
label: "Summary"
18+
description: "Briefly describe the bug."
19+
placeholder: "e.g., App crashes when opening settings"
20+
validations:
21+
required: true
22+
23+
- type: textarea
24+
id: description
25+
attributes:
26+
label: "Description"
27+
description: "Provide details about the bug."
28+
placeholder: "Explain the unexpected behavior in detail."
29+
validations:
30+
required: true
31+
32+
- type: textarea
33+
id: steps
34+
attributes:
35+
label: "Steps to Reproduce"
36+
description: "List the steps to reproduce the bug."
37+
placeholder: |
38+
1. Go to '...'
39+
2. Click on '...'
40+
3. See error"
41+
validations:
42+
required: false
43+
44+
- type: textarea
45+
id: expected_behavior
46+
attributes:
47+
label: "Expected Behavior"
48+
description: "What should happen instead?"
49+
placeholder: "Describe what you expected to happen."
50+
51+
- type: textarea
52+
id: additional_info
53+
attributes:
54+
label: "Additional Information"
55+
description: "Any extra context or screenshots?"
56+
placeholder: "Paste logs, screenshots, or links here."

src/debug-configuration/gdbtarget-configuration.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ interface UARTConfiguration {
4040
eolCharacter?: string;
4141
};
4242

43-
interface TargetConfiguration {
43+
export interface TargetConfiguration {
4444
type?: string;
4545
parameters?: string[];
4646
host?: string;

src/debug-configuration/subproviders/pyocd-configuration-provider.ts

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,15 @@
1616

1717
import * as vscode from 'vscode';
1818
import { logger } from '../../logger';
19-
import { GDBTargetConfiguration } from '../gdbtarget-configuration';
19+
import { GDBTargetConfiguration, TargetConfiguration } from '../gdbtarget-configuration';
20+
import { BuiltinToolPath } from '../../desktop/builtin-tool-path';
2021

22+
const PYOCD_BUILTIN_PATH = 'tools/pyocd/pyocd';
23+
export const PYOCD_EXECUTABLE_ONLY_REGEXP = /^\s*pyocd(|.exe)\s*$/i;
2124
export const PYOCD_SERVER_TYPE_REGEXP = /.*pyocd(|.exe)\s*$/i;
2225

2326
export class PyocdConfigurationProvider implements vscode.DebugConfigurationProvider {
27+
protected builtinPyocd = new BuiltinToolPath(PYOCD_BUILTIN_PATH);
2428

2529
protected async hasCommand(commandName: string): Promise<boolean> {
2630
const commands = await vscode.commands.getCommands();
@@ -35,10 +39,22 @@ export class PyocdConfigurationProvider implements vscode.DebugConfigurationProv
3539
return !this.hasParam(paramName, params) && (!commandName || await this.hasCommand(commandName));
3640
}
3741

42+
protected resolveServerPath(target: TargetConfiguration): void {
43+
const targetServer = target.server;
44+
const useBuiltin = !targetServer || PYOCD_EXECUTABLE_ONLY_REGEXP.test(targetServer);
45+
const builtinUri = useBuiltin ? this.builtinPyocd.getAbsolutePath() : undefined;
46+
if (builtinUri) {
47+
target.server = builtinUri.fsPath;
48+
}
49+
}
50+
3851
protected async resolveServerParameters(debugConfiguration: GDBTargetConfiguration): Promise<GDBTargetConfiguration> {
3952
if (!debugConfiguration.target) {
4053
return debugConfiguration;
4154
}
55+
// server
56+
this.resolveServerPath(debugConfiguration.target);
57+
// serverParameters
4258
const parameters = debugConfiguration.target.serverParameters ??= [];
4359
// gdbserver
4460
if (await this.shouldAppendParam(parameters, 'gdbserver')) {

src/desktop/builtin-tool-path.ts

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
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 assert from 'assert';
18+
import * as fs from 'fs';
19+
import { EXTENSION_ID } from '../manifest';
20+
import * as os from 'os';
21+
import * as vscode from 'vscode';
22+
23+
const isWindows = os.platform() === 'win32';
24+
25+
export class BuiltinToolPath {
26+
constructor(protected toolPath: string) {
27+
assert(toolPath.length, 'BuiltinToolManager: \'toolPath\' must not be empty');
28+
}
29+
30+
public getAbsolutePath(): vscode.Uri | undefined {
31+
const extensionUri = vscode.extensions.getExtension(EXTENSION_ID)?.extensionUri;
32+
const absoluteUri = extensionUri?.with({ path: `${extensionUri.path}/${this.toolPath}${isWindows ? '.exe' : ''}` });
33+
const fsPath = absoluteUri?.fsPath;
34+
return (fsPath && fs.existsSync(fsPath)) ? absoluteUri : undefined;
35+
}
36+
}

src/manifest.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
export const PACKAGE_NAME = 'vscode-cmsis-debugger';
17+
export const PUBLISHER_NAME = 'arm';
18+
export const EXTENSION_NAME = 'vscode-cmsis-debugger';
19+
export const EXTENSION_ID = `${PUBLISHER_NAME}.${EXTENSION_NAME}`;
1820
export const DISPLAY_NAME = 'Arm CMSIS Debugger';

0 commit comments

Comments
 (0)