Open Omustardo opened 1 month ago
I got this working, though it's a bit hacky: https://gist.github.com/Omustardo/ba21538445cbc9ff89ad43a4366f7382
$ ebiden_debug.sh go run .
Hello World!
File: /home/runner/work/cimgui-go/cimgui-go/cimgui/imgui/imgui_widgets.cpp, Line: 7597
exit status 1
Line 7597 from imgui_widgets.cpp:
IM_ASSERT(window->Flags & ImGuiWindowFlags_Popup); // Mismatched BeginMenu()/EndMenu() calls
The script works by extracting the line number from the error message and then retrieving the line from that file on github. Like: https://raw.githubusercontent.com/gabstv/cimgui-go/main/cimgui/imgui/imgui_widgets.cpp
This would be better if it used the local versions of those files, but I'm not quite sure where they are. Somewhere in GOPATH I'm sure.
For crashes, it would be great if it showed the original error message rather than the original line number. So instead of:
pointing to https://github.com/gabstv/cimgui-go/blob/main/cimgui/imgui/imgui.cpp#L9932
It would instead give the error:
Mismatched Begin/BeginChild vs End/EndChild calls: did you forget to call End/EndChild?
or even the full line:IM_ASSERT_USER_ERROR(g.CurrentWindowStack.Size == 1, "Mismatched Begin/BeginChild vs End/EndChild calls: did you forget to call End/EndChild?");
I'm not familiar with cgo so I'm not sure how feasible it is, but it would definitely save a lot of time when debugging.