diff --git a/parser/src/file/dwarf.rs b/parser/src/file/dwarf.rs index c276993..14a243e 100644 --- a/parser/src/file/dwarf.rs +++ b/parser/src/file/dwarf.rs @@ -3680,11 +3680,14 @@ where // Skip and Call could be implemented if needed. return Ok(pieces); } - gimli::Operation::WasmLocal { .. } - | gimli::Operation::WasmGlobal { .. } - | gimli::Operation::WasmStack { .. } => { - // Unimplemented. - location = Some((Location::Other, false)); + gimli::Operation::WasmLocal { index } => { + location = Some((Location::WasmLocal { index }, false)); + } + gimli::Operation::WasmGlobal { index } => { + location = Some((Location::WasmGlobal { index }, false)); + } + gimli::Operation::WasmStack { index } => { + location = Some((Location::WasmStack { index }, false)); } } if let Some((location, is_value)) = location { @@ -3707,6 +3710,11 @@ where Size::new(size_in_bits), ); } + // https://docs.rs/gimli/latest/gimli/read/enum.Operation.html#variant.StackValue + // Commonly used for Wasm to terminate the expression. + gimli::Operation::StackValue => { + add_piece(&mut pieces, location, 0, is_value, Size::none()); + } _ => { return Err(gimli::Error::InvalidPiece.into()); } diff --git a/parser/src/location.rs b/parser/src/location.rs index dd85872..374e4d4 100644 --- a/parser/src/location.rs +++ b/parser/src/location.rs @@ -81,6 +81,21 @@ pub enum Location { /// The offset. offset: u64, }, + /// The value is stored in a Wasm local + WasmLocal { + /// The index of the local + index: u32, + }, + /// The value is stored in a Wasm global + WasmGlobal { + /// The index of the global + index: u32, + }, + /// The value is stored on the Wasm stack + WasmStack { + /// The index in the stack + index: u32, + }, /// The value is more complex than any of the above variants. Other, }