diff --git a/examples/bare0.rs b/examples/bare0.rs index f65ca9b87971be6d8e8b2384db88fdedb2898cfe..075a76296f439e549c59ea70c96c9f6c31f46c9d 100644 --- a/examples/bare0.rs +++ b/examples/bare0.rs @@ -25,7 +25,7 @@ fn main() { unsafe { X = X.wrapping_add(1); Y = X; - assert!(x == X && X == Y); + assert!(x == X && X == Y + 1); } } } @@ -63,7 +63,7 @@ fn main() { // cortex_m_rt::default_handler (ef=0x20017e68) at /home/kitzin/.cargo/registry/src/github.com-1ecc6299db9ec823/cortex-m-rt-0.3.12/src/lib.rs:454 // 454 asm::bkpt(); // -// An interrupt is triggered! +// Overflow is detected and program !panics // // commit your answers (bare0_2) // @@ -100,7 +100,22 @@ fn main() { // you have some fault in the program and go back to 3) // // 4. change the asserion to assert!(x == X && X == Y + 1), what happens -// ** place your answer here ** +// +// (gdb) next +// 28 assert!(x == X && X == Y + 1); +// (gdb) next +// +// Program received signal SIGTRAP, Trace/breakpoint trap. +// cortex_m_rt::default_handler (ef=0x20017e60) at /home/kitzin/.cargo/registry/src/github.com-1ecc6299db9ec823/cortex-m-rt-0.3.12/src/lib.rs:454 +// 454 asm::bkpt(); +// (gdb) print bare0::X +// $72 = 0 +// (gdb) print bare0::Y +// $73 = 0 +// +// +// The assert condition (0 == 1) is false and it !panics +// // // commit your answers (bare0_4) //