How to debug lwm2m_client sample on Thingy91 development kit?

Our company is in the process of developing a new IoT product for LTE-M and NB-IoT. The sample application lwm2m_client runs fine on our devkits nRF9151DK & Thingy91 and connects fine with Leshan, AVSystems and nRFCloud. UART console of both devkits show a lot of shell outputs. So far so good.
Past days I had to debug an issue but depending on some conditions I didn't know some times I could easily SWD debug and sometimes not. In the end I found this out:

  • nRF9151DK both standard builds and debug-build configs run just fine on those boards, UART output is correct.
  • Thingy:91 (nRF9160):
    • standard builds work both via MCUBoot-Update and via SWD debugger. In the debugger I can single step and run and the app run fine.
    • debug builds for the Thingy/nRF9160ns target (-Og, -DCONFIG_DEBUG_THREAD_INFO=y) dont work, dont show UART outputs, even the blinky sample is doing nothing
    • debug builds for the Thingy/nRF9160 target (no ns, -Og, -DCONFIG_DEBUG_THREAD_INFO=y) work, show UART outputs, but this is only valid for very simple MCU-like applications. Using the no-ns build target is preventing applications which require the LTE modem (TP-M)

Currently I'm out of ideas how I can debug an application using the LTE modem on the Thingy91 platform. Whats the supposed way to go in May 2025?

  • Another data point:

    When I flash the merged.hex of a non-debug blinky build to the Thingy:91 via SWD, everything works fine — UART output appears and the LED blinks. Then I press the button, power-cycle the board, and end up in MCUboot. From there, I use the nRF Connect Programmer to flash zephyr.signed.hex from the debug build. After that, nothing works — no UART output, no LED activity.

    I press the button again, power-cycle once more, and this time flash the zephyr.signed.hex from the non-debug build — and the LED starts blinking again.

Related