forked from M-Labs/artiq
1
0
Fork 0

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 committed by Sebastien Bourdeauducq
parent db8300c990
commit 45c6ca96f8
2 changed files with 4 additions and 5 deletions

View File

@ -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)",
]

View File

@ -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::<Header>();