Skip to content

Commit 1d43fec

Browse files
fix conda debugger
1 parent 499ed9f commit 1d43fec

File tree

2 files changed

+17
-7
lines changed

2 files changed

+17
-7
lines changed

extension/debug/debug.ts

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -126,12 +126,15 @@ class MojoDebugAdapterDescriptorFactory
126126
}
127127
this.logger.info(`Using the SDK ${sdk.version} for the debug session`);
128128

129-
return new vscode.DebugAdapterExecutable(sdk.dapPath, [
130-
'--repl-mode',
131-
'variable',
132-
'--pre-init-command',
133-
`?!plugin load '${sdk.lldbPluginPath}'`,
134-
]);
129+
this.logger.debug('env', sdk.getProcessEnv());
130+
131+
return new vscode.DebugAdapterExecutable(
132+
sdk.dapPath,
133+
['--repl-mode', 'variable'],
134+
{
135+
env: sdk.getProcessEnv(),
136+
},
137+
);
135138
}
136139
}
137140

@@ -264,6 +267,7 @@ class MojoDebugConfigurationResolver
264267

265268
// This setting shortens the length of address strings.
266269
const initCommands = [
270+
`?!plugin load '${sdk.lldbPluginPath}'`,
267271
'?settings set target.show-hex-variable-values-with-leading-zeroes false',
268272
// FIXME(#23274): remove this when we properly emit the opt flag.
269273
'?settings set target.process.optimization-warnings false',

extension/pyenv.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ class HomeSDK extends SDK {
115115
mojoPath: string,
116116
visualizersPath: string,
117117
lldbPath: string,
118+
private prefixPath?: string,
118119
) {
119120
super(
120121
logger,
@@ -132,8 +133,10 @@ class HomeSDK extends SDK {
132133

133134
public override getProcessEnv(withTelemetry: boolean = true) {
134135
return {
136+
...super.getProcessEnv(withTelemetry),
135137
MODULAR_HOME: this.homePath,
136-
MODULAR_TELEMETRY_ENABLED: withTelemetry ? 'true' : 'false',
138+
// HACK: Set CONDA_PREFIX to allow debugger wrappers to work
139+
CONDA_PREFIX: this.prefixPath,
137140
};
138141
}
139142
}
@@ -214,6 +217,7 @@ export class PythonEnvironmentManager extends DisposableContext {
214217
return this.createSDKFromHomePath(
215218
SDKKind.Environment,
216219
path.join(env.executable.sysPrefix, 'share', 'max'),
220+
env.executable.sysPrefix,
217221
);
218222
} else {
219223
this.logger.info(
@@ -315,6 +319,7 @@ export class PythonEnvironmentManager extends DisposableContext {
315319
public async createSDKFromHomePath(
316320
kind: SDKKind,
317321
homePath: string,
322+
prefixPath?: string,
318323
): Promise<SDK | undefined> {
319324
const modularCfgPath = path.join(homePath, 'modular.cfg');
320325
const decoder = new TextDecoder();
@@ -372,6 +377,7 @@ export class PythonEnvironmentManager extends DisposableContext {
372377
config['mojo-max']['driver_path'],
373378
config['mojo-max']['lldb_visualizers_path'],
374379
config['mojo-max']['lldb_path'],
380+
prefixPath,
375381
);
376382
} catch (e) {
377383
await this.displaySDKError(

0 commit comments

Comments
 (0)