Open Dueesberch opened 9 months ago
I observed this behavior as well. In my case, the assembler code varied slightly but led to the same effect
(gdb) disassemble /m
Dump of assembler code for function _ZN12led_roulette18__cortex_m_rt_main17h327bbe3f14bd160dE:
8 fn main() -> ! {
0x080001ea <+0>: sub sp, #8
0x080001ec <+2>: movs r0, #42 @ 0x2a
9 let _y;
10 let x = 42;
=> 0x080001ee <+4>: str r0, [sp, #0]
0x080001f0 <+6>: str r0, [sp, #4]
The register is initialized with the value 42 (0x2a) and then the variables are initialized to that value, leading to the inspection sequence:
(gdb) stepi
halted: PC: 0x080001ec
0x080001ec 8 fn main() -> ! {
(gdb) info locals
No locals.
(gdb) stepi
halted: PC: 0x080001ee
10 let x = 42;
(gdb) info locals
x = 42
_y = 42
I also tried building and running with inline-threshold=0
and opt-level=0
but that didn't change the assembly code.
I try to debug the led roulette example. When I follow the step by step instructions it goes from
let x = 42
toloop{}
disassemble the code gives meNo assembler instruction after
_y = x;
shows
unoptimized + debuginfo
If I run
print _y
afterlet _y;
I already get$1 = 42
How to get really unoptimized code?