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

Add an OS.crash() method for testing system crash handler (3.x) #55614

Merged
merged 1 commit into from
Dec 6, 2021

Conversation

Calinou
Copy link
Member

@Calinou Calinou commented Dec 4, 2021

3.x version of #55603.

This makes it possible to test the system's crash handler without having to modify engine code or exploit an engine bug.

Preview (3.x)

extends Node


func _ready():
	OS.crash("Testing crash handler.")

Results in:

ERROR: Testing crash handler.
   at: crash (core/bind/core_bind.cpp:1186)

================================================================
handle_crash: Program crashed with signal 4
Engine version: Godot Engine v3.5.beta.custom_build (ade0e700f1407e92414484d96f20f57bf63cc4d2)
Dumping the backtrace. Please include this when reporting the bug on https://github.com/godotengine/godot/issues
[1] /lib64/libc.so.6(+0x3d320) [0x7fd0dbded320] (??:0)
[2] _OS::crash(String const&) (/home/hugo/Documents/Git/godotengine/godot/core/bind/core_bind.cpp:1186)
[3] MethodBind1<String const&>::call(Object*, Variant const**, int, Variant::CallError&) (/home/hugo/Documents/Git/godotengine/godot/./core/method_bind.gen.inc:775)
[4] Object::call(StringName const&, Variant const**, int, Variant::CallError&) (/home/hugo/Documents/Git/godotengine/godot/core/object.cpp:918)
[5] Variant::call_ptr(StringName const&, Variant const**, int, Variant*, Variant::CallError&) (/home/hugo/Documents/Git/godotengine/godot/core/variant_call.cpp:1180)
[6] GDScriptFunction::call(GDScriptInstance*, Variant const**, int, Variant::CallError&, GDScriptFunction::CallState*) (/home/hugo/Documents/Git/godotengine/godot/modules/gdscript/gdscript_function.cpp:1046)
[7] GDScriptInstance::_ml_call_reversed(GDScript*, StringName const&, Variant const**, int) (/home/hugo/Documents/Git/godotengine/godot/modules/gdscript/gdscript.cpp:1209)
[8] GDScriptInstance::call_multilevel_reversed(StringName const&, Variant const**, int) (/home/hugo/Documents/Git/godotengine/godot/modules/gdscript/gdscript.cpp:1217)
[9] Node::_notification(int) (/home/hugo/Documents/Git/godotengine/godot/scene/main/node.cpp:149)
[10] Node::_notificationv(int, bool) (/home/hugo/Documents/Git/godotengine/godot/./scene/main/node.h:45)
[11] CanvasItem::_notificationv(int, bool) (/home/hugo/Documents/Git/godotengine/godot/./scene/2d/canvas_item.h:?)
[12] Node2D::_notificationv(int, bool) (/home/hugo/Documents/Git/godotengine/godot/./scene/2d/node_2d.h:?)
[13] Object::notification(int, bool) (/home/hugo/Documents/Git/godotengine/godot/core/object.cpp:927)
[14] Node::_propagate_ready() (/home/hugo/Documents/Git/godotengine/godot/scene/main/node.cpp:187)
[15] Node::_propagate_ready() (/home/hugo/Documents/Git/godotengine/godot/scene/main/node.cpp:178)
[16] Node::_set_tree(SceneTree*) (/home/hugo/Documents/Git/godotengine/godot/scene/main/node.cpp:?)
[17] SceneTree::init() (/home/hugo/Documents/Git/godotengine/godot/scene/main/scene_tree.cpp:472)
[18] OS_X11::run() (/home/hugo/Documents/Git/godotengine/godot/platform/x11/os_x11.cpp:?)
[19] /home/hugo/Documents/Git/godotengine/godot/bin/godot.x11.tools.64.llvm(main+0x173) [0x2e06663] (/home/hugo/Documents/Git/godotengine/godot/platform/x11/godot_x11.cpp:55)
[20] /lib64/libc.so.6(__libc_start_main+0xd5) [0x7fd0dbdd7b75] (??:0)
[21] /home/hugo/Documents/Git/godotengine/godot/bin/godot.x11.tools.64.llvm(_start+0x2e) [0x2e0642e] (??:?)
-- END OF BACKTRACE --
================================================================

This makes it possible to test the system's crash handler without
having to modify engine code or exploit an engine bug.
@Calinou Calinou requested review from a team as code owners December 4, 2021 00:43
@Calinou Calinou added this to the 3.5 milestone Dec 4, 2021
@Calinou Calinou changed the title Add an OS.crash() method for testing system crash handler Add an OS.crash() method for testing system crash handler (3.x) Dec 4, 2021
@akien-mga akien-mga merged commit 0845f20 into godotengine:3.x Dec 6, 2021
@akien-mga
Copy link
Member

Thanks!

@Calinou Calinou deleted the add-os-crash-method-3.x branch December 6, 2021 17:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants