You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I try to debug the led roulette example. When I follow the step by step instructions it goes from let x = 42 to loop{}
disassemble the code gives me
(gdb) disassemble /m
Dump of assembler code for function _ZN12led_roulette18__cortex_m_rt_main17h6f63a1cfdbf5915cE:
8 fn main() -> ! {
0x080001ea <+0>: sub sp, #8
0x080001ec <+2>: movs r0, #42 @ 0x2a
9 let _y;
=> 0x080001ee <+4>: str r0, [sp, #0]
10 let x = 42;
0x080001f0 <+6>: str r0, [sp, #4]
11 _y = x;
12
13 // infinite loop; just so we don't leave this stack frame
14 loop {}
0x080001f2 <+8>: b.n 0x80001f4 <led_roulette::__cortex_m_rt_main+10>
0x080001f4 <+10>: b.n 0x80001f4 <led_roulette::__cortex_m_rt_main+10>
End of assembler dump.
No assembler instruction after _y = x;
cargo readobj --target thumbv7em-none-eabihf --bin led-roulette -- --file-header
Finished dev [unoptimized + debuginfo] target(s) in 0.02s
warning: the following packages contain code that will be rejected by a future version of Rust: stm32f3xx-hal v0.7.0
note: to see what the problems were, use the option `--future-incompat-report`, or run `cargo report future-incompatibilities --id 1`
ELF Header:
Magic: 7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00
Class: ELF32
Data: 2's complement, little endian
Version: 1 (current)
OS/ABI: UNIX - System V
ABI Version: 0
Type: EXEC (Executable file)
Machine: ARM
Version: 0x1
Entry point address: 0x8000195
Start of program headers: 52 (bytes into file)
Start of section headers: 766656 (bytes into file)
Flags: 0x5000400
Size of this header: 52 (bytes)
Size of program headers: 32 (bytes)
Number of program headers: 4
Size of section headers: 40 (bytes)
Number of section headers: 22
Section header string table index: 20
shows unoptimized + debuginfo
If I run print _y after let _y; I already get $1 = 42
How to get really unoptimized code?
The text was updated successfully, but these errors were encountered:
Dueesberch
changed the title
[Chapter 05] seems optimized
[Chapter 5.3] compiled code seems to be optimized
Feb 20, 2024
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 me
No 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?
The text was updated successfully, but these errors were encountered: