-
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
What should we do if a linespec does not resolve to any instruction #840
Comments
These are the instructions produced for that main function:
Nothing is produced for line 17, the reason this happens is that TableModel is a zero sized struct and no work is required to initialize it. It doesn't have anything to do with |
Hmm, I understand this but I'd rather see as an upstream problem. As for maybe stopping the debugger on the following line it would be a good thing? I got surprised the first time the debugger didn't stopped at all and this is part of a bigger code, reproduced in smaller scale for example sake. Thank you for your time and help. |
Of course. OTOH if you try to set a breakpoint on an empty line, a comment or a close brace you would expect the debugger to complain (or maybe to set the breakpoint on the next available line?). |
As far as I can tell, running
Thank you. |
Judging by the PCDATA/FUNCDATA stuff, I think that's actually printing go's intermediate representation rather than assembly. I imagine NOPs get compiled into nothing. BTW tip doesn't emit them in the intermediate representation either. |
That being the case, what would it take for getting the NOP to be compiled in? This use case is probably important enough that a switch could be added for it. 😉 Hmmm, is this something which should be opened upstream instead? 😄 |
I've opened up golang/go#20487 as a follow-up. Regarding the suggestion to stop on the next closest line, I guess that could work meanwhile, even if the users will be a bit more confused? |
If the user is trying to set a breakpoint on a line that contains only a comment (or whatever) then they are already confused... if it was me I'd want a breakpoint set. Is it better to set a breakpoint and emit a warning or only emit an error. (It seems to me a lot of folks don't read the normal messages, and so would easily miss any error or warning, unless it be colourised!) |
Hmmm, there's also the situation where the user deletes a few lines of existing code with a breakpoint in it somewhere. Some IDE's might still leave the breakpoint at the same line number, which could be non-code after the delete. Whether or not that's good behaviour on the IDE's part I guess would depend on the IDE's general way of doing things. 😄 |
We didn't change anything and this issue hasn't really received any attention in the past 7 years. Our current behavior is probably fine. |
dlv version
)?derekparker/delve@82d142d
go version
)?go 1.8.1
Windows 10 / amd64
demo.go
I would expect to have a breakpoint on that line and the debugger to stop on it.
The text was updated successfully, but these errors were encountered: