MCPcopy Create free account
hub / github.com/fabioz/PyDev.Debugger / main

Function main

pydevd_attach_to_process/attach_pydevd.py:46–85  ·  view source on GitHub ↗
(setup)

Source from the content-addressed store, hash-verified

44
45
46def main(setup):
47 sys.path.append(os.path.dirname(__file__))
48 import add_code_to_python_process
49
50 show_debug_info_on_target_process = 0
51
52 pydevd_dirname = os.path.dirname(os.path.dirname(__file__))
53
54 if sys.platform == "win32":
55 setup["pythonpath"] = pydevd_dirname.replace("\\", "/")
56 setup["pythonpath2"] = os.path.dirname(__file__).replace("\\", "/")
57 python_code = (
58 """import sys;
59sys.path.append("%(pythonpath)s");
60sys.path.append("%(pythonpath2)s");
61import attach_script;
62attach_script.attach(port=%(port)s, host="%(host)s", protocol="%(protocol)s", debug_mode="%(debug-mode)s");
63""".replace("\r\n", "")
64 .replace("\r", "")
65 .replace("\n", "")
66 )
67 else:
68 setup["pythonpath"] = pydevd_dirname
69 setup["pythonpath2"] = os.path.dirname(__file__)
70 # We have to pass it a bit differently for gdb
71 python_code = (
72 """import sys;
73sys.path.append(\\\"%(pythonpath)s\\\");
74sys.path.append(\\\"%(pythonpath2)s\\\");
75import attach_script;
76attach_script.attach(port=%(port)s, host=\\\"%(host)s\\\", protocol=\\\"%(protocol)s\\\", debug_mode=\\\"%(debug-mode)s\\\");
77""".replace("\r\n", "")
78 .replace("\r", "")
79 .replace("\n", "")
80 )
81
82 python_code = python_code % setup
83 add_code_to_python_process.run_python_code(
84 setup["pid"], python_code, connect_debugger_tracing=True, show_debug_info=show_debug_info_on_target_process
85 )
86
87
88if __name__ == "__main__":

Callers 1

attach_pydevd.pyFile · 0.70

Calls 1

appendMethod · 0.45

Tested by

no test coverage detected