-
-
Notifications
You must be signed in to change notification settings - Fork 99
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
Debugging "assertion failed" #86
Comments
The imgui_config.h file can be used to configure a custom assertion, which could be used to create a callback to throw an exception with the assertion error. It would require this project to overwrite that particular file. If I get some free time I can look at getting something put together. @SpaiR any thoughts on this approach? Edit: to clarify, this particular feature would be very useful to me for capturing assertion errors to a log file. Edit 2: I just got off an hour and a half flight, made some headway into this. Doable, but I need to confirm the call stack from java is still in place when the native callback triggers the java exception. I think it should be, but I need to test. |
@tlf30 |
Just as a status update on this, I have an implementation that works. The stack is preserved on the callback from the native code, so it does pinpoint where the assertion failed in the user java code (which is amazing). |
Initial implementation ready #100. Please let me know what you think. |
I have been getting various assertion errors that look like this
The issue is, I'm not sure how to debug these errors. My application is getting kinda large so it's not 100% viable to put print statements everywhere (edit: though maybe breakpoints could work i honestly havent tried). I can't get other debugging features to work. Since the JVM freezes for a few seconds before closing when an assertion error happens, I'm not able to generate a thread dump afterwards, IntelliJ's debugger and VisualVM aren't able to retrieve any data from the JVM after an "assertion failed" error happens for the same reason.
I'm not 100% sure how it works, but wouldn't it be possible to throw a "ImException" when an assertion error happens? That would give a useful stacktrace. For example, how OpenCV does it:
It throws a Java exception with a useful stack trace when assertion errors happen, I'm not 100% sure if this would be a good and viable idea, neither how that works in the native side (haven't worked much with JNI) but if there is any possibility making it I'd look forward to it!
The text was updated successfully, but these errors were encountered: