MCPcopy Index your code
hub / github.com/RustPython/RustPython / dump_all_threads

Function dump_all_threads

crates/stdlib/src/faulthandler.rs:404–441  ·  view source on GitHub ↗
(fd: i32, vm: &VirtualMachine)

Source from the content-addressed store, hash-verified

402 /// Dump tracebacks of all threads.
403 #[cfg(any(unix, windows))]
404 fn dump_all_threads(fd: i32, vm: &VirtualMachine) {
405 // Get all threads' frame stacks from the shared registry
406 #[cfg(feature = "threading")]
407 {
408 let current_tid = rustpython_vm::stdlib::_thread::get_ident();
409 let registry = vm.state.thread_frames.lock();
410
411 // First dump non-current threads, then current thread last
412 for (&tid, slot) in registry.iter() {
413 if tid == current_tid {
414 continue;
415 }
416 let frames_guard = slot.frames.lock();
417 dump_traceback_thread_frames(fd, tid, false, &frames_guard);
418 puts(fd, "\n");
419 }
420
421 // Now dump current thread (use vm.frames for most up-to-date data)
422 write_thread_id(fd, current_tid, true);
423 let frames = vm.frames.borrow();
424 if frames.is_empty() {
425 puts(fd, " <no Python frame>\n");
426 } else {
427 for fp in frames.iter().rev() {
428 dump_frame_from_ref(fd, unsafe { fp.as_ref() });
429 }
430 }
431 }
432
433 #[cfg(not(feature = "threading"))]
434 {
435 write_thread_id(fd, current_thread_id(), true);
436 let frames = vm.frames.borrow();
437 for fp in frames.iter().rev() {
438 dump_frame_from_ref(fd, unsafe { fp.as_ref() });
439 }
440 }
441 }
442
443 #[derive(FromArgs)]
444 #[allow(unused)]

Callers 1

dump_tracebackFunction · 0.85

Calls 12

putsFunction · 0.85
write_thread_idFunction · 0.85
dump_frame_from_refFunction · 0.85
current_thread_idFunction · 0.70
get_identFunction · 0.50
lockMethod · 0.45
iterMethod · 0.45
borrowMethod · 0.45
is_emptyMethod · 0.45
revMethod · 0.45
as_refMethod · 0.45

Tested by

no test coverage detected