:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
feat(symbol-data): add ElfDebugInfo container type (#62586)
Catalin Irimie3438b4d5d1d0
diff --git a/rust/Cargo.lock b/rust/Cargo.lockindex 724572001472..52cb45b8518e 100644--- a/rust/Cargo.lock+++ b/rust/Cargo.lock@@ -7364,7 +7364,7 @@ dependencies = [[[package]]name = "posthog-symbol-data"-version = "0.4.0"+version = "0.5.0"dependencies = ["serde","thiserror 2.0.18",diff --git a/rust/common/symbol_data/Cargo.toml b/rust/common/symbol_data/Cargo.tomlindex c2470cf231f8..370d925393ef 100644--- a/rust/common/symbol_data/Cargo.toml+++ b/rust/common/symbol_data/Cargo.toml@@ -1,6 +1,6 @@[package]name = "posthog-symbol-data"-version = "0.4.0"+version = "0.5.0"authors = ["David <[email protected]>","Olly <[email protected]>",diff --git a/rust/common/symbol_data/src/data_types/elf.rs b/rust/common/symbol_data/src/data_types/elf.rsnew file mode 100644index 000000000000..6531aa277ca5--- /dev/null+++ b/rust/common/symbol_data/src/data_types/elf.rs@@ -0,0 +1,23 @@+use crate::symbol_data::{SymbolData, SymbolDataType};++/// Debug information for a native ELF binary, packaged as a ZIP with the+/// DWARF-bearing binary stored as `dwarf` at the root plus an optional+/// `__source/` bundle — the same layout as `AppleDsym`.+#[derive(Debug, Clone, PartialEq, Eq)]+pub struct ElfDebugInfo {+ pub data: Vec<u8>,+}++impl SymbolData for ElfDebugInfo {+ fn from_bytes(data: Vec<u8>) -> Result<Self, crate::SymbolDataError> {+ Ok(Self { data })+ }++ fn into_bytes(self) -> Vec<u8> {+ self.data+ }++ fn data_type() -> SymbolDataType {+ SymbolDataType::ElfDebugInfo+ }+}diff --git a/rust/common/symbol_data/src/data_types/mod.rs b/rust/common/symbol_data/src/data_types/mod.rsindex 5609b922b231..2bfe927e6811 100644--- a/rust/common/symbol_data/src/data_types/mod.rs+++ b/rust/common/symbol_data/src/data_types/mod.rs@@ -1,4 +1,5 @@pub mod dsym;+pub mod elf;pub mod hermesmap;pub mod proguard;pub mod sourcemap;diff --git a/rust/common/symbol_data/src/lib.rs b/rust/common/symbol_data/src/lib.rsindex e056d34379e6..e92bf0ebdf87 100644--- a/rust/common/symbol_data/src/lib.rs+++ b/rust/common/symbol_data/src/lib.rs@@ -23,3 +23,6 @@ pub use data_types::proguard::ProguardMapping;// Apple dSYMpub use data_types::dsym::AppleDsym;++// Native (ELF) debug info+pub use data_types::elf::ElfDebugInfo;diff --git a/rust/common/symbol_data/src/symbol_data.rs b/rust/common/symbol_data/src/symbol_data.rsindex c2a287be61d1..7e8ea8314b81 100644--- a/rust/common/symbol_data/src/symbol_data.rs+++ b/rust/common/symbol_data/src/symbol_data.rs@@ -12,6 +12,7 @@ pub enum SymbolDataType {HermesMap = 3,ProguardMapping = 4,AppleDsym = 5,+ ElfDebugInfo = 6,}#[derive(Debug, Clone, Copy, PartialEq, Eq)]diff --git a/rust/common/symbol_data/tests/test.rs b/rust/common/symbol_data/tests/test.rsindex f0be19b08a8a..fa6576ab4991 100644--- a/rust/common/symbol_data/tests/test.rs+++ b/rust/common/symbol_data/tests/test.rs@@ -1,6 +1,6 @@use posthog_symbol_data::{- read_symbol_data, write_symbol_data, write_symbol_data_uncompressed, HermesMap,- ProguardMapping, SourceAndMap,+ read_symbol_data, write_symbol_data, write_symbol_data_uncompressed, AppleDsym, ElfDebugInfo,+ HermesMap, ProguardMapping, SourceAndMap,};const MAGIC_LEN: usize = b"posthog_error_tracking".len();@@ -88,6 +88,31 @@ roundtrip_test!(content: "proguard mapping data".to_string(),});+roundtrip_test!(+ test_v2_roundtrip_elf_debug_info,+ ElfDebugInfo,+ ElfDebugInfo {+ data: b"\x7fELF fake debug payload".to_vec(),+ }+);++#[test]+fn test_cross_type_reads_fail() {+ // Consumers that accept multiple container types dispatch on the type tag,+ // so a type mismatch must be an error rather than a silent+ // reinterpretation — in both directions.+ let elf_bytes = write_symbol_data(ElfDebugInfo {+ data: b"\x7fELF fake debug payload".to_vec(),+ })+ .unwrap();+ assert!(read_symbol_data::<AppleDsym>(&elf_bytes).is_err());++ let dsym_bytes = write_symbol_data(AppleDsym {+ data: b"fake dsym zip payload".to_vec(),+ })+ .unwrap();+ assert!(read_symbol_data::<ElfDebugInfo>(&dsym_bytes).is_err());+}#[test]fn test_v2_compressed_large_payload() {