-
Notifications
You must be signed in to change notification settings - Fork 548
Description
I'm working through the discovery book and just did the gdb session in this chapter.
What I found is that while info locals properly reports my change to half_period, the behaviour did not change. So I went through calls to the delay_ms methods again and found that the calling parameter is still the original value of 500.
What I am wondering is if this is due to Rust recent changes with respect to constant value optimizations. Could it be that the half_period (which is a primitive type and only read twice and never written) is optimized away? I can imagine that it would be sufficient to write the value somewhere to the binary and let delay_ms access it directly without doing the usual stack-frame handling.
My questions are:
- Can you give me hints on how to validate my hypothesis?
- Can we (jointly) fix this by modifying the usage or declaration of
half_periodso that it is really modifiable interactively ingdb?
I guess fixing this would save others from trying out this example and wondering why it does not work.