-
-
Notifications
You must be signed in to change notification settings - Fork 21.3k
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
[Windows] Enable crash reporter on MinGW builds. #61006
Conversation
2580cb1
to
e04f77d
Compare
Updated to work with enabled ASLR. |
Testing. We have a crash bug, so would be interested to see the result. I do wonder if we can get the gdscript trace too. |
I wasn't able to test.
|
Probably it needs |
|
Would we benefit from using libbacktrace on Linux too? Notably, can this help improve the Linux crash handler so we don't have it relying on This would need to be rebased after the |
Maybe, I have not tested it on Linux, but it should be supported. |
I ran out of time to review this properly for 4.0, so moving to 4.1. In general, I'd like to make it a goal either for 4.1 or a subsequent release to ensure we have top notch crash reporting for all platforms (including access to debug symbols databases, etc.). |
@akien-mga gentle nudge for Godot Engine version 4.2 |
Doesn't look like it's going to happen for 4.2, but I'm poking Akien to remind him about this. |
@@ -35,12 +35,15 @@ | |||
#include <windows.h> | |||
|
|||
// Crash handler exception only enabled with MSVC | |||
#if defined(DEBUG_ENABLED) && defined(_MSC_VER) | |||
#if defined(DEBUG_ENABLED) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I noticed the Windows crash handler is disabled in release builds (also on macOS), but the Linux crash handler is available in release builds. This is needed to make #61906 effective in exported projects.
I suggest we always make the crash handler available in release builds, as release builds can be compiled with debug symbols enabled (or you can use a tool to reverse them if you have access to the debug symbols).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested locally (rebased on top of master
51991e2), it works as expected using a build made with MSYS2 MinGW-w64 on Windows 11 22H2.
ERROR: Crash button pressed
at: (core/core_bind.cpp:241)
================================================================
CrashHandlerException: Program crashed with signal 4
Engine version: Godot Engine v4.3.dev.custom_build (195a75d891df147c7aaa58e7319095d1322ae40c)
Dumping the backtrace. Please include this when reporting the bug to the project developer.
Image memory base: 0x7ff6d6db0000, image file base: 0x140000000
Dumping the backtrace. Please include this when reporting the bug to the project developer.
[1] _gnu_exception_handler (C:/M/B/src/mingw-w64/mingw-w64-crt/crt/crt_handler.c:232)
[2] core_bind::OS::crash(String const&) (core/core_bind.cpp:241)
[3] void call_with_validated_variant_args_helper<__UnexistingClass, String const&, 0ull>(__UnexistingClass*, void (__UnexistingClass::*)(String const&), Variant const**, IndexSequence<0ull>) (./core/variant/binder_common.h:365)
[4] void call_with_validated_object_instance_args<__UnexistingClass, String const&>(__UnexistingClass*, void (__UnexistingClass::*)(String const&), Variant const**) (./core/variant/binder_common.h:652)
[5] MethodBindT<String const&>::validated_call(Object*, Variant const**, Variant*) const (./core/object/method_bind.h:344)
[6] GDScriptFunction::call(GDScriptInstance*, Variant const**, int, Callable::CallError&, GDScriptFunction::CallState*) (modules/gdscript/gdscript_vm.cpp:2036)
[7] GDScriptInstance::callp(StringName const&, Variant const**, int, Callable::CallError&) (modules/gdscript/gdscript.cpp:1905)
[8] bool BaseButton::_gdvirtual__pressed_call<false>() (scene/gui/base_button.h:91)
[9] BaseButton::_pressed() (scene/gui/base_button.cpp:136)
[10] BaseButton::on_action_event(Ref<InputEvent>) (scene/gui/base_button.cpp:172)
[11] BaseButton::gui_input(Ref<InputEvent> const&) (scene/gui/base_button.cpp:69)
[12] Control::_call_gui_input(Ref<InputEvent> const&) (scene/gui/control.cpp:1797)
[13] Viewport::_gui_call_input(Control*, Ref<InputEvent> const&) (scene/main/viewport.cpp:1600)
[14] Viewport::_gui_input_event(Ref<InputEvent>) (scene/main/viewport.cpp:1869)
[15] Viewport::push_input(Ref<InputEvent> const&, bool) (scene/main/viewport.cpp:3368)
[16] Window::_window_input(Ref<InputEvent> const&) (scene/main/window.cpp:1614)
[17] void call_with_variant_args_helper<Window, Ref<InputEvent> const&, 0ull>(Window*, void (Window::*)(Ref<InputEvent> const&), Variant const**, Callable::CallError&, IndexSequence<0ull>) (./core/variant/binder_common.h:304)
[18] void call_with_variant_args<Window, Ref<InputEvent> const&>(Window*, void (Window::*)(Ref<InputEvent> const&), Variant const**, int, Callable::CallError&) (./core/variant/binder_common.h:418)
[19] CallableCustomMethodPointer<Window, Ref<InputEvent> const&>::call(Variant const**, int, Variant&, Callable::CallError&) const (./core/object/callable_method_pointer.h:98)
[20] Callable::callp(Variant const**, int, Variant&, Callable::CallError&) const (core/variant/callable.cpp:56)
[21] Variant Callable::call<Ref<InputEvent> >(Ref<InputEvent>) const (./core/variant/variant.h:863)
[22] DisplayServerWindows::_dispatch_input_event(Ref<InputEvent> const&) (platform/windows/display_server_windows.cpp:2956)
[23] DisplayServerWindows::_dispatch_input_events(Ref<InputEvent> const&) (platform/windows/display_server_windows.cpp:2925)
[24] Input::_parse_input_event_impl(Ref<InputEvent> const&, bool) (core/input/input.cpp:759)
[25] Input::flush_buffered_events() (core/input/input.cpp:1025)
[26] DisplayServerWindows::process_events() (platform/windows/display_server_windows.cpp:2640)
[27] OS_Windows::run() (platform/windows/os_windows.cpp:1475)
[28] widechar_main(int, wchar_t**) (platform/windows/godot_windows.cpp:180)
[29] _main() (platform/windows/godot_windows.cpp:204)
[30] main (platform/windows/godot_windows.cpp:223)
[31] __tmainCRTStartup (C:/M/B/src/mingw-w64/mingw-w64-crt/crt/crtexe.c:267)
[32] WinMainCRTStartup (C:/M/B/src/mingw-w64/mingw-w64-crt/crt/crtexe.c:157)
-- END OF BACKTRACE --
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I approve of the concept. Did not test yet.
…generate stack trace from DWARF symbols.
If we're adding libbacktrace, shouldn't we standardize all platforms on top of it and remove our bespoke platform-specific crash handlers? At least all platforms with DWARF debug info if I understand correctly. Edit: This was answered on RC before I asked here:
We can evaluate if it's worth it for Linux then, but otherwise it seems to be small enough that it wouldn't be a problem to include a thirdparty lib only for Windows builds. |
Thanks! |
Alternative to #60944
Enables crash reporter on MinGW builds, DWARF symbols are parsed using libbacktrace.
MSVC crash log example
MinGW crash log example