Skip to content

Commit 33e9dee

Browse files
authored
feat: Add missing support for WASM images/frames (#333)
1 parent 598816f commit 33e9dee

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed

sentry-types/src/protocol/v7.rs

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,13 @@ pub struct Frame {
230230
/// If known the location of symbol.
231231
#[serde(default, skip_serializing_if = "Option::is_none")]
232232
pub symbol_addr: Option<Addr>,
233+
/// Optionally changes the addressing mode. The default value is the same as
234+
/// `"abs"` which means absolute referencing. This can also be set to
235+
/// `"rel:DEBUG_ID"` or `"rel:IMAGE_INDEX"` to make addresses relative to an
236+
/// object referenced by debug id or index. This for instance is necessary
237+
/// for WASM processing as WASM does not use a unified address space.
238+
#[serde(default, skip_serializing_if = "Option::is_none")]
239+
pub addr_mode: Option<String>,
233240
}
234241

235242
/// Represents template debug info.
@@ -914,6 +921,9 @@ pub enum DebugImage {
914921
Symbolic(SymbolicDebugImage),
915922
/// A reference to a proguard debug file.
916923
Proguard(ProguardDebugImage),
924+
/// Image used for WebAssembly. Their structure is identical to other native
925+
/// images.
926+
Wasm(WasmDebugImage),
917927
}
918928

919929
impl DebugImage {
@@ -923,6 +933,7 @@ impl DebugImage {
923933
DebugImage::Apple(..) => "apple",
924934
DebugImage::Symbolic(..) => "symbolic",
925935
DebugImage::Proguard(..) => "proguard",
936+
DebugImage::Wasm(..) => "wasm",
926937
}
927938
}
928939
}
@@ -984,9 +995,32 @@ pub struct ProguardDebugImage {
984995
pub uuid: Uuid,
985996
}
986997

998+
/// Represents a WebAssembly debug image.
999+
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq)]
1000+
pub struct WasmDebugImage {
1001+
/// The name of the debug image (usually filename)
1002+
pub name: String,
1003+
/// Identifier of the dynamic library or executable.
1004+
pub debug_id: Uuid,
1005+
/// Name or absolute URL to the WASM file containing debug information for
1006+
/// this image. This value might be required to retrieve debug files from
1007+
/// certain symbol servers. This should correspond to the externalized URL
1008+
/// pulled from the external_debug_info custom section.
1009+
#[serde(default, skip_serializing_if = "Option::is_none")]
1010+
pub debug_file: Option<String>,
1011+
/// Identifier of the WASM file. It is the value of the build_id custom
1012+
/// section formatted as HEX string.
1013+
#[serde(default, skip_serializing_if = "Option::is_none")]
1014+
pub code_id: Option<String>,
1015+
/// The absolute URL to the wasm file. This helps to locate the file if it
1016+
/// is missing on Sentry.
1017+
pub code_file: String,
1018+
}
1019+
9871020
into_debug_image!(Apple, AppleDebugImage);
9881021
into_debug_image!(Symbolic, SymbolicDebugImage);
9891022
into_debug_image!(Proguard, ProguardDebugImage);
1023+
into_debug_image!(Wasm, WasmDebugImage);
9901024

9911025
/// Represents debug meta information.
9921026
#[derive(Serialize, Deserialize, Debug, Default, Clone, PartialEq)]

sentry-types/tests/test_protocol_v7.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -932,6 +932,7 @@ mod test_exception {
932932
image_addr: Some(v7::Addr(0)),
933933
instruction_addr: Some(v7::Addr(0)),
934934
symbol_addr: Some(v7::Addr(0)),
935+
addr_mode: None,
935936
}],
936937
frames_omitted: Some((1, 2)),
937938
registers: {

0 commit comments

Comments
 (0)