Debugging - Breakpoint at xTaskCreate() does not work

mikbeng
Posts: 1
Joined: Wed Jul 10, 2019 7:28 am

Debugging - Breakpoint at xTaskCreate() does not work

Postby mikbeng » Wed Jul 10, 2019 8:14 am

Hello,

I'm currently trying out the Debugging features on ESP32 and have been following this guide successfully:
https://docs.espressif.com/projects/esp ... mmand-line

However, I have some issues/questions regarding breakpoints on Freertos functions. I'm currently testing on the example project blink under examples/get-started/blink.

Setting breakpoints in the code works fine for all the places except on row 46 at xTaskCreate:

Code: Select all

void blink_task(void *pvParameter)
{
    /* Configure the IOMUX register for pad BLINK_GPIO (some pads are
       muxed to GPIO on reset already, but some default to other
       functions and need to be switched to GPIO. Consult the
       Technical Reference for a list of pads and their default
       functions.)
    */
    gpio_pad_select_gpio(BLINK_GPIO);
    /* Set the GPIO as a push/pull output */
    gpio_set_direction(BLINK_GPIO, GPIO_MODE_OUTPUT);
    while(1) {
        /* Blink off (output low) */
        gpio_set_level(BLINK_GPIO, 0);
        vTaskDelay(1000 / portTICK_PERIOD_MS);
        /* Blink on (output high) */
        gpio_set_level(BLINK_GPIO, 1);
        vTaskDelay(1000 / portTICK_PERIOD_MS);
    }
}

void app_main()
{   
    printf("Hello testing..\n");
    xTaskCreate(&blink_task, "blink_task", configMINIMAL_STACK_SIZE, NULL, 5, NULL);
}

When i do this in GDB terminal with the command break 46, I get "No line 46 in the current file":

Target halted. PRO_CPU: PC=0x400D1E23 (active) APP_CPU: PC=0x400E2736

Temporary breakpoint 1, app_main () at ../main/blink.c:45
45 printf("Hello testing..\n");
(gdb) break 46
No line 46 in the current file.
Make breakpoint pending on future shared library load? (y or [n])


Why is it that gdb can't find line 46?? When I type "list" in gdb I can clearly see it's there:

(gdb) list
40 }
41 }
42
43 void app_main()
44 {
45 printf("Hello testing..\n");
46 xTaskCreate(&blink_task, "blink_task", configMINIMAL_STACK_SIZE, NULL, 5, NULL);
47 }
(gdb)


I'm using esp-idf v3.2.2 (stable) with OpenOCD v0.10.0-esp32-20190708

Any info on this would be much appreciated!
Attachments
blink.c
(1.42 KiB) Downloaded 38 times
screenshot_list.png
screenshot_list.png (29.4 KiB) Viewed 104 times
screenshot.png
screenshot.png (72.52 KiB) Viewed 104 times

Ritesh
Posts: 1070
Joined: Tue Sep 06, 2016 9:37 am
Location: India
Contact:

Re: Debugging - Breakpoint at xTaskCreate() does not work

Postby Ritesh » Sun Jul 14, 2019 8:47 am

mikbeng wrote:
Wed Jul 10, 2019 8:14 am
Hello,

I'm currently trying out the Debugging features on ESP32 and have been following this guide successfully:
https://docs.espressif.com/projects/esp ... mmand-line

However, I have some issues/questions regarding breakpoints on Freertos functions. I'm currently testing on the example project blink under examples/get-started/blink.

Setting breakpoints in the code works fine for all the places except on row 46 at xTaskCreate:

Code: Select all

void blink_task(void *pvParameter)
{
    /* Configure the IOMUX register for pad BLINK_GPIO (some pads are
       muxed to GPIO on reset already, but some default to other
       functions and need to be switched to GPIO. Consult the
       Technical Reference for a list of pads and their default
       functions.)
    */
    gpio_pad_select_gpio(BLINK_GPIO);
    /* Set the GPIO as a push/pull output */
    gpio_set_direction(BLINK_GPIO, GPIO_MODE_OUTPUT);
    while(1) {
        /* Blink off (output low) */
        gpio_set_level(BLINK_GPIO, 0);
        vTaskDelay(1000 / portTICK_PERIOD_MS);
        /* Blink on (output high) */
        gpio_set_level(BLINK_GPIO, 1);
        vTaskDelay(1000 / portTICK_PERIOD_MS);
    }
}

void app_main()
{   
    printf("Hello testing..\n");
    xTaskCreate(&blink_task, "blink_task", configMINIMAL_STACK_SIZE, NULL, 5, NULL);
}

When i do this in GDB terminal with the command break 46, I get "No line 46 in the current file":

Target halted. PRO_CPU: PC=0x400D1E23 (active) APP_CPU: PC=0x400E2736

Temporary breakpoint 1, app_main () at ../main/blink.c:45
45 printf("Hello testing..\n");
(gdb) break 46
No line 46 in the current file.
Make breakpoint pending on future shared library load? (y or [n])


Why is it that gdb can't find line 46?? When I type "list" in gdb I can clearly see it's there:

(gdb) list
40 }
41 }
42
43 void app_main()
44 {
45 printf("Hello testing..\n");
46 xTaskCreate(&blink_task, "blink_task", configMINIMAL_STACK_SIZE, NULL, 5, NULL);
47 }
(gdb)


I'm using esp-idf v3.2.2 (stable) with OpenOCD v0.10.0-esp32-20190708

Any info on this would be much appreciated!
Hello,

Can you please try with Master branch as well? Also did you check with upto 45 lines you are able to put break points correctly without any issue?
Regards,
Ritesh Prajapati

Who is online

Users browsing this forum: No registered users and 10 guests