コード例 #1
0
 def code_to_debug():
     from dbgimporter import import_and_enable_debugger
     import_and_enable_debugger()
     for i in range(0, 10):
         print(i)
     import backchannel
     backchannel.read_json()
コード例 #2
0
 def parent():
     import backchannel
     import os
     import subprocess
     import sys
     from dbgimporter import import_and_enable_debugger
     import_and_enable_debugger()
     argv = [sys.executable, sys.argv[1]]
     env = os.environ.copy()
     subprocess.Popen(argv, env=env, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
     backchannel.read_json()
コード例 #3
0
 def ptvsd_launcher():
     # import_and_enable_debugger
     import ptvsd.debugger
     import backchannel
     args = tuple(backchannel.read_json())
     print('debug%r' % (args, ))
     ptvsd.debugger.debug(*args)
コード例 #4
0
ファイル: test_run.py プロジェクト: HarryWeppner/ptvsd
    def code_to_debug():
        import os
        import sys
        import backchannel

        print('begin')
        assert backchannel.read_json() == 'continue'
        backchannel.write_json(os.path.abspath(sys.modules['ptvsd'].__file__))
        print('end')
コード例 #5
0
    def code_to_debug():
        import multiprocessing
        import platform
        import sys
        from dbgimporter import import_and_enable_debugger
        import_and_enable_debugger()

        def child_of_child(q):
            print('entering child of child')
            assert q.get() == 2
            q.put(3)
            print('leaving child of child')

        def child(q):
            print('entering child')
            assert q.get() == 1

            print('spawning child of child')
            p = multiprocessing.Process(target=child_of_child, args=(q, ))
            p.start()
            p.join()

            assert q.get() == 3
            q.put(4)
            print('leaving child')

        if __name__ == '__main__':
            import backchannel
            if sys.version_info >= (3, 4):
                multiprocessing.set_start_method('spawn')
            else:
                assert platform.system() == 'Windows'

            print('spawning child')
            q = multiprocessing.Queue()
            p = multiprocessing.Process(target=child, args=(q, ))
            p.start()
            print('child spawned')
            backchannel.write_json(p.pid)

            q.put(1)
            assert backchannel.read_json() == 'continue'
            q.put(2)
            p.join()
            assert q.get() == 4
            q.close()
            backchannel.write_json('done')
コード例 #6
0
    def code_to_debug():
        from dbgimporter import import_and_enable_debugger
        import_and_enable_debugger()

        import backchannel
        import sys
        json = backchannel.read_json()
        call_me_back_dir = json['call_me_back_dir']
        sys.path.append(call_me_back_dir)

        import call_me_back

        def call_func():
            raise RuntimeError('unhandled error')  # @raise_line

        call_me_back.call_me_back(call_func)  # @call_me_back_line
        print('done')
コード例 #7
0
    def code_to_debug():
        from dbgimporter import import_and_enable_debugger
        import_and_enable_debugger()
        import os
        import sys
        import backchannel
        json = backchannel.read_json()
        call_me_back_dir = json['call_me_back_dir']
        sys.path.append(call_me_back_dir)

        import call_me_back

        def call_func():
            print('break here')

        backchannel.write_json(os.path.abspath(__file__))
        call_me_back.call_me_back(call_func)
        print('done')
コード例 #8
0
 def code_to_debug():
     # import_and_enable_debugger
     import backchannel
     backchannel.read_json()
     print('ok')
コード例 #9
0
ファイル: attach1.py プロジェクト: redreamality/ptvsd
import ptvsd
import time
import backchannel

host = os.getenv('PTVSD_TEST_HOST', 'localhost')
port = os.getenv('PTVSD_TEST_PORT', '5678')
ptvsd.enable_attach((host, port))

if os.getenv('PTVSD_WAIT_FOR_ATTACH', None) is not None:
    backchannel.write_json('wait_for_attach')
    ptvsd.wait_for_attach()

if os.getenv('PTVSD_IS_ATTACHED', None) is not None:
    backchannel.write_json('is_attached')
    while not ptvsd.is_attached():
        time.sleep(0.1)

pause_test = True
if os.getenv('PTVSD_BREAK_INTO_DBG', None) is not None:
    backchannel.write_json('break_into_debugger')
    pause_test = False

if pause_test:
    assert backchannel.read_json() == 'pause_test'
    for _ in range(0, 20):
        time.sleep(0.1)
        print('looping')
else:
    ptvsd.break_into_debugger()
    print('done')