Improve parsing of fatal stacktraces
We now also recognize "Windows fatal exception: ..." message and refuse to send empty Windows access violation messages.
This commit is contained in:
parent
4a37e40fcc
commit
8fb03208e7
@ -57,17 +57,22 @@ def parse_fatal_stacktrace(text):
|
||||
element being the first stacktrace frame.
|
||||
"""
|
||||
lines = [
|
||||
r'Fatal Python error: (.*)',
|
||||
r'(?P<type>Fatal Python error|Windows fatal exception): (?P<msg>.*)',
|
||||
r' *',
|
||||
r'(Current )?[Tt]hread [^ ]* \(most recent call first\): *',
|
||||
r' File ".*", line \d+ in (.*)',
|
||||
r' File ".*", line \d+ in (?P<func>.*)',
|
||||
]
|
||||
m = re.match('\n'.join(lines), text)
|
||||
if m is None:
|
||||
# We got some invalid text.
|
||||
return ('', '')
|
||||
else:
|
||||
return (m.group(1), m.group(3))
|
||||
msg = m.group('msg')
|
||||
typ = m.group('type')
|
||||
func = m.group('func')
|
||||
if typ == 'Windows fatal exception':
|
||||
msg = 'Windows ' + msg
|
||||
return msg, func
|
||||
|
||||
|
||||
def _get_environment_vars():
|
||||
@ -474,7 +479,8 @@ class FatalCrashDialog(_CrashDialog):
|
||||
self._type, self._func = parse_fatal_stacktrace(self._log)
|
||||
|
||||
def _get_error_type(self):
|
||||
if self._type == 'Segmentation fault':
|
||||
if self._type in ['Segmentation fault',
|
||||
'Windows access violation']:
|
||||
return 'segv'
|
||||
else:
|
||||
return self._type
|
||||
@ -522,7 +528,7 @@ class FatalCrashDialog(_CrashDialog):
|
||||
"""Prevent empty reports."""
|
||||
if (not self._info.toPlainText().strip() and
|
||||
not self._contact.toPlainText().strip() and
|
||||
self._type == 'Segmentation fault' and
|
||||
self._get_error_type() == 'segv' and
|
||||
self._func == 'qt_mainloop'):
|
||||
msgbox.msgbox(parent=self, title='Empty crash info',
|
||||
text="Empty reports for fatal crashes are useless "
|
||||
|
@ -47,6 +47,14 @@ Thread 0x00007fa135ac7700 (most recent call first):
|
||||
File "", line 1 in testfunc
|
||||
"""
|
||||
|
||||
WINDOWS_CRASH_TEXT = """
|
||||
Windows fatal exception: access violation
|
||||
_
|
||||
Current thread 0x000014bc (most recent call first):
|
||||
File "qutebrowser\mainwindow\tabbedbrowser.py", line 468 in tabopen
|
||||
File "qutebrowser\browser\shared.py", line 247 in get_tab
|
||||
"""
|
||||
|
||||
INVALID_CRASH_TEXT = """
|
||||
Hello world!
|
||||
"""
|
||||
@ -56,6 +64,7 @@ Hello world!
|
||||
(VALID_CRASH_TEXT, 'Segmentation fault', 'testfunc'),
|
||||
(VALID_CRASH_TEXT_THREAD, 'Segmentation fault', 'testfunc'),
|
||||
(VALID_CRASH_TEXT_EMPTY, 'Aborted', ''),
|
||||
(WINDOWS_CRASH_TEXT, 'Windows access violation', 'tabopen'),
|
||||
(INVALID_CRASH_TEXT, '', ''),
|
||||
])
|
||||
def test_parse_fatal_stacktrace(text, typ, func):
|
||||
|
Loading…
Reference in New Issue
Block a user