Skip to content

Commit

Permalink
[crashtracker] Take relative address and build id for remote symbolic…
Browse files Browse the repository at this point in the history
…ation
  • Loading branch information
danielsn committed Jun 6, 2024
1 parent bcc567a commit 8367483
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
6 changes: 6 additions & 0 deletions crashtracker/src/stacktrace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<String>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default)]
pub ip: Option<String>,
Expand All @@ -33,6 +36,9 @@ pub struct StackFrame {
pub names: Option<Vec<StackFrameNames>>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default)]
pub relative_address: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default)]
pub sp: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default)]
Expand Down
7 changes: 6 additions & 1 deletion profiling-ffi/src/crashtracker/datatypes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
Expand All @@ -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() {
Expand All @@ -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,
})
Expand Down

0 comments on commit 8367483

Please sign in to comment.