WIP, add back in root shield, print out pdb sigint opts

zombie_lord_infinite
Tyler Goodlet 2021-09-18 14:09:48 -04:00
parent a2a4f7af09
commit aa94ea5bcc
2 changed files with 22 additions and 17 deletions

View File

@ -2,6 +2,7 @@
Multi-core debugging for da peeps!
"""
from __future__ import annotations
import bdb
import sys
from functools import partial
@ -20,12 +21,14 @@ from ._exceptions import is_multi_cancelled
try:
# wtf: only exported when installed in dev mode?
import pdbpp
except ImportError:
# pdbpp is installed in regular mode...it monkey patches stuff
import pdb
assert pdb.xpm, "pdbpp is not installed?" # type: ignore
pdbpp = pdb
log = get_logger(__name__)
@ -85,6 +88,23 @@ class PdbwTeardown(pdbpp.Pdb):
_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.
# XXX see https://github.com/goodboy/tractor/issues/130
@ -443,21 +463,6 @@ async def _breakpoint(
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):
pdb = _mk_pdb()

View File

@ -307,7 +307,7 @@ async def _open_and_supervise_one_cancels_all_nursery(
f'child {_debug._global_actor_in_debug}\n'
'Waiting on tty lock to release..')
# with trio.CancelScope(shield=True):
with trio.CancelScope(shield=True):
await debug_complete.wait()
# if the caller's scope errored then we activate our