name: Option<Vec<u8>>,
filename: Option<BytesOrWide>,
lineno: Option<u32>,
+ colno: Option<u32>,
}
enum BytesOrWide {
impl fmt::Debug for BacktraceSymbol {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
+ // FIXME: improve formatting: https://github.com/rust-lang/rust/issues/65280
+ // FIXME: Also, include column numbers into the debug format as Display already has them.
+ // Until there are stable per-frame accessors, the format shouldn't be changed:
+ // https://github.com/rust-lang/rust/issues/65280#issuecomment-638966585
write!(fmt, "{{ ")?;
if let Some(fn_name) = self.name.as_ref().map(|b| backtrace_rs::SymbolName::new(b)) {
write!(fmt, ", file: \"{:?}\"", fname)?;
}
- if let Some(line) = self.lineno.as_ref() {
+ if let Some(line) = self.lineno {
write!(fmt, ", line: {:?}", line)?;
}
f.print_raw(frame.frame.ip(), None, None, None)?;
} else {
for symbol in frame.symbols.iter() {
- f.print_raw(
+ f.print_raw_with_column(
frame.frame.ip(),
symbol.name.as_ref().map(|b| backtrace_rs::SymbolName::new(b)),
symbol.filename.as_ref().map(|b| match b {
BytesOrWide::Wide(w) => BytesOrWideString::Wide(w),
}),
symbol.lineno,
+ symbol.colno,
)?;
}
}
BytesOrWideString::Wide(b) => BytesOrWide::Wide(b.to_owned()),
}),
lineno: symbol.lineno(),
+ colno: symbol.colno(),
});
});
}
name: Some(b"std::backtrace::Backtrace::create".to_vec()),
filename: Some(BytesOrWide::Bytes(b"rust/backtrace.rs".to_vec())),
lineno: Some(100),
+ colno: None,
}],
},
BacktraceFrame {
name: Some(b"__rust_maybe_catch_panic".to_vec()),
filename: None,
lineno: None,
+ colno: None,
}],
},
BacktraceFrame {
name: Some(b"std::rt::lang_start_internal".to_vec()),
filename: Some(BytesOrWide::Bytes(b"rust/rt.rs".to_vec())),
lineno: Some(300),
+ colno: Some(5),
},
BacktraceSymbol {
name: Some(b"std::rt::lang_start".to_vec()),
filename: Some(BytesOrWide::Bytes(b"rust/rt.rs".to_vec())),
lineno: Some(400),
+ colno: None,
},
],
},