From 7ad54e1dcfc905f4b50fcef9d68547bcacf4fe78 Mon Sep 17 00:00:00 2001 From: whitequark Date: Mon, 2 Oct 2017 02:02:45 +0000 Subject: [PATCH] firmware: unbreak heap view. This was missing since 7799413a for no good reason. --- artiq/firmware/Cargo.lock | 1 + artiq/firmware/liballoc_list/lib.rs | 8 +++----- 2 files changed, 4 insertions(+), 5 deletions(-) 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::
();