microsoft / microsoft/vscode-cpptools

Allow user to specify file location when prompted "Error: Unable to resolve non-existing file"

Open
#5,361 11 comments 5 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

debugger Feature Request more votes needed
Dominant language
TypeScript
Stars
6.2k
Forks
1.7k
Avg merge
14h 46m
Merged PRs (30d)
61

Description

Type: Debugger

Describe the bug

  • OS and Version: Windows 10
  • VS Code Version: 1.43.2
  • C/C++ Extension Version: 0.27.0

I am using VS Code to debug a C++ compiled .exe. I can configure a launch.json that successfully launches my .exe. However when I attempt to step into a function I get the following error:

`Unable to open 'thing.cpp'. Unable to read file 'c:\foo\bar\baz'. (Error: Unable to resolve non-existing file 'c:\foo\bar\baz'.

This makes sense. The file does not exist at 'c:\foo\bar\baz' because it was produced by a caching build system. However the file does exist on my hard drive in another location.

In Visual Studio I get a similar prompt. Except Visual Studio lets me specify the file location. This lets me successfully step-into and debug my code. Unfortunately VS Code does not give me this option. The file exists in my VS Code workspace which makes it particularly frustrating.

My feature request: when debugging fails to read the file allow the user to specify the file's location. If a file with the correct filename and similar path offer to open that file automatically.

To Reproduce
Here is a guess at some minimum work.

Clone a C++ repo onto one machine in a location of your choice. Copy the .exe to a different machine that has cloned the same repo into a different location. Configure launch.json to launch your exe. Try to step into some code. It should fail with an error that the file doesn't exist at a specific location. Even though the file does exist on your machine and, ideally, VS Code workspace.

Additional context
In my particular use case I have an .exe and many DLLs. We use a caching build system (Buck) so the DLLs were compiled on a build machine with completely different folder structure. Even though the code used to compile that DLL exists on my machine.

Creating a minimum-repro project for this would take a little work. If that would be useful I can do it. But I think the problem/missing feature here is pretty obvious so I'm not sure it would be worth the effort.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the missing-source prompt from launch.json while stepping into code built at a different path. Inspect the debugger's handling of unresolved source files and the workspace location; no implementation files or tests are named. Done when a user can choose the local source location and continue stepping into it.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, typescript
Domain
devtools
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.