Skip to content

Commit a0d45a9

Browse files
committed
docs: new section about debugging with symbols
1 parent 25cc92a commit a0d45a9

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

README.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,30 @@ That's it! You can now debug the simulated AVR code using GDB. Here are some qui
3232
- `disas $pc, $pc+16` - Disassemble the next few instructions
3333
- `info registers` - Dump all registers (r0-r31, SREG, SP, pc)
3434

35+
## Debugging with Symbols
36+
37+
If you want source-level debugging (with symbols and everything), first
38+
build an ELF file for your program locally (e.g. using the Arduino CLI).
39+
Then, push it to the simulator using GDB's `load` command, and load the
40+
symbols using the `symbol-file` command. Finally, set `$pc` to 0 and
41+
start the program. Here's an example for such session:
42+
43+
```
44+
(gdb) target remote localhost:3555
45+
Remote debugging using localhost:3555
46+
0x000001b6 in ?? ()
47+
(gdb) load blink.ino.elf
48+
Loading section .text, size 0x3a4 lma 0x0
49+
Start address 0x0, load size 932
50+
Transfer rate: 91 KB/sec, 932 bytes/write.
51+
(gdb) symbol-file blink.ino.elf
52+
Reading symbols from blink.ino.elf...done.
53+
(gdb) set $pc=0
54+
(gdb) stepi
55+
0x000000b8 in __init ()
56+
(gdb)
57+
```
58+
3559
## License
3660

3761
Copyright (C) 2020 Uri Shaked. The code is released under the terms of the MIT license.

0 commit comments

Comments
 (0)