Cannot correctly jump to next line in some files when debug with openocd/gdb

iamblwb
Posts: 13
Joined: Wed Dec 28, 2016 3:26 pm

Cannot correctly jump to next line in some files when debug with openocd/gdb

Postby iamblwb » Mon Feb 20, 2017 6:06 pm

I used the following example to debug.

examples/protocols/http_request

I can set the breakpoint to app_main and it indeed stops at this breakpoint.
It's also ok to jump to the next line nvs_flash_init() and initialise_wifi().

Code: Select all

Breakpoint 1, app_main ()
    at /esp/esp-idf/examples/http_request/main/./http_request_main.c:176
176	{
(gdb) n
esp32.cpu0: Target halted, pc=0x40107883
177	    nvs_flash_init();
(gdb) n
esp32.cpu0: Target halted, pc=0x40101C38
esp32.cpu0: Target halted, pc=0x40107886
178	    initialise_wifi();
But when I set the breakpoint to other file, for example lwip_socket
It can stop at lwip_socket without any problem.
However, I can't jump to the next line, it's always switching to other thread and stop at queue.c.
How can I do?
Thanks

Code: Select all

(gdb) hb lwip_socket
Hardware assisted breakpoint 2 at 0x40109ee4: file /esp/esp-idf/components/lwip/api/sockets.c, line 1456.
(gdb) c
Continuing.
esp32.cpu0: Target halted, pc=0x40109EE4
[New Thread 1073548372]
[Switching to Thread 1073548372]

Breakpoint 2, lwip_socket (domain=1073454564, type=99992, protocol=0)
    at /esp/esp-idf/components/lwip/api/sockets.c:1456
1456	{
(gdb) n
esp32.cpu0: Target halted, pc=0x400833E3

Program received signal SIGTRAP, Trace/breakpoint trap.
[Switching to Thread 1073541912]
0x400833e3 in xQueueGenericReceive (xQueue=0x3ffccc7c, pvBuffer=0x3ffcf270, 
    xTicksToWait=4294967295, xJustPeeking=0)
    at /esp/esp-idf/components/freertos/./queue.c:1594
1594					portYIELD_WITHIN_API();
(gdb) 

iamblwb
Posts: 13
Joined: Wed Dec 28, 2016 3:26 pm

Re: Cannot correctly jump to next line in some files when debug with openocd/gdb

Postby iamblwb » Wed Feb 22, 2017 4:35 am

Can someone kindly give me some advice?
Thanks

BuddyCasino
Posts: 263
Joined: Sun Jun 19, 2016 12:00 am

Re: Cannot correctly jump to next line in some files when debug with openocd/gdb

Postby BuddyCasino » Wed Feb 22, 2017 8:31 am

Same for me, stepping doesn't work. This is my routine:

1) set breakpoint in Eclipse
2) start OpenOCD session
3) power up ESP32
4) hit hardware breakpoint
5) rejoice that it worked this time
6) move breakpoint to new position
7) GOTO 1

iamblwb
Posts: 13
Joined: Wed Dec 28, 2016 3:26 pm

Re: Cannot correctly jump to next line in some files when debug with openocd/gdb

Postby iamblwb » Thu Feb 23, 2017 6:07 am

Thank BuddyCasino help me reproduce this issue in his debug environment, at least now I am sure this is not the issue only happened to me.
In fact, as long as you set the breakpoint in network related files such as sockets.c in this case, even you just set one breakpoint, you still can’t correctly move to next step.
I have no idea why have this issue on these files, it makes me almost not possible to debug with opencod, really hope that someone can help on this.
Thanks

BobaTrek
Posts: 1
Joined: Mon Dec 11, 2017 5:02 pm

Re: Cannot correctly jump to next line in some files when debug with openocd/gdb

Postby BobaTrek » Mon Dec 11, 2017 5:19 pm

I am experiencing the same issue trying to step through code that is using Bluetooth and the awesome C++ BLE classes that nkolban provided.

When using OpenOCD and xtensa-esp32-elf-gdb in Eclipse, I always hit my first breakpoint just fine. But then when I try to step, the program keeps randomly stopping at line 1591 in queue.c:

portYIELD_WITHIN_API();

If I then try to continue, xtensa-esp32-elf-gdb crashes (and the esp32 program terminates).

After hitting my first breakpoint, it is a random number of times (typically 2 to 5 steps) before I stop at the line in queue.c and can't proceed any further.

I have tried various combinations of Step Into, Step Over, Step Return, Resume, Run to line, and just clearing and setting breakpoints later in the code. No matter what I try, every few "steps" and the debugger stops in queue.c

Did anybody figure out how to prevent or work around this issue?

almaz1c
Posts: 2
Joined: Thu Mar 22, 2018 10:18 am

Re: Cannot correctly jump to next line in some files when debug with openocd/gdb

Postby almaz1c » Thu Mar 22, 2018 10:23 am

Exactly same situation:
movin to

Code: Select all

portYIELD_WITHIN_API
during step by step debugging in Eclipse.
Trying to run breaks debugging process.
I thought it is watchdog so I disabled wachdogs in menuconfig by disabling

Code: Select all

Initialize Task Watchdog Timer on startup
and

Code: Select all

Interrupt Watchdog
. Unfortunately without luck.
Did someone find solution around this issue?

ESP_igrr
Posts: 2071
Joined: Tue Dec 01, 2015 8:37 am

Re: Cannot correctly jump to next line in some files when debug with openocd/gdb

Postby ESP_igrr » Thu Mar 22, 2018 1:36 pm

Which version of OpenOCD are you running?

Who is online

Users browsing this forum: No registered users and 254 guests