Closed cocoacrumbs closed 2 years ago
I also just ran through this same issue and was similarly confused by this. This was my first exposure to gdb, so changing the text to mention being able to step
would be helpful.
Sorry about that. The whole ecosystem has been evolving. We would be glad for PRs that update the instructions.
OK, great. I am currently playing around with this in my spare time, so I will try and get a PR done this week.
I have created a PR to address this. https://github.com/rust-embedded/book/pull/323
Fixed in #323. Thank you!
The embedded rust book in section 2.2 discusses the following example code:
But when we reach the
Debugging
part of the section, we do see this text:This does not correspond to the example code given earlier. I looked a bit in the history of the example code (https://github.com/rust-embedded/cortex-m-quickstart) and the example code was modified in 2018 already to use the
hprintln!
macro (commit#9c6b290
, "use hprint macros", "japaric committed on Nov 10, 2018").The second deviation between the book and what I see happening is when setting the break point on
fn main()
:The text suggests the break point is placed on the first line of the
main
function:This is not the same as I see happening in my setup (
rustc 1.49.0 (e1884a8e3 2020-12-29)
):Thus just before the
fn main()
. When issuing anext
gdb command (as the book suggests), gdb will simply step over thefn main()
function and then basically hangs because of the endlessloop ()
insidefn main()
.When using the
step
gdb command it's possible to step insidefn main()' and then execute the
hprintln!` command on its own as intended by the text.I guess the above deviations might be due more recent
Rust
implementations?