From 5d92934d765ca57a96ea5f01ad7f3ffd43070731 Mon Sep 17 00:00:00 2001 From: Daniel Karbach Date: Mon, 24 Oct 2016 12:21:52 +0200 Subject: [PATCH] less brutal synthetic segfault --- qutebrowser/misc/utilcmds.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/qutebrowser/misc/utilcmds.py b/qutebrowser/misc/utilcmds.py index 62202998c..115348a9f 100644 --- a/qutebrowser/misc/utilcmds.py +++ b/qutebrowser/misc/utilcmds.py @@ -20,7 +20,8 @@ """Misc. utility commands exposed to the user.""" import functools -import types +import os +import signal import traceback try: @@ -142,10 +143,7 @@ def debug_crash(typ='exception'): typ: either 'exception' or 'segfault'. """ if typ == 'segfault': - # From python's Lib/test/crashers/bogus_code_obj.py - co = types.CodeType(0, 0, 0, 0, 0, b'\x04\x71\x00\x00', (), (), (), - '', '', 1, b'') - exec(co) + os.kill(os.getpid(), signal.SIGSEGV) raise Exception("Segfault failed (wat.)") else: raise Exception("Forced crash")