Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[5.3] Different available breakpoints (dev build) compared to book #531

Open
PieterJanVdb opened this issue Jun 20, 2023 · 6 comments
Open

Comments

@PieterJanVdb
Copy link

PieterJanVdb commented Jun 20, 2023

Not entirely sure what is happening here, I'm guessing it's some compiler optimization, but I can't seem to put a breakpoint on line 13 as shown in the chapter. Instead it only allows me to break on line 12 and line 16 (the loop).

The asm TUI looks like this:
afbeelding

While the disassembly looks like this:
afbeelding

At first glance it seems like the statement on line 13 has been optimized away, but I'm pretty sure the binary was built without optimizations:

afbeelding

For the record, I'm running this on Mac M1, with arm-none-eabi-gdb as the debugger

@CarlosLaraFP
Copy link

Having this same issue on iMac.

@kazauwa
Copy link

kazauwa commented Sep 8, 2023

Same issue here on M1 Mac. The lines in the range 13-15 seem to be absent, you can verify this by executing next several times. You will see that gdb jumps from line 12 straight to line 16. Also, I tried disabling optimizations explicitly by specifying "-C", "opt-level=0" in .cargo/config, but it didn't help.

@kazauwa
Copy link

kazauwa commented Sep 9, 2023

I got it to work by downgrading rust to 1.66 and half crate to 2.2.1 (since 2.3.1 requires rust 1.70+). It seems that there was a change in 1.69 that is causing this weird optimization because 1.68.2 was the last version where I couldn't reproduce it. I wonder if this is the case for other platforms.

UPD.
This also happens on Linux x86_64

@fosskers
Copy link

This is also currently happening on Arch Linux for me. For now I'll move forward with the chapter and "take his word for it".

@fosskers
Copy link

Immediate discoveries: the lines in question aren't actually being compiled away. By manually nexting, while it does jump over the _y = x, doing a info locals afterwards does show that _y = 42, so the setting did indeed happen.

@Berty48237
Copy link

I have the same issue on Linux Mint 20.04, Ubuntu 20.04. I.e. jumping from line 12 to 15 whilst single stepping.
I also have another problem with the code on section 5.4 'The led and delay abstractions'. When using 'next' to step over the call to let (mut delay, mut leds): (Delay, LedArray) = aux5::init() it jumps straight to the loop, as if I'd typed 'continue'.
When using the assembler view and 'si' to step into the aux5::init() function, it again steps over it.
Anyone else experiencing this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants