Add :crash segfault command
This commit is contained in:
parent
3384e27e3b
commit
78c41fffc9
@ -28,6 +28,7 @@ earlyinit.check_pyqt_webkit()
|
|||||||
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
import types
|
||||||
import logging
|
import logging
|
||||||
import subprocess
|
import subprocess
|
||||||
import configparser
|
import configparser
|
||||||
@ -493,15 +494,26 @@ class QuteBrowser(QApplication):
|
|||||||
self.mainwindow.tabs.cur.openurl('qute:pyeval')
|
self.mainwindow.tabs.cur.openurl('qute:pyeval')
|
||||||
|
|
||||||
@cmdutils.register(instance='', hide=True)
|
@cmdutils.register(instance='', hide=True)
|
||||||
def crash(self):
|
def crash(self, typ='exception'):
|
||||||
"""Crash for debugging purposes.
|
"""Crash for debugging purposes.
|
||||||
|
|
||||||
:crash command handler.
|
:crash command handler.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
typ: either 'exception' or 'segfault'
|
||||||
|
|
||||||
Raises:
|
Raises:
|
||||||
Always raises Exception.
|
raises Exception when typ is not segfault.
|
||||||
|
segfaults when typ is (you don't say...)
|
||||||
"""
|
"""
|
||||||
raise Exception("Forced crash")
|
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)
|
||||||
|
raise Exception("Segfault failed (wat.)")
|
||||||
|
else:
|
||||||
|
raise Exception("Forced crash")
|
||||||
|
|
||||||
@pyqtSlot()
|
@pyqtSlot()
|
||||||
@cmdutils.register(instance='', name=['quit', 'q'], nargs=0)
|
@cmdutils.register(instance='', name=['quit', 'q'], nargs=0)
|
||||||
|
Loading…
Reference in New Issue
Block a user