stacktrack_snapshot/
lib.rs1use flex_fuchsia_memory_stacktrack_client as fstacktrack_client;
6use thiserror::Error;
7
8mod snapshot;
9pub use snapshot::{CallFrame, ExecutableRegion, Snapshot, StackTrace};
10
11mod streamer;
12pub use streamer::Streamer;
13
14#[derive(Debug, Error)]
15pub enum Error {
16 #[error("Missing expected field {} in {}", .field, .container)]
17 MissingField { container: &'static str, field: &'static str },
18 #[error("SnapshotReceiver stream ended unexpectedly")]
19 UnexpectedEndOfStream,
20 #[error("SnapshotReceiver stream contains an unknown element type")]
21 UnexpectedElementType,
22 #[error("SnapshotReceiver stream contains conflicting {} elements", .element_type)]
23 ConflictingElement { element_type: &'static str },
24 #[error("A page size was expected in the SnapshotReceiver stream")]
25 PageSizeMissing,
26 #[error("FIDL error: {}", .0)]
27 FidlError(#[from] fidl::Error),
28 #[cfg(feature = "fdomain")]
29 #[error("FDomain error: {}", .0)]
30 FDomainError(#[from] fdomain_client::Error),
31 #[error("Collector error: {:?}", .0)]
32 CollectorError(fstacktrack_client::CollectorError),
33}
34
35#[cfg(test)]
37pub(crate) mod test_helpers {
38 #[cfg(feature = "fdomain")]
39 pub fn create_client() -> std::sync::Arc<fdomain_client::Client> {
40 fdomain_local::local_client_empty()
41 }
42
43 #[cfg(not(feature = "fdomain"))]
44 pub fn create_client() -> fidl::endpoints::ZirconClient {
45 fidl::endpoints::ZirconClient
46 }
47}