Skip to content

Commit aa28490

Browse files
authored
Add write::Expression::op_variable_value (#867)
1 parent 5c19f68 commit aa28490

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

src/write/op.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,11 @@ impl Expression {
193193
self.operations.push(Operation::CallRef(entry));
194194
}
195195

196+
/// Add a `DW_OP_variable_value` operation to the expression.
197+
pub fn op_variable_value(&mut self, entry: DebugInfoRef) {
198+
self.operations.push(Operation::VariableValue(entry));
199+
}
200+
196201
/// Add a `DW_OP_convert` or `DW_OP_GNU_convert` operation to the expression.
197202
///
198203
/// `base` is the DIE of the base type, or `None` for the generic type.
@@ -1387,6 +1392,13 @@ mod tests {
13871392
offset: read::DieReference::DebugInfoRef(x.debug_info_offset),
13881393
},
13891394
),
1395+
(
1396+
&|x| x.op_variable_value(reference),
1397+
Operation::VariableValue(reference),
1398+
&|x| read::Operation::VariableValue {
1399+
offset: x.debug_info_offset,
1400+
},
1401+
),
13901402
(
13911403
&|x| x.op(constants::DW_OP_form_tls_address),
13921404
Operation::Simple(constants::DW_OP_form_tls_address),
@@ -1495,6 +1507,11 @@ mod tests {
14951507
base_type: x.entry_offset,
14961508
},
14971509
),
1510+
(
1511+
&|x| x.op(constants::DW_OP_GNU_uninit),
1512+
Operation::Simple(constants::DW_OP_GNU_uninit),
1513+
&|_| read::Operation::Uninitialized,
1514+
),
14981515
(
14991516
&|x| x.op_wasm_local(1000),
15001517
Operation::WasmLocal(1000),
@@ -1610,6 +1627,7 @@ mod tests {
16101627
*entry = *convert_entry_id;
16111628
}
16121629
Operation::CallRef(entry)
1630+
| Operation::VariableValue(entry)
16131631
| Operation::ImplicitPointer { entry, .. } => {
16141632
*entry = DebugInfoRef::Entry(convert_unit_id, *convert_entry_id);
16151633
}

0 commit comments

Comments
 (0)