diff options
Diffstat (limited to 'editors/code/src/debug.ts')
-rw-r--r-- | editors/code/src/debug.ts | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/editors/code/src/debug.ts b/editors/code/src/debug.ts index 3889a2773..830980f96 100644 --- a/editors/code/src/debug.ts +++ b/editors/code/src/debug.ts | |||
@@ -3,7 +3,7 @@ import * as vscode from 'vscode'; | |||
3 | import * as path from 'path'; | 3 | import * as path from 'path'; |
4 | import * as ra from './lsp_ext'; | 4 | import * as ra from './lsp_ext'; |
5 | 5 | ||
6 | import { Cargo } from './toolchain'; | 6 | import { Cargo, getRustcId, getSysroot } from './toolchain'; |
7 | import { Ctx } from "./ctx"; | 7 | import { Ctx } from "./ctx"; |
8 | import { prepareEnv } from "./run"; | 8 | import { prepareEnv } from "./run"; |
9 | 9 | ||
@@ -104,7 +104,17 @@ async function getDebugConfiguration(ctx: Ctx, runnable: ra.Runnable): Promise<v | |||
104 | 104 | ||
105 | const executable = await getDebugExecutable(runnable); | 105 | const executable = await getDebugExecutable(runnable); |
106 | const env = prepareEnv(runnable, ctx.config.runnableEnv); | 106 | const env = prepareEnv(runnable, ctx.config.runnableEnv); |
107 | const debugConfig = knownEngines[debugEngine.id](runnable, simplifyPath(executable), env, debugOptions.sourceFileMap); | 107 | let sourceFileMap = debugOptions.sourceFileMap; |
108 | if (sourceFileMap === "auto") { | ||
109 | // let's try to use the default toolchain | ||
110 | const commitHash = await getRustcId(wsFolder); | ||
111 | const sysroot = await getSysroot(wsFolder); | ||
112 | const rustlib = path.normalize(sysroot + "/lib/rustlib/src/rust"); | ||
113 | sourceFileMap = {}; | ||
114 | sourceFileMap[`/rustc/${commitHash}/`] = rustlib; | ||
115 | } | ||
116 | |||
117 | const debugConfig = knownEngines[debugEngine.id](runnable, simplifyPath(executable), env, sourceFileMap); | ||
108 | if (debugConfig.type in debugOptions.engineSettings) { | 118 | if (debugConfig.type in debugOptions.engineSettings) { |
109 | const settingsMap = (debugOptions.engineSettings as any)[debugConfig.type]; | 119 | const settingsMap = (debugOptions.engineSettings as any)[debugConfig.type]; |
110 | for (var key in settingsMap) { | 120 | for (var key in settingsMap) { |