less brutal synthetic segfault
This commit is contained in:
parent
bdb96becd6
commit
5d92934d76
@ -20,7 +20,8 @@
|
|||||||
"""Misc. utility commands exposed to the user."""
|
"""Misc. utility commands exposed to the user."""
|
||||||
|
|
||||||
import functools
|
import functools
|
||||||
import types
|
import os
|
||||||
|
import signal
|
||||||
import traceback
|
import traceback
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@ -142,10 +143,7 @@ def debug_crash(typ='exception'):
|
|||||||
typ: either 'exception' or 'segfault'.
|
typ: either 'exception' or 'segfault'.
|
||||||
"""
|
"""
|
||||||
if typ == 'segfault':
|
if typ == 'segfault':
|
||||||
# From python's Lib/test/crashers/bogus_code_obj.py
|
os.kill(os.getpid(), signal.SIGSEGV)
|
||||||
co = types.CodeType(0, 0, 0, 0, 0, b'\x04\x71\x00\x00', (), (), (),
|
|
||||||
'', '', 1, b'')
|
|
||||||
exec(co)
|
|
||||||
raise Exception("Segfault failed (wat.)")
|
raise Exception("Segfault failed (wat.)")
|
||||||
else:
|
else:
|
||||||
raise Exception("Forced crash")
|
raise Exception("Forced crash")
|
||||||
|
Loading…
Reference in New Issue
Block a user