Skip to content
Snippets Groups Projects
Commit e07aefa0 authored by Emil Kitti's avatar Emil Kitti
Browse files

bare0_4

parent fac2151c
No related branches found
No related tags found
No related merge requests found
...@@ -25,7 +25,7 @@ fn main() { ...@@ -25,7 +25,7 @@ fn main() {
unsafe { unsafe {
X = X.wrapping_add(1); X = X.wrapping_add(1);
Y = X; Y = X;
assert!(x == X && X == Y); assert!(x == X && X == Y + 1);
} }
} }
} }
...@@ -63,7 +63,7 @@ fn main() { ...@@ -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 // 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(); // 454 asm::bkpt();
// //
// An interrupt is triggered! // Overflow is detected and program !panics
// //
// commit your answers (bare0_2) // commit your answers (bare0_2)
// //
...@@ -100,7 +100,22 @@ fn main() { ...@@ -100,7 +100,22 @@ fn main() {
// you have some fault in the program and go back to 3) // 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 // 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) // commit your answers (bare0_4)
// //
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment