-
Notifications
You must be signed in to change notification settings - Fork 647
debug broken: vscode breakpoint set but not hit #1307
Comments
Here are you referring to the tools the Go extension depends on and downloads using
Are these paths where the file physically resides or is it a symlink? To go back to the old version, uninstall the Go extension and install it again from the marketplace. |
Thanks ramya, I am able to go back to the old version as per your help and my debugging is now working. I'll be out of town for a while and will get back to you for the rest when I'm back at the end of November. thx again. |
@suntong I have published an update to the Go extension. Once you are back from your vacation, we can look into why you are not able to debug using the latest update |
Hi @ramya-rao-a, the latest update of the Go extension is still unable to do debugging for me, with or without the GOPATH env variable in the launch.json file.
and I've just updated code to the latest version as well:
|
Oh, I was able to go back to the old version as per your help and my debugging was working before, but now, having uninstalled the Go extension and installed it again from the marketplace, I'm still unable to do debugging any more. :( |
@ramya-rao-a, I lost track what was working before, but would it be possible for me to go back to the Go extension version that has been working for me before please? |
You can always go back to the version you want by getting the vsix file from the Releases tab Find the release you want, there should be a vsix file that you can download. Also add the setting If you pass GOPATH from the launch.json it should definitely get picked up. Since I cannot repro your issue, I dont know where to begin with to fix the issue for you. If you are up for it when you have some time, then follow the steps at Building and Debugging the Go extension Then, add a breakpoint at https://github.com/Microsoft/vscode-go/blob/0.6.69/src/goDebugConfiguration.ts#L48. That's the debug config from the launch.json file. |
Thanks for the reply @ramya-rao-a, I thought it was my own problem so I tried it from an entirely different system, but I'm not able to debug there either. I reverted from Go-0.6.69.vsix, one by one, from Go-0.6.67.vsix all the way to Go-0.6.65.vsix, which need to set GOPATH, but am sill not able to debug any more. I think the latest VS Code no longer works with older go plugins. So, @ramya-rao-a, please try to download the code https://github.com/suntong/hello-world-go into /tmp/hello-world-go, and try debug there, would you be able to debug there? Thanks |
That's right. The older debug APIs were deprecated in VS Code 1.18. So debugging using older Go extensions in VS Code 1.18 is not possible.
And what should be the GOPATH in this case? Are you able to repro the issue without symlinks? Can you follow the steps in #1307 (comment) and see why the GOPATH from your launch.json is not getting passed? |
The thing is, the problem is not because of symlinks, it "fails regardless of the symlinks"
So, yes, I am able to repro the issue without symlinks. Trying it for yourself as above.
Whatever you defined in the environment variable, which should be picked up by vscode-go out of the box. I.e., it is unrelated to the GOPATH setting.
The GOPATH is fine and no longer an issue since #1203 (comment), and it was never a problem to me as "after adding the GOPATH as an env var in the env property in the launch.json file solved the problem" #1203 (comment) So please try it out as I proposed, and see what you get. Thanks. |
When I tried this using the default debug config from launch.json, the program ran successfully, but the breakpoints were not hit. Further, after adding Is this the same that you see? |
Oh, yeah, exactly! What you've described the two observations are exactly the same as what I'm getting. Two more things to add,
|
Yes, I had the same problem, breakpoints not getting hit, although I now it seems to be working. |
hello, we have same problem (my team) on Mac Os X, delve version: 1.0.0-rc.2, vscode version 1.18.1, i try with vscode-go with 0.0.66 and start working again, if i try never versions of vscode-go extension stop working |
@ramya-rao-a not really the same case, my code in $GOPATH but error was same. first error was "file not found" i downgrade, upgrade delve versions then error message changed to "unkown file" instead of "file not found", then i try different versions of vscode-go extension, now delve version 1.0.0-rc2 and vscode-go 0.0.66 and works like a charm |
@selam thanks for the update and clarification. (I tried Go-0.6.69.vsix, Go-0.6.67.vsix then Go-0.6.65.vsix, all not working. I.e., I skipped the working vscode-go 0.0.66 version, :-( ) @ramya-rao-a |
Now I am not able to repro!! Am using the same cloned repo, VS Code version, delve version and Go extension version as when I did get a repro as mentioned in #1307 (comment) @suntong @selam Can you tell me using Also, in the debug configuration that you are using, what is the value for |
I compared the debugging related code of the extension between the versions 0.6.66 and the latest 0.6.69. The only difference is the GOPATH being used by the debug process In 0.6.66:
In 0.6.69:
So based on this, here are my follow up questions:
|
Hi @ramya-rao-a, I'll answer your questions at the end of this message, but First of all, I changed the title to reflect the problem's external behavior instead of internal manifesting so end users who are looking for the answer know this is* the one that they are after. Now,
and see if you can duplicate the inconsistency of above behavior, which might give you a further clue. All that I'm saying is, try to go back to when debugging was failing for you. If you are absolutely sure there is nothing changed on your side, between then and now, then the inconsistency behavior is beyond everything that you are comparing. I.e., what you were looking at were not the cause -- it is something that you have not payed attention to that is causing such inconsistency. Just for an example, the differences between version of My advice, If you really can't think of anything that impact the debugging behavior, then don't touch your current environment, and start everything afresh. That's what I did:
I installed my Ubuntu 17.04 in a brand new VM, and installed everything that relate around the debugging afresh, i.e., to there latest version. Yet, the debugging is failing in that case. Please try this (start everything afresh), and if it works for you, please tell us exactly which the versions you are using for everything that relate around the debugging, and I can compare it to mine. Now, I don't think the following answer matters, but since you asked... |
Answering your questions,
What is the path of the main folder opened in VS Code?
|
@suntong First off, thanks for your patience
I am using Go 1.9.2 in Mac OS X Yosemite with delve 1.0.0-rc.1 installed via home-brew: No changes were made to these When debugging broke for me as described in #1307 (comment), I don't recall if I was using the VS Code 1.18.1 or 1.19-Insiders When I couldn't get a repro yesterday as I mentioned in #1307 (comment), I don't recall if I was using VS Code 1.18.1 or 1.19-Insiders Right now, debugging is broken for me (when using /tmp) in my Mac OS OX VS Code 1.18.1 but not in 1.19-Insiders.
From your answers to my questions, I really can't think of any changes made post 0.6.66 that can impact debugging. I started fresh and I still cannot repro the issue. Here are my steps:
|
So summary from previous comment is that I can repro the issue only when code is under /tmp (other places are fine) and when using VS Code 1.18.1 (Insiders is fine) with latest Go extension on my Mac OS X (Ubuntu 14.04 in parallel is fine) Can you try on VS Code Insiders? You can get it from https://code.visualstudio.com/insiders |
Thanks for the swift update, and detailed steps in how to get things going the proper way, which is most valuable to me. I'll find some time to try the VS Code Insiders, and the detailed steps you outlined above, then get back to you... |
Also, no issues in Windows either |
I get it working @ramya-rao-a!!! Thanks a lot for your detailed steps, without which I'll surely be lost along the path. Although, I wasn't able to make it work at first no matter what, when I was opening/using my code from my I'm so happy now. Thanks again! |
hmm, never used gophers slack before, any url that I can ready about how to use it? |
You can join at https://invite.slack.golangbridge.org. You can look for "Ramya Rao" there. |
Joined. I tried at my side -- no matter how I start In all cases where breakpoint was not hit, the log for debugger.go:97: launching process with args: had the correct path where my code is. Same for the working one under
|
Again, where does vscode cache its settings? as whenever I open my code from |
@ramya-rao-a, is your I think I've found the real cause why
So what the difference between
Here is proof: cd /tmp
# -- that's where my *working* code (/tmp/hw-go/) is. Change to yours (above, and below for `../hw-go/`)
mkdir d1
ln -s d1 d2
cd d2
cp -a ../hw-go/ hwg3
cd hwg3/
code `pwd` & After this, break-point is not working any more, despite being under Now watch: :/tmp/d2/hwg3$ realpath .
/tmp/d1/hwg3
cd /tmp/d1/hwg3
code `pwd` & It works again. So, this is proof (to me) that, if there are any symlinks somewhere alone the path, vscode break-point will no longer works. |
I upgraded to 1.22.0, now it says the the breakpoint is ignored because generated code not found(source map problem?). BTW, I am writing angular 2 code. |
@denismp This is the extension for Golang, please log your issues with angular code in either the extension you use for angular or in the main vscode repo |
any update on this ? I still get |
any update on this @ramya-rao-a ? Error on CreateBreakpoint: could not find /Users/rbanerjee/go/src/github.xyz.corp/lumen/project/resolver.go:33 debug config: |
any news on this issue ? still cant debug |
I have a similar problem and by trial and error I found out that this might indeed be caused by symlinks. In my case, I have a symlink in GOPATH that points to sources that are checked out somewhere else. Whenever I place breakpoint to a symbol in a package within this path containing symlink, it will appear as unverified breakpoint in VSCode. This is the setup:
If I remove the symlink and move the sources into GOPATH, the problem disappears. JFTR, setting the breakpoints via Delve works even with the symlink. |
Thanks a lot Jan @fcelda, for going a long way proving it. and Yes, I found Delve works even with the symlink too. So @ramya-rao-a, it is now a confirmed case, with confirmed reason, I believe. |
Hi, I don't know what is the problem This is just an example taken from y debug console (trace: verbose is set) Verbose logs are written to:
/tmp/vscode-go-debug.txt
3:06:47 PM, 6/24/2018
InitializeRequest
InitializeResponse
Using GOPATH: /home/arkan/go
Running: /home/arkan/go/bin/dlv debug --headless=true --listen=127.0.0.1:2345 --log=true --
time="2018-06-24T15:06:47+03:00" level=info msg="launching process with args: [/tmp/delve-crash/app/debug]" layer=debugger |
That's very frustrating indeed. |
@RajatBanerjee Sorry for not replying sooner, somehow the notification for this issue got lost in a sea of other notifications. Do you use symlinks as well? @arkanmgerges Looking at the logs you posted, your issue seems to be different from the one being discussed here and more likely related to #1752 which in turn was due to an upstream change in delve. @fcelda Thanks for confirming that there are no issues when there are no symlinks
Please understand that I am the sole maintainer of this open source project and its not my full time job. So when there is an issue that I cannot repro even after all my efforts thats clearly documented above, there is nothing else I can do other than do a live debugging session via slack or other means. Which I did offer, and I didnt hear from you on slack or gitter. The offer still stands for you and the others on this thread, though not for the coming week as I am out on vacation. Also, I refuse to accept the claim that this is affecting everyone. This issue is very specific to users who use symlinks as you have already concluded. The angular issue could be due to a variety of unrelated reasons which is best resolved by logging an issue in the VS Code repo. And we dont know if @denismp has already done so and gotten the issue resolved. So please dont equate the two. |
@ramya-rao-a, thanks for the clarification. My point is, it might most likely not your code problem at all. Ref again the angular 2 code that @denismp's writing. I.e., the fault resides beyond the scope of vscode-go. |
Take a look at this simple program. If you put a breakpoint on the lines that I've commented below as NEVER HIT. Delve never hits. However, when you put it to the other lines as commented as HITS, then it hits those lines. You may having a problem like this. Let you know... package main // NEVER HITS
// NEVER HITS
import ( // NEVER HITS
"fmt" // NEVER HITS
) // NEVER HITS
// NEVER HITS
func main() { // HITS
var ( // NEVER HITS
sum int // HITS
i = 1 // HITS
) // NEVER HITS
// NEVER HITS
fmt.Println(sum, i) // HITS
} |
ramya-rao-a:- |
@ravirakesh You are attempting to do remote debugging, please log a separate issue for that. In the new issue, provide the debug configuration using. Also add |
@ramya-rao-a
|
@ravidborse I have created a new issue to track the problem you are seeing. Please see #2318 All, I am closing this issue as concluded in If anyone sees this issue when using symlinks, feel free to ping me on the Gophers Slack channel and I can help you debug using the source code of this extension as I am not able to repro this. |
Using the
Go-latest.vsix
as instructed at#1203 (comment)
has caused my debugging not working any more -- I'm setting the break point at the first line in my main, but this is the only thing that I get (in the debug console):
I.e., no break points works, and I simply cannot debug any more. Not using this Go-latest at least I can still do debugging. Is there any way I can go back?
Once again, all my own code are not under GOPATH, as I want to distinct my own code from those I get from
go get
. That was the reasonvscode-go
was confused about GOPATH before and it might still be the reason that my debugging is not working, because after carefully examine the debug console log, I saw:However, under my normal file system, the files are just fine. E.g., both
ls /path/to/repo/gitwork/src/github.com/suntong/dnstools/dnstools_main.go
andfile /path/to/repo/gitwork/src/github.com/suntong/dnstools/dnstools_main.go
works just fine.The text was updated successfully, but these errors were encountered: