Chapter 4. API Guides
Temporary breakpoint 1, app_main () at /home/user-name/esp/blink/main/./blink.c:43
43 xTaskCreate(&blink_task, "blink_task", configMINIMAL_STACK_SIZE, NULL, 5,␣
,→NULL);
(gdb)
Examples in this section
1. Navigating through the code, call stack and threads
2. Setting and clearing breakpoints
3. Halting and resuming the application
4. Stepping through the code
5. Checking and setting memory
6. Watching and setting program variables
7. Setting conditional breakpoints
Navigating through the code, call stack and threads When you see the (gdb) prompt, the application is halted.
LED should not be blinking.
To find out where exactly the code is halted, enter l or list, and debugger will show couple of lines of code around
the halt point (line 43 of code in file blink.c)
(gdb) l
38 }
39 }
40
41 void app_main()
42 {
43 xTaskCreate(&blink_task, "blink_task", configMINIMAL_STACK_SIZE, NULL, 5,␣
,→NULL);
44 }
(gdb)
Check how code listing works by entering, e.g. l 30, 40 to see particular range of lines of code.
You can use bt or backtrace to see what function calls lead up to this code:
(gdb) bt
#0 app_main () at /home/user-name/esp/blink/main/./blink.c:43
#1 0x400d057e in main_task (args=0x0) at /home/user-name/esp/esp-idf/components/
,→esp32s2/./cpu_start.c:339
(gdb)
Line #0 of output provides the last function call before the application halted, i.e. app_main () we have listed
previously. The app_main () was in turn called by function main_task from line 339 of code located in file
cpu_start.c.
To get to the context of main_task in file cpu_start.c, enter frame N, where N = 1, because the
main_task is listed under #1):
(gdb) frame 1
#1 0x400d057e in main_task (args=0x0) at /home/user-name/esp/esp-idf/components/
,→esp32s2/./cpu_start.c:339
339 app_main();
(gdb)
Enter l and this will reveal the piece of code that called app_main() (in line 339):
(gdb) l
334 ;
335 }
(continues on next page)
Espressif Systems 1404
Submit Document Feedback
Release v4.4