diff --git a/artiq/firmware/Cargo.lock b/artiq/firmware/Cargo.lock index d4c926fef..dfddf22e7 100644 --- a/artiq/firmware/Cargo.lock +++ b/artiq/firmware/Cargo.lock @@ -21,6 +21,7 @@ dependencies = [ name = "board" version = "0.0.0" dependencies = [ + "build_artiq 0.0.0", "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] diff --git a/artiq/firmware/liballoc_list/lib.rs b/artiq/firmware/liballoc_list/lib.rs index 8958c1bce..4854575bb 100644 --- a/artiq/firmware/liballoc_list/lib.rs +++ b/artiq/firmware/liballoc_list/lib.rs @@ -104,19 +104,17 @@ unsafe impl<'a> Alloc for &'a ListAlloc { } fn oom(&mut self, err: AllocErr) -> ! { - panic!("cannot allocate: {:?}", err) + panic!("heap view: {}\ncannot allocate: {:?}", self, err) } } -impl ListAlloc { - pub fn debug_dump(&self, f: &mut fmt::Write) -> fmt::Result { +impl fmt::Display for ListAlloc { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { unsafe { let mut total_busy = 0; let mut total_idle = 0; let mut total_meta = 0; - write!(f, "Heap view:\n")?; - let mut curr = self.root; while !curr.is_null() { total_meta += mem::size_of::
();