MCPcopy Create free account
hub / github.com/microsoft/debugpy / debug

Function debug

src/debugpy/server/api.py:98–133  ·  view source on GitHub ↗
(address, **kwargs)

Source from the content-addressed store, hash-verified

96
97def _starts_debugging(func):
98 def debug(address, **kwargs):
99 try:
100 _, port = address
101 except Exception:
102 port = address
103 localhost = sockets.get_default_localhost()
104 address = (localhost, port)
105 try:
106 port.__index__() # ensure it's int-like
107 except Exception:
108 raise ValueError("expected port or (host, port)")
109 if not (0 <= port < 2**16):
110 raise ValueError("invalid port number")
111
112 ensure_logging()
113 log.debug("{0}({1!r}, **{2!r})", func.__name__, address, kwargs)
114 log.info("Initial debug configuration: {0}", json.repr(_config))
115
116 qt_mode = _config.get("qt", "none")
117 if qt_mode != "none":
118 pydevd.enable_qt_support(qt_mode)
119
120 settrace_kwargs = {
121 "suspend": False,
122 "patch_multiprocessing": _config.get("subProcess", True),
123 }
124
125 if hide_debugpy_internals():
126 debugpy_path = os.path.dirname(absolute_path(debugpy.__file__))
127 settrace_kwargs["dont_trace_start_patterns"] = (debugpy_path,)
128 settrace_kwargs["dont_trace_end_patterns"] = (str("debugpy_launcher.py"),)
129
130 try:
131 return func(address, settrace_kwargs, **kwargs)
132 except Exception:
133 log.reraise_exception("{0}() failed:", func.__name__, level="info")
134
135 return debug
136

Callers

nothing calls this directly

Calls 6

hide_debugpy_internalsFunction · 0.90
absolute_pathFunction · 0.90
ensure_loggingFunction · 0.85
infoMethod · 0.80
funcFunction · 0.50
getMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…