diff options
author | Lipu Fei <lipu.fei815@gmail.com> | 2017-05-19 15:59:22 +0300 |
---|---|---|
committer | Lipu Fei <lipu.fei815@gmail.com> | 2017-05-19 16:00:22 +0300 |
commit | 430508c18583844b783b136fa4f6f7a0e9fffab9 (patch) | |
tree | 802739e68a941e1797b4df63b25298d12e72950d /cura/CrashHandler.py | |
parent | 76a9a9a9ab9e39ba1dc047200ce13b3e6fbef5cc (diff) |
Dump stacktrace for all threads in CrashReport
CURA-3836
This helps debugging issues like CURA-3836
Diffstat (limited to 'cura/CrashHandler.py')
-rw-r--r-- | cura/CrashHandler.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/cura/CrashHandler.py b/cura/CrashHandler.py index 4048b409a7..7008ba64d2 100644 --- a/cura/CrashHandler.py +++ b/cura/CrashHandler.py @@ -2,6 +2,9 @@ import sys import platform import traceback import webbrowser +import faulthandler +import tempfile +import os import urllib from PyQt5.QtCore import QT_VERSION_STR, PYQT_VERSION_STR, Qt, QCoreApplication @@ -91,6 +94,17 @@ def show(exception_type, value, tb): crash_info = "Version: {0}\nPlatform: {1}\nQt: {2}\nPyQt: {3}\n\nException:\n{4}" crash_info = crash_info.format(version, platform.platform(), QT_VERSION_STR, PYQT_VERSION_STR, trace) + tmp_file_fd, tmp_file_path = tempfile.mkstemp(prefix = "cura-crash", text = True) + os.close(tmp_file_fd) + with open(tmp_file_path, "w") as f: + faulthandler.dump_traceback(f, all_threads=True) + with open(tmp_file_path, "r") as f: + data = f.read() + + msg = "-------------------------\n" + msg += data + crash_info += "\n\n" + msg + textarea.setText(crash_info) buttons = QDialogButtonBox(QDialogButtonBox.Close, dialog) |