Skip to content

Commit a8a16ac

Browse files
authored
Merge pull request #55 from ziyadedher/patch-1
[5.3] note a bug that makes completing the section difficult
2 parents e0da126 + 8a6f2ca commit a8a16ac

File tree

1 file changed

+20
-7
lines changed

1 file changed

+20
-7
lines changed

mdbook/src/05-meet-your-software/debug-it.md

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ directory. Once we are there we first have to open the binary in gdb like this:
2424
$ gdb ../../../target/thumbv7em-none-eabihf/debug/examples/init
2525
```
2626

27-
> **NOTE**: Depending on which GDB you installed you will have to use a different command to launch
27+
> **NOTE** Depending on which GDB you installed you will have to use a different command to launch
2828
> it. Check out [chapter 3] if you forgot which one it was.
2929
3030
[chapter 3]: ../03-setup/index.md#tools
@@ -49,9 +49,22 @@ Remote debugging using :1337
4949
157 #[derive(Copy, Clone, Debug)]
5050
```
5151

52-
**NOTE**: The example in the repository for this chapter may
53-
change over time. Line numbers and other source details may
54-
thus be different from what is shown here and below.
52+
> **NOTE** The example in the repository for this chapter may change over time. Line numbers and
53+
> other source details may thus be different from what is shown here and below.
54+
>
55+
> If the program fails to halt after starting, and you end up somewhere deeper in the program like
56+
> the following, then try running `monitor reset halt` to reset. This is due to [a bug](https://github.com/probe-rs/probe-rs/issues/3438)
57+
> in `probe-rs`, see [issue #27](https://github.com/rust-embedded/discovery-mb2/issues/27) for
58+
> more details.
59+
> ```shell
60+
> (gdb) target remote :1337
61+
> Remote debugging using :1337
62+
> init::__cortex_m_rt_main () at mdbook/src/05-meet-your-software/examples/init.rs:19
63+
> 19 asm::nop();
64+
> (gdb) monitor reset halt
65+
> Resetting and halting target
66+
> Target halted
67+
> ```
5568
5669
Next what we want to do is get to the `main` function of our program. We will do this by first
5770
setting a breakpoint there and then continuing program execution until we hit the breakpoint:
@@ -83,7 +96,7 @@ mode, on the GDB shell enter the following command:
8396
(gdb) layout src
8497
```
8598
86-
> **NOTE**: Apologies Windows users. The GDB shipped with the GNU Arm Embedded Toolchain doesn't
99+
> **NOTE** Apologies Windows users. The GDB shipped with the GNU Arm Embedded Toolchain doesn't
87100
> support this TUI mode `:-(`.
88101
89102
![GDB session](../assets/gdb-layout-src.png "GDB TUI")
@@ -151,7 +164,7 @@ never pass that statement. Instead, we'll switch to the disassemble view with th
151164
command and advance one instruction at a time using `stepi`. You can always switch back into Rust
152165
source code view later by issuing the `layout src` command again.
153166
154-
> **NOTE**: If you used the `next` or `continue` command by mistake and GDB got stuck, you can get
167+
> **NOTE** If you used the `next` or `continue` command by mistake and GDB got stuck, you can get
155168
> unstuck by hitting `Ctrl+C`.
156169
157170
```
@@ -239,7 +252,7 @@ Ending remote debugging.
239252
[Inferior 1 (Remote target) detached]
240253
```
241254
242-
> **NOTE**: If the default GDB CLI is not to your liking check out [gdb-dashboard]. It uses Python
255+
> **NOTE** If the default GDB CLI is not to your liking check out [gdb-dashboard]. It uses Python
243256
> to turn the default GDB CLI into a dashboard that shows registers, the source view, the assembly
244257
> view and other things.
245258

0 commit comments

Comments
 (0)