top | item 12208468

(no title)

SimonSapin | 9 years ago

I now have a "more real" panic_fmt in the repository:

    #[lang = "panic_fmt"]
    extern fn panic_fmt(details: ::core::fmt::Arguments, file: &'static str, line: u32) -> ! {
        println!("Panic at {}:{}, {}", file, line, details);
        let row_2 = ::gpio::Pin::output(::pins::ROW_2);
        let col_3 = ::gpio::Pin::output(::pins::COL_3);
        row_2.set_high();
        loop {
            col_3.set_low();
            ::busy_loop::wait_approx_ms(5);
            col_3.set_high();
            ::busy_loop::wait_approx_ms(200);
        }
    }
Note that println! is a macro I defined myself, it writes to the serial port.

I still don’t know about eh_personality, though.

discuss

order

jdub|9 years ago

wrt eh_personality, there's a good short answer with a link to a good (very!) long answer here:

http://stackoverflow.com/questions/16597350/what-is-an-excep...

zokier|9 years ago

So basically if I got it right, non-terminating panic_fmt and empty eh_personality means that we don't get stack unwinding at all, which also means that destructors don't get called. That could be fairly important for RAII heavy code.

jdub|9 years ago

Now that's a cute panic_fmt. :-)