forked from goodboy/tractor
WIP, add back in root shield, print out pdb sigint opts
parent
cbc18f94ec
commit
60b892cc80
|
@ -2,6 +2,7 @@
|
||||||
Multi-core debugging for da peeps!
|
Multi-core debugging for da peeps!
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
from __future__ import annotations
|
||||||
import bdb
|
import bdb
|
||||||
import sys
|
import sys
|
||||||
from functools import partial
|
from functools import partial
|
||||||
|
@ -27,12 +28,14 @@ from ._exceptions import is_multi_cancelled
|
||||||
try:
|
try:
|
||||||
# wtf: only exported when installed in dev mode?
|
# wtf: only exported when installed in dev mode?
|
||||||
import pdbpp
|
import pdbpp
|
||||||
|
|
||||||
except ImportError:
|
except ImportError:
|
||||||
# pdbpp is installed in regular mode...it monkey patches stuff
|
# pdbpp is installed in regular mode...it monkey patches stuff
|
||||||
import pdb
|
import pdb
|
||||||
assert pdb.xpm, "pdbpp is not installed?" # type: ignore
|
assert pdb.xpm, "pdbpp is not installed?" # type: ignore
|
||||||
pdbpp = pdb
|
pdbpp = pdb
|
||||||
|
|
||||||
|
|
||||||
log = get_logger(__name__)
|
log = get_logger(__name__)
|
||||||
|
|
||||||
|
|
||||||
|
@ -92,6 +95,23 @@ class PdbwTeardown(pdbpp.Pdb):
|
||||||
_pdb_release_hook()
|
_pdb_release_hook()
|
||||||
|
|
||||||
|
|
||||||
|
def _mk_pdb() -> PdbwTeardown:
|
||||||
|
|
||||||
|
# XXX: setting these flags on the pdb instance are absolutely
|
||||||
|
# critical to having ctrl-c work in the ``trio`` standard way! The
|
||||||
|
# stdlib's pdb supports entering the current sync frame on a SIGINT,
|
||||||
|
# with ``trio`` we pretty much never want this and if we did we can
|
||||||
|
# handle it in the ``tractor`` task runtime.
|
||||||
|
# global pdb
|
||||||
|
|
||||||
|
pdb = PdbwTeardown()
|
||||||
|
pdb.nosigint = True
|
||||||
|
pdb.allow_kbdint = True
|
||||||
|
opts = (allow_kbdint, nosigint) = pdb.allow_kbdint, pdb.nosigint
|
||||||
|
print(f'`pdbp` was configured with {opts}')
|
||||||
|
return pdb
|
||||||
|
|
||||||
|
|
||||||
# TODO: will be needed whenever we get to true remote debugging.
|
# TODO: will be needed whenever we get to true remote debugging.
|
||||||
# XXX see https://github.com/goodboy/tractor/issues/130
|
# XXX see https://github.com/goodboy/tractor/issues/130
|
||||||
|
|
||||||
|
@ -461,21 +481,6 @@ async def _breakpoint(
|
||||||
debug_func(actor)
|
debug_func(actor)
|
||||||
|
|
||||||
|
|
||||||
def _mk_pdb() -> PdbwTeardown:
|
|
||||||
|
|
||||||
# XXX: setting these flags on the pdb instance are absolutely
|
|
||||||
# critical to having ctrl-c work in the ``trio`` standard way! The
|
|
||||||
# stdlib's pdb supports entering the current sync frame on a SIGINT,
|
|
||||||
# with ``trio`` we pretty much never want this and if we did we can
|
|
||||||
# handle it in the ``tractor`` task runtime.
|
|
||||||
|
|
||||||
pdb = PdbwTeardown()
|
|
||||||
pdb.allow_kbdint = True
|
|
||||||
pdb.nosigint = True
|
|
||||||
|
|
||||||
return pdb
|
|
||||||
|
|
||||||
|
|
||||||
def _set_trace(actor=None):
|
def _set_trace(actor=None):
|
||||||
pdb = _mk_pdb()
|
pdb = _mk_pdb()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue