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

Method set_suspend

pydevd.py:1930–1998  ·  view source on GitHub ↗

:param thread: The thread which should be suspended. :param stop_reason: Reason why the thread was suspended. :param suspend_other_threads: Whether to force other threads to be suspended (i.e.: when hitting a breakpoint with

(
        self,
        thread,
        stop_reason: int,
        suspend_other_threads: bool = False,
        is_pause=False,
        original_step_cmd: int = -1,
        suspend_requested: bool = False,
    )

Source from the content-addressed store, hash-verified

1928 return eb
1929
1930 def set_suspend(
1931 self,
1932 thread,
1933 stop_reason: int,
1934 suspend_other_threads: bool = False,
1935 is_pause=False,
1936 original_step_cmd: int = -1,
1937 suspend_requested: bool = False,
1938 ):
1939 """
1940 :param thread:
1941 The thread which should be suspended.
1942
1943 :param stop_reason:
1944 Reason why the thread was suspended.
1945
1946 :param suspend_other_threads:
1947 Whether to force other threads to be suspended (i.e.: when hitting a breakpoint
1948 with a suspend all threads policy).
1949
1950 :param is_pause:
1951 If this is a pause to suspend all threads, any thread can be considered as the 'main'
1952 thread paused.
1953
1954 :param original_step_cmd:
1955 If given we may change the stop reason to this.
1956
1957 :param suspend_requested:
1958 If the execution will be suspended right away then this may be false, otherwise,
1959 if the thread should be stopped due to this suspend at a later time then it
1960 should be true.
1961 """
1962 self._threads_suspended_single_notification.increment_suspend_time()
1963 if is_pause:
1964 self._threads_suspended_single_notification.on_pause()
1965
1966 with suspend_threads_lock:
1967 info = mark_thread_suspended(thread, stop_reason, original_step_cmd=original_step_cmd)
1968 if not suspend_other_threads and self.multi_threads_single_notification:
1969 # In the mode which gives a single notification when all threads are
1970 # stopped, stop all threads whenever a set_suspend is issued.
1971 suspend_other_threads = True
1972
1973 if suspend_other_threads:
1974 # Suspend all except the current one (which we're currently suspending already).
1975 suspend_all_threads(self, except_thread=thread)
1976
1977 if (suspend_requested or is_pause) and PYDEVD_USE_SYS_MONITORING:
1978 pydevd_sys_monitoring.update_monitor_events(suspend_requested=True)
1979
1980 if is_pause:
1981 # Must set tracing after setting the state to suspend.
1982 frame = info.get_topmost_frame(thread)
1983 if frame is not None:
1984 # Where suspend was requested
1985 # traceback.print_stack(frame)
1986 try:
1987 self.set_trace_for_frame_and_parents(thread.ident, frame)

Callers 5

_locked_settraceFunction · 0.95
_suspend_jinja2Function · 0.45
exception_breakFunction · 0.45
suspend_djangoFunction · 0.45

Calls 7

mark_thread_suspendedFunction · 0.90
suspend_all_threadsFunction · 0.90
on_pauseMethod · 0.80
get_topmost_frameMethod · 0.80

Tested by

no test coverage detected