imgui-go icon indicating copy to clipboard operation
imgui-go copied to clipboard

Debbuger gets stuck on C.glfwCreateWindow() when imgui is imported.

Open MaartenBehn opened this issue 3 years ago • 5 comments

What did I do: I am using the GoLand IDE and am working on an implementation of imgui with GLFW and OpenGL 3. I noticed that the Debbuger of GoLand gets stuck on the C.glfwCreateWindow() call. When I mean stuck I mean that the debugger is still connected, and the code still runs but it never leaves the function and I can not stop the debugger. This only occurs when the imgui-go package is loaded. I did try the imgui-go-examples code base to verify my suspicion, and here the same problem occurs. To clarify the code runs completely fine without a debugger. I also tried the go-delve debugger with the same result. I know that this issue is probably a real pain in the ass because the problem doesn't occur in your codebase, but you are the one how is causing it. ( The debugger runs fine without imgui. )

My go env: C:\WINDOWS\system32>go env set GO111MODULE= set GOARCH=amd64 set GOBIN= set GOCACHE=C:\Users\maart\AppData\Local\go-build set GOENV=C:\Users\maart\AppData\Roaming\go\env set GOEXE=.exe set GOFLAGS= set GOHOSTARCH=amd64 set GOHOSTOS=windows set GOINSECURE= set GOMODCACHE=D:\dev\Go\pkg\mod set GONOPROXY= set GONOSUMDB= set GOOS=windows set GOPATH=D:\dev\Go set GOPRIVATE= set GOPROXY=https://proxy.golang.org,direct set GOROOT=C:\Program Files\Go set GOSUMDB=sum.golang.org set GOTMPDIR= set GOTOOLDIR=C:\Program Files\Go\pkg\tool\windows_amd64 set GOVCS= set GOVERSION=go1.16.2 set GCCGO=gccgo set AR=ar set CC=gcc set CXX=g++ set CGO_ENABLED=1 set GOMOD=NUL set CGO_CFLAGS=-g -O2 set CGO_CPPFLAGS= set CGO_CXXFLAGS=-g -O2 set CGO_FFLAGS=-g -O2 set CGO_LDFLAGS=-g -O2 set PKG_CONFIG=pkg-config set GOGCCFLAGS=-m64 -mthreads -fmessage-length=0 -fdebug-prefix-map=C:\Users\maart\AppData\Local\Temp\go-build3689850690=/tmp/go-build -gno-record-gcc-switches

I hope you can help me because would really like to continue using the debugger.

MaartenBehn avatar Mar 28 '21 11:03 MaartenBehn

This sounds tricky. I just cross-checked it: imgui-go-examples running GoLand and go 1.16 . I can set a breakpoint at glfw.CreateWindow(), which gets hit, and I can step over it as well as continue.

When you write

I noticed that the Debbuger of GoLand gets stuck on the C.glfwCreateWindow() call.

what do you mean?

  1. Did you have a breakpoint before that, tried to step across the call to glfw.CreateWindow() - or how do you see the debugger "gets stuck"?
  2. What happens if you set a breakpoint after the call to glfw.CreateWindow()?
  3. Do you mean specifically the C.glfwCreateWindow() call, which is within glfw.CreateWindow()?

The only reason for weirdness I know can happen is when the call to runtime.LockOSThread() is missing. Though this will not be the case, you wrote you tested it with the examples project as well.

If all fails, try a complete rebuild of the project, including dependencies.

dertseha avatar Mar 29 '21 15:03 dertseha

I can run my code without problems till the C.glfwCreateWindow() call inside glfw.CreateWindow(), but the debugger never exists that call back into the Go code.

MaartenBehn avatar Mar 30 '21 15:03 MaartenBehn

I'm sorry, I don't know how to address this, furthermore I can't reproduce this. Flagging the issue with "help wanted".

dertseha avatar Mar 30 '21 17:03 dertseha

It's fine thank you

MaartenBehn avatar Apr 01 '21 17:04 MaartenBehn

Some further notes I found out the bug occurs only with the GLFW on windows. SDL and GLFW on linux works fine.

MaartenBehn avatar Apr 03 '21 10:04 MaartenBehn

I have to consider this as a one-off error. No other known reports or comments, closing it down.

dertseha avatar Sep 22 '22 17:09 dertseha