|
11 | 11 |
|
12 | 12 | ## Connecting from the Wokwi Simulator
|
13 | 13 |
|
14 |
| -1. Open https://localhost:2442 and confirm the untrusted localhost SSL certificate (if you don't want to do this every time, [please follow these instructions](https://stackoverflow.com/questions/21397809/create-a-trusted-self-signed-ssl-cert-for-localhost-for-use-with-express-node)). |
15 |
| -2. Open any Arduino project on [wokwi.com](wokwi.com), e.g. [blink](https://wokwi.com/arduino/libraries/demo/blink), and start the simulation. |
16 |
| -3. In the code editor, press "F1" and select "Open Debug Web Socket". |
17 |
| -4. You'll see a prompt asking for a URL to connect to. Confirm the default URL. |
| 14 | +1. Open any Arduino project on [wokwi.com](wokwi.com), e.g. [blink](https://wokwi.com/arduino/libraries/demo/blink), and start the simulation. |
| 15 | +2. In the code editor, press "F1" and select "Open Debug Web Socket". |
| 16 | +3. You'll see a prompt asking for a URL to connect to. Confirm the default URL. |
18 | 17 |
|
19 | 18 | ## Connecting from GDB
|
20 | 19 |
|
21 |
| -1. Install avr-gdb (`apt install gdb-avr` on Ubuntu). You can find a pre-built Windows binary inside [this package](http://downloads.arduino.cc/tools/avr-gcc-7.3.0-atmel3.6.1-arduino5-i686-w64-mingw32.zip). |
22 |
| -2. Run `avr-gdb` |
23 |
| -3. Write: `target remote localhost:3555` |
| 20 | +You'll need to use a GDB build that works with the architecture you are debugging. For instance, debugging Arduino requires avr-gdb (`apt install gdb-avr` on Ubuntu). You can find a pre-built Windows binary inside [this package](http://downloads.arduino.cc/tools/avr-gcc-7.3.0-atmel3.6.1-arduino5-i686-w64-mingw32.zip). |
24 | 21 |
|
25 |
| -That's it! You can now debug the simulated AVR code using GDB. Here are some quick commands to get you started: |
| 22 | +1. Start gdb |
| 23 | +2. Write: `target remote localhost:3555` |
| 24 | + |
| 25 | +That's it! You can now debug the simulated code using GDB. Here are some quick commands to get you started: |
26 | 26 |
|
27 | 27 | - `stepi` - Execute the next instruction
|
28 | 28 | - `c` - Continue running the program (press Ctrl+C to break)
|
29 | 29 | - `print $sp` - Prints the value of the Stack Pointer (SP)
|
30 | 30 | - `where` - Show stack trace
|
31 |
| -- `set $r10 = 5` - Change the value of the R10 registers |
| 31 | +- `set $r10 = 5` - Change the value of the R10 register |
32 | 32 | - `disas $pc, $pc+16` - Disassemble the next few instructions
|
33 | 33 | - `info registers` - Dump all registers (r0-r31, SREG, SP, pc)
|
34 | 34 |
|
| 35 | +For more useful commands, check the [AVR GDB Cheatsheet](https://blog.wokwi.com/gdb-avr-arduino-cheatsheet/) |
| 36 | + |
35 | 37 | ## Debugging with Symbols
|
36 | 38 |
|
37 | 39 | If you want source-level debugging (with symbols and everything), first
|
|
0 commit comments