Skip to content

Commit 37abaeb

Browse files
committed
Add stopAllThreadsOnSuspend to launch config, fixed issue getting exception stack (ported from debugpy)
1 parent d0f81de commit 37abaeb

File tree

2 files changed

+19
-5
lines changed

2 files changed

+19
-5
lines changed

_pydevd_bundle/pydevd_comm.py

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1523,12 +1523,22 @@ def build_exception_info_response(dbg, thread_id, thread, request_seq, set_addit
15231523
if IS_PY311_OR_GREATER:
15241524
stack_summary = traceback.StackSummary()
15251525
for filename_in_utf8, lineno, method_name, line_text, line_col_info in frames[-max_frames:]:
1526-
frame_summary = traceback.FrameSummary(filename_in_utf8, lineno, method_name, line=line_text)
15271526
if line_col_info is not None:
1528-
frame_summary.end_lineno = line_col_info.end_lineno
1529-
frame_summary.colno = line_col_info.colno
1530-
frame_summary.end_colno = line_col_info.end_colno
1531-
stack_summary.append(frame_summary)
1527+
# End line might mean that we have a multiline statement.
1528+
if line_col_info.end_lineno is not None and lineno < line_col_info.end_lineno:
1529+
line_text = "\n".join(linecache.getlines(filename_in_utf8)[lineno : line_col_info.end_lineno + 1])
1530+
frame_summary = traceback.FrameSummary(
1531+
filename_in_utf8,
1532+
lineno,
1533+
method_name,
1534+
line=line_text,
1535+
end_lineno=line_col_info.end_lineno,
1536+
colno=line_col_info.colno,
1537+
end_colno=line_col_info.end_colno)
1538+
stack_summary.append(frame_summary)
1539+
else:
1540+
frame_summary = traceback.FrameSummary(filename_in_utf8, lineno, method_name, line=line_text)
1541+
stack_summary.append(frame_summary)
15321542

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

_pydevd_bundle/pydevd_process_net_command_json.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,10 @@ def _set_debug_options(self, py_db, args, start_reason):
349349
stepping_resumes_all_threads = args.get("steppingResumesAllThreads", True)
350350
self.api.set_stepping_resumes_all_threads(py_db, stepping_resumes_all_threads)
351351

352+
stop_all_threads_on_suspend = args.get("stopAllThreadsOnSuspend")
353+
if stop_all_threads_on_suspend is not None:
354+
py_db.multi_threads_single_notification = stop_all_threads_on_suspend
355+
352356
terminate_child_processes = args.get("terminateChildProcesses", True)
353357
self.api.set_terminate_child_processes(py_db, terminate_child_processes)
354358

0 commit comments

Comments
 (0)