microsoft / microsoft/vscode-cpptools

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

Offen
#5,361 11 Kommentare 5 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

debugger Feature Request more votes needed
Vorherrschende Sprache
TypeScript
Sterne
6.2k
Forks
1.7k
Ø Merge
14 Std. 46 Min.
Gemergte PRs (30 T.)
61

Beschreibung

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.

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginne damit, die Eingabeaufforderung für die fehlende Quelle aus launch.json zu reproduzieren, während du in Code hineinsteppst, der an einem anderen Pfad erstellt wurde. Untersuche, wie der Debugger mit nicht aufgelösten Quelldateien und dem Speicherort des Arbeitsbereichs umgeht; es werden keine Implementierungsdateien oder Tests genannt. Fertig ist die Aufgabe, wenn ein Benutzer den lokalen Quellspeicherort auswählen und mit dem Hineinsteppen fortfahren kann.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
cpp, typescript
Bereich
devtools
Issue-Typ
Feature
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.