Skip to content

Commit

Permalink
Merge branch 'main' into dev/gcampbell/LocRunProfiles
Browse files Browse the repository at this point in the history
  • Loading branch information
gcampbell-msft authored Jan 17, 2025
2 parents 35f4485 + a892412 commit 8573634
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ Bug Fixes:
- Fix parsing of CMakeUserPresets.json containing configure preset that is referenced in workflow preset. [#4202](https://github.com/microsoft/vscode-cmake-tools/pull/4202)
- Fix auto select active project corner case. [#4146](https://github.com/microsoft/vscode-cmake-tools/issues/4146) Contributed by STMicroelectronics
- Localize our test run profiles. [#4236](https://github.com/microsoft/vscode-cmake-tools/issues/4236)
- Fix issue where starting a CMake Configure with CMake Debugger while there was already a configure process running left a debug session going without a way to stop it. [#4230](https://github.com/microsoft/vscode-cmake-tools/issues/4230)

## 1.19.52

Expand Down
9 changes: 8 additions & 1 deletion src/cmakeProject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1639,11 +1639,14 @@ export class CMakeProject {
}
await this.cTestController.refreshTests(drv);
this.onReconfiguredEmitter.fire();
debuggerInformation?.debuggerStoppedDueToPreconditions(localize('no.debug.configured.with.cache', "Configured CMake with cache. CMake debugger is not supported with cache."));
return result;
}

if (trigger === ConfigureTrigger.configureWithCache) {
log.debug(localize('no.cache.available', 'Unable to configure with existing cache'));
const message = localize('no.cache.available', 'Unable to configure with existing cache');
log.debug(message);
debuggerInformation?.debuggerStoppedDueToPreconditions(message);
return { result: -1, resultType: ConfigureResultType.NoCache };
}

Expand Down Expand Up @@ -1760,6 +1763,8 @@ export class CMakeProject {
}
}
});
} else if (result.result !== 0) {
debuggerInformation?.debuggerStoppedDueToPreconditions(localize("no.configure.with.debug.due.to.preconditions", "Cannot configure with CMake debugger due to: \"{0}\"", ConfigureResultType[result.resultType]));
}

await this.cTestController.refreshTests(drv);
Expand All @@ -1772,12 +1777,14 @@ export class CMakeProject {
}
} else {
progress.report({ message: localize('configure.failed', 'Failed to configure project') });
debuggerInformation?.debuggerStoppedDueToPreconditions(localize('no.driver.available.no.debug', 'Cannot configure with CMake debugger due to no CMake driver being available.'));
return { result: -1, resultType: ConfigureResultType.NormalOperation };
}
});
} catch (e: any) {
const error = e as Error;
progress.report({ message: error.message });
debuggerInformation?.debuggerStoppedDueToPreconditions(localize('no.debug.configured.due.to.error', 'Cannot configure with CMake debugger due to error: {0}', error.message));
return { result: -1, resultType: ConfigureResultType.NormalOperation };
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@ export class DebugAdapterNamedPipeServerDescriptorFactory implements vscode.Debu
const debuggerInformation: DebuggerInformation = {
pipeName,
dapLog: session.configuration.dapLog,
debuggerIsReady: () => undefined
debuggerIsReady: () => undefined,
debuggerStoppedDueToPreconditions: (message: string) => {
throw new Error(message);
}
};

const cmakeDebugType: "configure" | "script" | "external" = session.configuration.cmakeDebugType;
Expand All @@ -33,6 +36,10 @@ export class DebugAdapterNamedPipeServerDescriptorFactory implements vscode.Debu
debuggerInformation.debuggerIsReady = resolve;
});

const stoppedPromise = new Promise<string>((_resolve, reject) => {
debuggerInformation.debuggerStoppedDueToPreconditions = reject;
});

if (cmakeDebugType === "script") {
const script = session.configuration.scriptPath;
if (!fs.existsSync(script)) {
Expand Down Expand Up @@ -76,7 +83,11 @@ export class DebugAdapterNamedPipeServerDescriptorFactory implements vscode.Debu
}
}

await promise;
try {
await Promise.race([promise, stoppedPromise]);
} catch (e: any) {
throw e;
}
} else if (cmakeDebugType === "external") {
logCMakeDebuggerTelemetry(origin, cmakeDebugType);
}
Expand Down
1 change: 1 addition & 0 deletions src/debug/cmakeDebugger/debuggerConfigureDriver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export interface DebuggerInformation {
pipeName: string;
dapLog?: string;
debuggerIsReady(): void;
debuggerStoppedDueToPreconditions(message: string): void;
}

export function getDebuggerPipeName(): string {
Expand Down

0 comments on commit 8573634

Please sign in to comment.