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

Function dump_frame_from_raw

crates/stdlib/src/faulthandler.rs:253–275  ·  view source on GitHub ↗
(fd: i32, frame: &Frame)

Source from the content-addressed store, hash-verified

251 /// Dump a single frame's info to fd (signal-safe), reading live data.
252 #[cfg(any(unix, windows))]
253 fn dump_frame_from_raw(fd: i32, frame: &Frame) {
254 let filename = frame.code.source_path().as_str();
255 let funcname = frame.code.obj_name.as_str();
256 let lasti = frame.lasti();
257 let lineno = if lasti == 0 {
258 frame.code.first_line_number.map(|n| n.get()).unwrap_or(1) as u32
259 } else {
260 let idx = (lasti as usize).saturating_sub(1);
261 if idx < frame.code.locations.len() {
262 frame.code.locations[idx].0.line.get() as u32
263 } else {
264 frame.code.first_line_number.map(|n| n.get()).unwrap_or(0) as u32
265 }
266 };
267
268 puts(fd, " File \"");
269 dump_ascii(fd, filename);
270 puts(fd, "\", line ");
271 dump_decimal(fd, lineno as usize);
272 puts(fd, " in ");
273 dump_ascii(fd, funcname);
274 puts(fd, "\n");
275 }
276
277 // faulthandler_dump_traceback (signal-safe, for fatal errors)
278 #[cfg(any(unix, windows))]

Callers 1

dump_live_framesFunction · 0.85

Calls 9

putsFunction · 0.85
dump_asciiFunction · 0.85
dump_decimalFunction · 0.85
lastiMethod · 0.80
as_strMethod · 0.45
source_pathMethod · 0.45
mapMethod · 0.45
getMethod · 0.45
lenMethod · 0.45

Tested by

no test coverage detected