Skip to content

Add an OS.crash() method for testing system crash handler - #55603

Merged
Faless merged 1 commit into
godotengine:masterfrom
Calinou:add-os-crash-method
Dec 6, 2021
Merged

Faless merged 1 commit into
godotengine:masterfrom
Calinou:add-os-crash-method

Conversation

@Calinou

@Calinou Calinou commented Dec 3, 2021 •

Copy link
Copy Markdown
Member

master version of #55614.

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

This will come handy for developing features such as #55565, #33505 and godotengine/godot-proposals#1896.

Preview

extends Node


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

Results in:

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

================================================================
handle_crash: Program crashed with signal 4
Engine version: Godot Engine v4.0.dev.custom_build (ea66ea9060272d67fbf0c4264acb76a7bedfc4af)
Dumping the backtrace. Please include this when reporting the bug on https://github.com/godotengine/godot/issues
[1] /lib64/libc.so.6(+0x3d320) [0x7f3d643f0320] (??:0)
[2] core_bind::OS::crash(String const&) (/home/hugo/Documents/Git/godotengine/godot/core/core_bind.cpp:211)
[3] void call_with_ptr_args_helper<__UnexistingClass, String const&, 0ul>(__UnexistingClass*, void (__UnexistingClass::*)(String const&), void const**, IndexSequence<0ul>) (/home/hugo/Documents/Git/godotengine/godot/./core/variant/binder_common.h:244)
[4] void call_with_ptr_args<__UnexistingClass, String const&>(__UnexistingClass*, void (__UnexistingClass::*)(String const&), void const**) (/home/hugo/Documents/Git/godotengine/godot/./core/variant/binder_common.h:493)
[5] MethodBindT<String const&>::ptrcall(Object*, void const**, void*) (/home/hugo/Documents/Git/godotengine/godot/./core/object/method_bind.h:291)
[6] GDScriptFunction::call(GDScriptInstance*, Variant const**, int, Callable::CallError&, GDScriptFunction::CallState*) (/home/hugo/Documents/Git/godotengine/godot/modules/gdscript/gdscript_vm.cpp:1869)
[7] GDScriptInstance::call(StringName const&, Variant const**, int, Callable::CallError&) (/home/hugo/Documents/Git/godotengine/godot/modules/gdscript/gdscript.cpp:1511)
[8] Node::_gdvirtual__ready_call() (/home/hugo/Documents/Git/godotengine/godot/./scene/main/node.h:236)
[9] Node::_notification(int) (/home/hugo/Documents/Git/godotengine/godot/scene/main/node.cpp:143)
[10] Node::_notificationv(int, bool) (/home/hugo/Documents/Git/godotengine/godot/./scene/main/node.h:48)
[11] CanvasItem::_notificationv(int, bool) (/home/hugo/Documents/Git/godotengine/godot/./scene/main/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/object.cpp:846)
[14] Node::_propagate_ready() (/home/hugo/Documents/Git/godotengine/godot/scene/main/node.cpp:188)
[15] Node::_propagate_ready() (/home/hugo/Documents/Git/godotengine/godot/scene/main/node.cpp:179)
[16] Node::_set_tree(SceneTree*) (/home/hugo/Documents/Git/godotengine/godot/scene/main/node.cpp:?)
[17] SceneTree::initialize() (/home/hugo/Documents/Git/godotengine/godot/scene/main/scene_tree.cpp:402)
[18] OS_LinuxBSD::run() (/home/hugo/Documents/Git/godotengine/godot/platform/linuxbsd/os_linuxbsd.cpp:?)
[19] /home/hugo/Documents/Git/godotengine/godot/bin/godot.linuxbsd.tools.64.llvm(main+0x1c6) [0x462e7f6] (/home/hugo/Documents/Git/godotengine/godot/platform/linuxbsd/godot_linuxbsd.cpp:58)
[20] /lib64/libc.so.6(__libc_start_main+0xd5) [0x7f3d643dab75] (??:0)
[21] /home/hugo/Documents/Git/godotengine/godot/bin/godot.linuxbsd.tools.64.llvm(_start+0x2e) [0x462e56e] (??:?)
-- END OF BACKTRACE --
================================================================

@Calinou
Calinou requested review from a team as code owners December 3, 2021 19:39
@Calinou Calinou added this to the 4.0 milestone Dec 3, 2021
@Calinou
Calinou force-pushed the add-os-crash-method branch from 5354dc1 to bad667c Compare December 3, 2021 19:41
This makes it possible to test the system's crash handler without
having to modify engine code or exploit an engine bug.
@Faless
Faless merged commit 3ae8eda into godotengine:master Dec 6, 2021
@Calinou
Calinou deleted the add-os-crash-method branch December 6, 2021 15:42
BendyLand pushed a commit to BendyLand/voltaire that referenced this pull request Aug 2, 2026
Add an `OS.crash()` method for testing system crash handler
BendyLand pushed a commit to BendyLand/voltaire that referenced this pull request Aug 2, 2026
Add an `OS.crash()` method for testing system crash handler
wangshucheng pushed a commit to wangshucheng/godot that referenced this pull request Aug 27, 2026
Add an `OS.crash()` method for testing system crash handler
Shane-Gadsby pushed a commit to Shane-Gadsby/godotwebgpu that referenced this pull request Sep 21, 2026
Add an `OS.crash()` method for testing system crash handler
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.

3 participants