From 88faf87574004f0e0eaa63d69687e3ddad28b838 Mon Sep 17 00:00:00 2001 From: Dangyi Liu Date: Wed, 9 Aug 2023 14:56:56 -0700 Subject: [PATCH] Use extended symbolization markup on Fuchsia {{{reset:begin/end}}} pair will allow symbolization to be performed on the whole stack rather than invidival frames. --- src/print.rs | 3 ++- src/print/fuchsia.rs | 7 ++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/print.rs b/src/print.rs index 8d9cbe3d4..395328a0a 100644 --- a/src/print.rs +++ b/src/print.rs @@ -83,7 +83,8 @@ impl<'a, 'b> BacktraceFmt<'a, 'b> { /// This is currently a no-op but is added for future compatibility with /// backtrace formats. pub fn finish(&mut self) -> fmt::Result { - // Currently a no-op-- including this hook to allow for future additions. + #[cfg(target_os = "fuchsia")] + fuchsia::finish_context(self.fmt)?; Ok(()) } diff --git a/src/print/fuchsia.rs b/src/print/fuchsia.rs index ce3f17862..cb872697d 100644 --- a/src/print/fuchsia.rs +++ b/src/print/fuchsia.rs @@ -425,7 +425,7 @@ impl DsoPrinter<'_, '_> { /// This function prints the Fuchsia symbolizer markup for all information contained in a DSO. pub fn print_dso_context(out: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - out.write_str("{{{reset}}}\n")?; + out.write_str("{{{reset:begin}}}\n")?; let mut visitor = DsoPrinter { writer: out, module_count: 0, @@ -434,3 +434,8 @@ pub fn print_dso_context(out: &mut core::fmt::Formatter<'_>) -> core::fmt::Resul for_each_dso(&mut visitor); visitor.error } + +/// This function prints the Fuchsia symbolizer markup to end the backtrace. +pub fn finish_context(out: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + out.write_str("{{{reset:end}}}\n") +}