Skip to content
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

Show original C error messages #22

Open
Omustardo opened this issue Aug 14, 2024 · 1 comment
Open

Show original C error messages #22

Omustardo opened this issue Aug 14, 2024 · 1 comment

Comments

@Omustardo
Copy link

For crashes, it would be great if it showed the original error message rather than the original line number. So instead of:

File: /home/runner/work/cimgui-go/cimgui-go/cimgui/imgui/imgui.cpp, Line: 9932
exit status 1

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.

@Omustardo
Copy link
Author

Omustardo commented Aug 14, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant