Skip to content

Commit

Permalink
Add stopAllThreadsOnSuspend to launch config, fixed issue getting exc…
Browse files Browse the repository at this point in the history
…eption stack (ported from debugpy)
  • Loading branch information
fabioz committed Jan 20, 2025
1 parent d0f81de commit 37abaeb
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
20 changes: 15 additions & 5 deletions _pydevd_bundle/pydevd_comm.py
Original file line number Diff line number Diff line change
Expand Up @@ -1523,12 +1523,22 @@ def build_exception_info_response(dbg, thread_id, thread, request_seq, set_addit
if IS_PY311_OR_GREATER:
stack_summary = traceback.StackSummary()
for filename_in_utf8, lineno, method_name, line_text, line_col_info in frames[-max_frames:]:
frame_summary = traceback.FrameSummary(filename_in_utf8, lineno, method_name, line=line_text)
if line_col_info is not None:
frame_summary.end_lineno = line_col_info.end_lineno
frame_summary.colno = line_col_info.colno
frame_summary.end_colno = line_col_info.end_colno
stack_summary.append(frame_summary)
# End line might mean that we have a multiline statement.
if line_col_info.end_lineno is not None and lineno < line_col_info.end_lineno:
line_text = "\n".join(linecache.getlines(filename_in_utf8)[lineno : line_col_info.end_lineno + 1])
frame_summary = traceback.FrameSummary(
filename_in_utf8,
lineno,
method_name,
line=line_text,
end_lineno=line_col_info.end_lineno,
colno=line_col_info.colno,
end_colno=line_col_info.end_colno)
stack_summary.append(frame_summary)
else:
frame_summary = traceback.FrameSummary(filename_in_utf8, lineno, method_name, line=line_text)
stack_summary.append(frame_summary)

stack_str = "".join(stack_summary.format())

Expand Down
4 changes: 4 additions & 0 deletions _pydevd_bundle/pydevd_process_net_command_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,10 @@ def _set_debug_options(self, py_db, args, start_reason):
stepping_resumes_all_threads = args.get("steppingResumesAllThreads", True)
self.api.set_stepping_resumes_all_threads(py_db, stepping_resumes_all_threads)

stop_all_threads_on_suspend = args.get("stopAllThreadsOnSuspend")
if stop_all_threads_on_suspend is not None:
py_db.multi_threads_single_notification = stop_all_threads_on_suspend

terminate_child_processes = args.get("terminateChildProcesses", True)
self.api.set_terminate_child_processes(py_db, terminate_child_processes)

Expand Down

0 comments on commit 37abaeb

Please sign in to comment.