feat(debuginfo): Add range methods to record structs
@@ -4,6 +4,7 @@ use std::borrow::Cow;
use std::collections::BTreeMap;
use std::error::Error;
use std::fmt;
+use std::ops::Range;
use std::str;
use thiserror::Error;
@@ -362,6 +363,11 @@ impl<'d> BreakpadFuncRecord<'d> {
finished: false,
}
}
+
+ /// Returns the range of addresses covered by this record.
+ pub fn range(&self) -> Range<u64> {
+ self.address..self.address + self.size
+ }
}
impl PartialEq for BreakpadFuncRecord<'_> {
@@ -455,6 +461,11 @@ impl BreakpadLineRecord {
pub fn filename<'d>(&self, file_map: &BreakpadFileMap<'d>) -> Option<&'d str> {
file_map.get(&self.file_id).cloned()
}
+
+ /// Returns the range of addresses covered by this record.
+ pub fn range(&self) -> Range<u64> {
+ self.address..self.address + self.size
+ }
}
/// An iterator over line records in a `BreakpadFunctionRecord`.
@@ -554,6 +565,11 @@ impl<'d> BreakpadStackCfiRecord<'d> {
lines: self.deltas.clone(),
}
}
+
+ /// Returns the range of addresses covered by this record.
+ pub fn range(&self) -> Range<u64> {
+ self.start..self.start + self.size
+ }
}
impl<'d> PartialEq for BreakpadStackCfiRecord<'d> {
@@ -662,6 +678,11 @@ impl<'d> BreakpadStackWinRecord<'d> {
let string = str::from_utf8(data)?;
Ok(parsing::stack_win_record_final(string.trim())?)
}
+
+ /// Returns the range of addresses covered by this record.
+ pub fn code_range(&self) -> Range<u32> {
+ self.code_start..self.code_start + self.code_size
+ }
}
/// Stack frame information record used for stack unwinding and stackwalking.
