-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Delve isn't able to find any of my source files, so it doesn't stop at any breakpoints #2795
Comments
Any symlinks in the path of main.go? cc @polinasok |
Yes, one directory in the path is a symlink to another directory on the VM, and perhaps unrelated, that path is within a VirtualBox shared folder path, so the actual files reside on the Windows host (I run Ubuntu on a VirtualBox VM on a Windows 10 host). |
It is likely that go is resolving those symlinks while compiling and the executable contains the real path of the files rather than what vscode thinks is the path. There is a substitute path option in launch.json for this. |
I'd appreciate a little more information. How exactly do I resolve this? Whether I can resolve it or not with this "substitute path" option you refer to, it does seem like this would be considered a bug. Are you saying that this is something that Go is doing, and not delve or vscode-go? |
Ok. I found: Ok, so "/home/dk068x/git" is a symlink to a different path. Now I have to figure out the syntax of this property. I don't even see this property mentioned at https://code.visualstudio.com/docs/editor/debugging#_launch-configurations , nor do I see any mentions of it on a wider search. I tried this, which at least doesn't complain in the editor:
This fails at launch, saying "requires both 'from' and 'to' entries". |
The entry in your launch config should look like:
substitutePath is a go specific launch configuration so it does not appear in the general vscode documentation. |
Excellent. That worked. Note that I also don't see this mentioned at https://code.visualstudio.com/docs/languages/go . |
Please answer the following before submitting your issue:
Note: Please include any substantial examples (debug session output,
stacktraces, etc) as linked gists.
dlv version
)?1.7.1
go version
)?1.17.3
Linux Ubuntu/amd64
Using vscode with the vscode-go extension, I created a multimodule/multipackage/multifolder project (although still pretty small), where one module uses cgo. The project has no compile errors, and it starts up successfully, although it has operational issues in testing, which is simply issues with my application code.
I set a breakpoint on the first line of the main function, which is a print statement. When I start the debugger, I see the print statement in the console log, but it doesn't stop at the breakpoint. When the application starts, the breakpoint red circle changes to a hollow circle, and when I hover on that, it prints "could not find file /home/dk068x/git/voltagego/main.go". That path is valid, and the file does exist.
The start of the log shows this:
Note that I had worked on another application in vscode-go, and when I switch to that, even without bringing vscode down, and then run that in the debugger, it stops at breakpoints. That application is much simpler, being a single module.
For the debugger to stop at the breakpoint.
It didn't stop at the breakpoint.
The text was updated successfully, but these errors were encountered: