diff --git a/doc/HACKING.asciidoc b/doc/HACKING.asciidoc index d8ba6d6f9..45ea11ae9 100644 --- a/doc/HACKING.asciidoc +++ b/doc/HACKING.asciidoc @@ -151,9 +151,7 @@ Debugging ~~~~~~~~~ In the `qutebrowser.utils.debug` module there are some useful functions for -debugging. In particular you should use `set_trace` from -`qutebrowser.utils.debug` instead of `pdb` to set breakpoints or you'll get -annoying Qt error messages. +debugging. When starting qutebrowser with the `--debug` flag you also get useful debug logs. You can add +--logfilter _category[,category,...]_+ to restrict logging diff --git a/qutebrowser/qutebrowser.py b/qutebrowser/qutebrowser.py index 3a51255ae..83ccc0610 100644 --- a/qutebrowser/qutebrowser.py +++ b/qutebrowser/qutebrowser.py @@ -116,7 +116,11 @@ def main(): # We do this import late as we need to fix harfbuzz first. from qutebrowser import app from qutebrowser.utils import debug + from PyQt5.QtCore import pyqtRemoveInputHook import PyQt5.QtWidgets as QtWidgets + # We don't use qutebrowser via the interactive shell, but we want to be + # able to use pdb. + pyqtRemoveInputHook() app = app.Application(args) # We set qApp explicitely here to reduce the risk of segfaults while # quitting. diff --git a/qutebrowser/utils/debug.py b/qutebrowser/utils/debug.py index bae274532..f067ec1e3 100644 --- a/qutebrowser/utils/debug.py +++ b/qutebrowser/utils/debug.py @@ -20,7 +20,6 @@ """Utilities used for debugging.""" import re -import pdb import sys import types import functools @@ -32,24 +31,6 @@ from qutebrowser.commands import cmdutils from qutebrowser.config import config, style -@cmdutils.register(debug=True, name='debug-set-trace') -def set_trace(): - """Break into the debugger in the shell. - - // - - Based on http://stackoverflow.com/a/1745965/2085149 - """ - if sys.stdout is not None: - sys.stdout.flush() - print() - print("When done debugging, remember to execute:") - print(" from PyQt5 import QtCore; QtCore.pyqtRestoreInputHook()") - print("before executing c(ontinue).") - pyqtRemoveInputHook() - pdb.set_trace() - - @cmdutils.register(debug=True) def debug_crash(typ='exception'): """Crash for debugging purposes.