How to keep Bluetooth connection active while debugging / stepping through Bluetooth-handling code?

I am using Zephyr 3.7.0 with the Nordic-provided low level link layer (LLL) code on an nRF52840-DK. I'd like to set a breakpoint on rp_comm_rx_decode() (https://github.com/zephyrproject-rtos/zephyr/blob/v3.7.0/subsys/bluetooth/controller/ll_sw/ull_llcp_common.c#L950) and then just step through the code and watch how it parses packets. But when I do that with VS Code, the breakpoint fires, but I can't step through the code. If I do it with "west debug" (GDB-based), the breakpoint also fires, and I can step through the code at least, but the BLE connection is dead, so it doesn't do me any good.

Is there a way to debug this low level code while keeping the BLE connection running in the background? If not, how do the developers work on the code?

Parents
  • I think it is not possible. Depending on exactly what you are searching for you should probably consider using some other approach. For example:

    - Increase logging level

    - Add more logging inside the functions if you are curious about some variables

    - Use a Bluetooth sniffer to catch traffic

    - Output your packets and use Wireshark to decode them.

    Sometimes you can run things in a simulated environment instead (for example BabbleSim).

    There are many ways to debug without actually using a debugger. Good luck with the bug hunting!

Reply
  • I think it is not possible. Depending on exactly what you are searching for you should probably consider using some other approach. For example:

    - Increase logging level

    - Add more logging inside the functions if you are curious about some variables

    - Use a Bluetooth sniffer to catch traffic

    - Output your packets and use Wireshark to decode them.

    Sometimes you can run things in a simulated environment instead (for example BabbleSim).

    There are many ways to debug without actually using a debugger. Good luck with the bug hunting!

Children
No Data
Related