Chapter 4. API Guides
(gdb) c
Continuing.
Target halted. PRO_CPU: PC=0x400DB751 (active) APP_CPU: PC=0x400D0811
[New Thread 1073432196]
Program received signal SIGTRAP, Trace/breakpoint trap.
[Switching to Thread 1073432196]
0x400db751 in blink_task (pvParameter=0x0) at /home/user-name/esp/blink/main/./
,→blink.c:33
33 i++;
(gdb)
Resume application couple more times so i gets incremented. Now you can enter print i (in short p i) to check
the current value of i:
(gdb) p i
$1 = 3
(gdb)
To modify the value of i use set command as below (you can then print it out to check if it has been indeed
changed):
(gdb) set var i = 0
(gdb) p i
$3 = 0
(gdb)
You may have up to two watchpoints, see Breakpoints and watchpoints available.
Setting conditional breakpoints Here comes more interesting part. You may set a breakpoint to halt the program
execution, if certain condition is satisfied. Delete existing breakpoints and try this:
(gdb) break blink.c:34 if (i == 2)
Breakpoint 3 at 0x400db753: file /home/user-name/esp/blink/main/./blink.c, line 34.
(gdb)
Above command sets conditional breakpoint to halt program execution in line 34 of blink.c if i == 2.
If current value of i is less than 2 and program is resumed, it will blink LED in a loop until condition i == 2 gets
true and then finally halt:
(gdb) set var i = 0
(gdb) c
Continuing.
Target halted. PRO_CPU: PC=0x400DB755 (active) APP_CPU: PC=0x400D112C
Target halted. PRO_CPU: PC=0x400DB753 (active) APP_CPU: PC=0x400D112C
Target halted. PRO_CPU: PC=0x400DB755 (active) APP_CPU: PC=0x400D112C
Target halted. PRO_CPU: PC=0x400DB753 (active) APP_CPU: PC=0x400D112C
Breakpoint 3, blink_task (pvParameter=0x0) at /home/user-name/esp/blink/main/./
,→blink.c:34
34 gpio_set_level(BLINK_GPIO, 0);
(gdb)
Obtaining help on commands Commands presented so for should provide are very basis and intended to let you
quickly get started with JTAG debugging. Check help what are the other commands at you disposal. To obtain help
on syntax and functionality of particular command, being at (gdb) prompt type help and command name:
Espressif Systems 1410
Submit Document Feedback
Release v4.4