-
Notifications
You must be signed in to change notification settings - Fork 646
Function calls in conditional breakpoints not supported #1803
Comments
Please provide a small sample code along with the location where you tried to add the conditional breakpoint. |
package main
import (
"fmt"
"strings"
)
func main() {
list := [3]string{"1", "2", "3"}
for _,num := range list {
if strings.EqualFold("2", num){
fmt.Println(num) <=========== cond bp: `strings.EqualFold(num,"2")`
}
}
} OUTPUT:
Breakpoint has an VSCode: |
^ I confirmed that this toy example does work in GoLand. Just FYI |
There are 2 issues here:
I will look into the second issue first |
I debugged the debug adapter and found out that this is actually a limitation of delve: https://github.com/derekparker/delve/blob/2a2d1040e9b85e069c101bf9916d333e9e3cf54d/pkg/proc/eval.go#L373-L403 I don't have Goland to compare but my guess is that they're either using another debugger or a fork/built-in solution |
@lggomez thank you for digging into this! It is good to know it does work for the example you gave as I can use that (as I do ❤️ vscode and was sad it wasn't working). You can try Goland for free as a trial I believe? That is interesting that they are using a delve fork. Hmmm. Anyway thanks again! |
Maybe vscode-go could give a different error message to let the user know they can't use functions in conditional breakpoints? |
Okay so my test was flawed. My greatest apologies to both of you 😞 I re-ran this func: package main
import (
"fmt"
)
func main() {
list := [3]string{"1", "2", "3"}
for _, num := range list {
// if strings.EqualFold("2", num){
fmt.Println(num) <=============== COND BP: strings.EqualFold("2", num)
// }
}
} And it stopped in GoLand.... ON num=="1" !?!?! 😡 So cond breakpoints just "fail open" on GoLand where they "fail closed" on vscode. Universe makes sense again and vscode is once again the one true editor!!! 🙏 |
I might be cool if vscode would say:
|
@blacktop I sent a PR to make the logs more clear: #1815 Goland is a completely different beast: IntelliJ (the core IDE) has its AST engine, so they have implemented their own Go lexer/parser in order to make the most of it, and that's how the IDE refactorings look so seamless and assorted in comparison I bet they use delve as the debug backend, and they may attempt to extract the function calls to a shadow variable in order to support this scenario. I'm just speculating though, their current implementation is closed source |
Running latest everything on Mac
cond bkpt:
strings.EqualFold("pdf", plugin.name)
Failed to continue.
Steps to Reproduce:
The text was updated successfully, but these errors were encountered: