Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to map Rust stdlib sources when debugging in Windows #18782

Open
inflation opened this issue Dec 29, 2024 · 1 comment
Open

Failed to map Rust stdlib sources when debugging in Windows #18782

inflation opened this issue Dec 29, 2024 · 1 comment
Labels
C-bug Category: bug

Comments

@inflation
Copy link

inflation commented Dec 29, 2024

rust-analyzer version: (eg. output of "rust-analyzer: Show RA Version" command, accessible in VSCode via Ctrl/⌘+Shift+P)

rust-analyzer version: 0.3.2228-standalone (fa4a40bbe8 2024-12-22)

rustc version: (eg. output of rustc -V)

rustc 1.83.0 (90b35a623 2024-11-26)

editor or extension: (eg. VSCode, Vim, Emacs, etc. For VSCode users, specify your extension version; for users of other editors, provide the distribution if applicable)

vscode 0.3.2228

relevant settings: (eg. client settings, or environment variables like CARGO, RUSTC, RUSTUP_HOME or CARGO_HOME)

repository link (if public, optional): (eg. rust-analyzer)

code snippet to reproduce:

// add your code here

When debugging anything on Windows using cppvspkg, the sourceMap output in Debug console failed to map to rust src:

  "sourceFileMap": {
    "D:\\packages\\rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\src\\rust": "D:\\packages\\rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\src\\rust"
  },

It should be

      "sourceFileMap": {
        "\\rustc\\90b35a6239c3d8bdabc530a6a0816f7ff89a0aaf\\": "D:\\packages\\rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\src\\rust\\"
      }

Manually setting it in launch.json works fine.

@inflation inflation added the C-bug Category: bug label Dec 29, 2024
@Veykril
Copy link
Member

Veykril commented Dec 29, 2024

relevant code is here

if (sourceFileMap === "auto") {
sourceFileMap = {};
const computedSourceFileMap = await discoverSourceFileMap(env, wsFolder);
if (computedSourceFileMap) {
// lldb-dap requires passing the source map as an array of two element arrays.
// the two element array contains a source and destination pathname.
// TODO: remove lldb-dap-specific post-processing once
// https://github.com/llvm/llvm-project/pull/106919/ is released in the extension.
if (provider.type === "lldb-dap") {
provider.additional["sourceMap"] = [
[computedSourceFileMap?.source, computedSourceFileMap?.destination],
];
} else {
sourceFileMap[computedSourceFileMap.source] = computedSourceFileMap.destination;
}
}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: bug
Projects
None yet
Development

No branches or pull requests

2 participants