diff --git a/rts/motoko-rts-tests/src/gc/heap.rs b/rts/motoko-rts-tests/src/gc/heap.rs index 4620c76a414..3d895b18090 100644 --- a/rts/motoko-rts-tests/src/gc/heap.rs +++ b/rts/motoko-rts-tests/src/gc/heap.rs @@ -93,6 +93,19 @@ impl MotokoHeap { pub fn heap(&self) -> Ref> { Ref::map(self.inner.borrow(), |heap| &heap.heap) } + + /// Print heap contents to stdout, for debugging purposes. + #[allow(unused)] + pub fn dump(&self) { + unsafe { + motoko_rts::debug::dump_heap( + self.heap_base_address() as u32, + self.heap_ptr_address() as u32, + Value::from_ptr(self.static_root_array_address()), + self.continuation_table_ptr_address() as *mut Value, + ); + } + } } struct MotokoHeapInner {