: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
fix(cymbal): normalize go abi-wrapper suffixes in resolved frame names (#72568)
Catalin Irimiedd9bf6305248
diff --git a/rust/cymbal/src/core/types/langs/native.rs b/rust/cymbal/src/core/types/langs/native.rsindex 2612a1fa95b4..fd13c29a489e 100644--- a/rust/cymbal/src/core/types/langs/native.rs+++ b/rust/cymbal/src/core/types/langs/native.rs@@ -306,6 +306,32 @@ impl RawNativeFrame {self.meta.in_app && !source_path.is_some_and(is_library_source_path)}+ /// Go's toolchain suffixes dual-ABI wrapper symbols in the debug info+ /// (`runtime.goexit.abi0`), while the Go runtime — and therefore the+ /// client's own frames — reports the plain name. Strip the suffix so kept+ /// and replaced groups agree on the name vocabulary: resolved names feed+ /// fingerprints, so a mismatch splits the same crash across issues when+ /// symbols get uploaded.+ ///+ /// `abi0`/`abiinternal` are also valid Go identifiers (`pkg.abi0` can be+ /// a real function), so the suffix is only dropped when the client+ /// reported exactly the un-suffixed name for this frame — evidence it is+ /// toolchain metadata rather than part of the name. Wrappers are physical+ /// assembly functions, so the client name is present for them.+ fn display_name_for(&self, symbol_info: &SymbolInfo) -> String {+ let name = &symbol_info.display_name;+ if self.lang.as_deref() == Some("go") {+ for suffix in [".abi0", ".abiinternal"] {+ if let Some(stripped) = name.strip_suffix(suffix) {+ if self.function.as_deref() == Some(stripped) {+ return stripped.to_string();+ }+ }+ }+ }+ name.clone()+ }+fn build_resolved_frame(&self, symbol_info: &SymbolInfo) -> Frame {let mut f = Frame {frame_id: FrameId::placeholder(),@@ -318,7 +344,7 @@ impl RawNativeFrame {column: None,source: symbol_info.filename.clone(),in_app: self.in_app_for(symbol_info.full_path.as_deref()),- resolved_name: Some(symbol_info.display_name.clone()),+ resolved_name: Some(self.display_name_for(symbol_info)),lang: self.lang_for(symbol_info.filename.as_deref()),resolved: true,resolve_failure: None,@@ -773,6 +799,84 @@ mod test {assert!(matches!(result, Err(NativeError::InvalidAddress(_))));}+ // Go frames drop the toolchain's ABI-wrapper suffix so server-resolved+ // names match what the Go runtime (and so the client's kept frames)+ // reports — but only when the client's own name confirms the suffix is+ // toolchain metadata; `pkg.abi0` can be a real function. Other languages+ // keep the symbol verbatim.+ #[test]+ fn go_resolved_names_drop_abi_wrapper_suffixes() {+ let cases = [+ (+ Some("go"),+ Some("runtime.goexit"),+ "runtime.goexit.abi0",+ "runtime.goexit",+ ),+ (+ Some("go"),+ Some("runtime.main"),+ "runtime.main.abiinternal",+ "runtime.main",+ ),+ (Some("go"), Some("main.main"), "main.main", "main.main"),+ // A genuine function named abi0: client and debug info agree, so+ // nothing is stripped.+ (Some("go"), Some("pkg.abi0"), "pkg.abi0", "pkg.abi0"),+ // No client name means no evidence the suffix is a wrapper.+ (+ Some("go"),+ None,+ "runtime.goexit.abi0",+ "runtime.goexit.abi0",+ ),+ (+ Some("rust"),+ Some("alloc::alloc"),+ "alloc::alloc.abi0",+ "alloc::alloc.abi0",+ ),+ (+ None,+ Some("runtime.goexit"),+ "runtime.goexit.abi0",+ "runtime.goexit.abi0",+ ),+ ];++ for (lang, client_function, symbol, expected) in cases {+ let frame = RawNativeFrame {+ instruction_addr: Some("0x1000".to_string()),+ symbol_addr: None,+ image_addr: Some("0x1000".to_string()),+ lang: lang.map(String::from),+ module: None,+ function: client_function.map(String::from),+ filename: None,+ lineno: None,+ colno: None,+ client_resolved: true,+ inline: false,+ meta: CommonFrameMetadata::default(),+ };+ let symbol_info = SymbolInfo {+ display_name: symbol.to_string(),+ full_name: symbol.to_string(),+ filename: None,+ full_path: None,+ line: 42,+ };++ let resolved = frame.build_resolved_frame(&symbol_info);+ assert_eq!(+ resolved.resolved_name.as_deref(),+ Some(expected),+ "lang={lang:?} symbol={symbol}"+ );+ assert_eq!(resolved.mangled_name, symbol, "full name stays verbatim");+ }+ }+#[test]fn test_find_debug_image_by_image_addr() {let debug_images = vec![