firmware: unbreak heap view.

This was missing since 7799413a for no good reason.
This commit is contained in:
whitequark 2017-10-02 02:02:45 +00:00
parent e59b301a3b
commit 7ad54e1dcf
2 changed files with 4 additions and 5 deletions

View File

@ -21,6 +21,7 @@ dependencies = [
name = "board" name = "board"
version = "0.0.0" version = "0.0.0"
dependencies = [ dependencies = [
"build_artiq 0.0.0",
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
] ]

View File

@ -104,19 +104,17 @@ unsafe impl<'a> Alloc for &'a ListAlloc {
} }
fn oom(&mut self, err: AllocErr) -> ! { fn oom(&mut self, err: AllocErr) -> ! {
panic!("cannot allocate: {:?}", err) panic!("heap view: {}\ncannot allocate: {:?}", self, err)
} }
} }
impl ListAlloc { impl fmt::Display for ListAlloc {
pub fn debug_dump(&self, f: &mut fmt::Write) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
unsafe { unsafe {
let mut total_busy = 0; let mut total_busy = 0;
let mut total_idle = 0; let mut total_idle = 0;
let mut total_meta = 0; let mut total_meta = 0;
write!(f, "Heap view:\n")?;
let mut curr = self.root; let mut curr = self.root;
while !curr.is_null() { while !curr.is_null() {
total_meta += mem::size_of::<Header>(); total_meta += mem::size_of::<Header>();