Not working python breakpoints in C thread in pycharm or eclipse+pydev

后端 未结 2 885
一个人的身影
一个人的身影 2020-12-16 04:46

I have a django application using a C++ library (imported via swig). The C++ library launches own thread which calls callbacks in Python code.

I cannot setup a brea

2条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-16 05:52

    This is a follow-up to @fabio-zadrozny answer.

    Here is a mixin I've created that my class (which gets callbacks from a C-thread) inherits from.

    class TracingMixing(object):
        """The callbacks in the FUSE Filesystem are C threads and breakpoints don't work normally.
           This mixin adds callbacks to every function call so that we can breakpoint them."""
    
        def __call__(self, op, path, *args):
            pydevd.settrace(suspend=False, trace_only_current_thread=True, patch_multiprocessing=True)
            return getattr(self, op)(path, *args)
    

提交回复
热议问题