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
Copy file name to clipboardExpand all lines: mdbook/src/appendix/2-how-to-use-gdb/README.md
+20-9Lines changed: 20 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -1,10 +1,15 @@
1
1
# How to use GDB
2
2
3
-
Below are some useful GDB commands that can help us debug our programs. This assumes you have [flashed a program](../../05-led-roulette/flash-it.md) onto your microcontroller and attached GDB to a `cargo-embed` session.
3
+
Below are some useful GDB commands that can help us debug our programs. This assumes you have
4
+
[flashed a program](../../05-led-roulette/flash-it.md) onto your microcontroller and attached GDB to
5
+
a `cargo-embed` session.
4
6
5
7
## General Debugging
6
8
7
-
> **NOTE:** Many of the commands you see below can be executed using a short form. For example, `continue` can simply be used as `c`, or `break $location` can be used as `b $location`. Once you have experience with the commands below, try to see how short you can get the commands to go before GDB doesn't recognize them!
9
+
> **NOTE:** Many of the commands you see below can be executed using a short form. For example,
10
+
> `continue` can simply be used as `c`, or `break $location` can be used as `b $location`. Once you
11
+
> have experience with the commands below, try to see how short you can get the commands to go
12
+
> before GDB doesn't recognize them!
8
13
9
14
10
15
### Dealing with Breakpoints
@@ -40,7 +45,8 @@ Below are some useful GDB commands that can help us debug our programs. This ass
40
45
41
46
### Printing Information
42
47
43
-
*`print /$f $data` - Print the value contained by the variable `$data`. Optionally format the output with `$f`, which can include:
48
+
*`print /$f $data` - Print the value contained by the variable `$data`. Optionally format the
49
+
output with `$f`, which can include:
44
50
```txt
45
51
x: hexadecimal
46
52
d: signed decimal
@@ -52,21 +58,25 @@ Below are some useful GDB commands that can help us debug our programs. This ass
52
58
f: floating point
53
59
```
54
60
* `print /t 0xA`: Prints the hexadecimal value `0xA` as binary (0b1010)
55
-
* `x /$n$u$f $address`: Examine memory at `$address`. Optionally, `$n` define the number of units to display,
56
-
`$u` unit size (bytes, halfwords, words, etc.), `$f` any `print` format defined above
61
+
62
+
* `x /$n$u$f $address`: Examine memory at `$address`. Optionally, `$n` define the number of units to
63
+
display, `$u` unit size (bytes, halfwords, words, etc.), `$f` any `print` format defined above
0 commit comments