From 83674837aa55ecb9575573cc587864ef3219cae8 Mon Sep 17 00:00:00 2001 From: Daniel Schwartz-Narbonne Date: Thu, 6 Jun 2024 12:49:27 -0400 Subject: [PATCH] [crashtracker] Take relative address and build id for remote symbolication --- crashtracker/src/stacktrace.rs | 6 ++++++ profiling-ffi/src/crashtracker/datatypes.rs | 7 ++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/crashtracker/src/stacktrace.rs b/crashtracker/src/stacktrace.rs index 218cd7ceb..86e18056f 100644 --- a/crashtracker/src/stacktrace.rs +++ b/crashtracker/src/stacktrace.rs @@ -22,6 +22,9 @@ pub struct StackFrameNames { /// All fields are hex encoded integers. #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] pub struct StackFrame { + #[serde(skip_serializing_if = "Option::is_none")] + #[serde(default)] + pub build_id: Option, #[serde(skip_serializing_if = "Option::is_none")] #[serde(default)] pub ip: Option, @@ -33,6 +36,9 @@ pub struct StackFrame { pub names: Option>, #[serde(skip_serializing_if = "Option::is_none")] #[serde(default)] + pub relative_address: Option, + #[serde(skip_serializing_if = "Option::is_none")] + #[serde(default)] pub sp: Option, #[serde(skip_serializing_if = "Option::is_none")] #[serde(default)] diff --git a/profiling-ffi/src/crashtracker/datatypes.rs b/profiling-ffi/src/crashtracker/datatypes.rs index 6e9c930f5..83339668d 100644 --- a/profiling-ffi/src/crashtracker/datatypes.rs +++ b/profiling-ffi/src/crashtracker/datatypes.rs @@ -295,9 +295,11 @@ impl<'a> TryFrom<&StackFrameNames<'a>> for datadog_crashtracker::StackFrameNames #[repr(C)] pub struct StackFrame<'a> { + build_id: CharSlice<'a>, ip: usize, module_base_address: usize, names: Slice<'a, StackFrameNames<'a>>, + relative_address: usize, sp: usize, symbol_address: usize, } @@ -313,7 +315,7 @@ impl<'a> TryFrom<&StackFrame<'a>> for datadog_crashtracker::StackFrame { Some(format!("{v:#X}")) } } - + let build_id = option_from_char_slice(value.build_id)?; let ip = to_hex(value.ip); let module_base_address = to_hex(value.module_base_address); let names = if value.names.is_empty() { @@ -325,12 +327,15 @@ impl<'a> TryFrom<&StackFrame<'a>> for datadog_crashtracker::StackFrame { } Some(vec) }; + let relative_address = to_hex(value.relative_address); let sp = to_hex(value.sp); let symbol_address = to_hex(value.symbol_address); Ok(Self { + build_id, ip, module_base_address, names, + relative_address, sp, symbol_address, })