Problems with "Enable debug options"

Hi,

I am facing a problem with the selection "Enable debug options" when creating a build configuration. I use nRF connect SDK 1.9.1 with VSCode. I create an application from sample aws_iot. Then I make two different build configurations, one with "Enable debug options" checked, and one with the option unchecked. The one that has debug option enabled is not possible to debug (it may work once, but all other debug sessions do not work). But the one that doesn't have the option enabled works fine to debug.

How come there is a difference?

What does "Enable debug options" provide?

Best regards,
Lars

  • Hi,

    I have replicated the scenario you described myself using aws_iot sample with VS Code and NCS v1.9.1. I did not observe any issue, no matter if "Enable debug options" was checked or unchecked, .

    Best regards,
    Dejan

  • Hi Dejan,

    Strange. I have staerted over, and the first time I debug the build configuration that has "Enable debug options" checked, it works fine. But all other debug sessions don't. I have attached three files with the printouts from "Debug console". One file is how it looks in the build configuration that doesn't have "Enable debug options" checked. The other two has the option checked. The one where debugging is working is the first debug session, the other one is how it looks for all other debug sessions. Is it possible to find any interesting information from this?

    Has any other of your team tested to see if you can repeat this?

    What does "Enable debug options" provide?

    Best regards,
    Lars

    Reading symbols from c:/projekt\nordicsemi\v1.9.1\toolchain\opt\bin\arm-none-eabi-objdump.exe --syms -C -h -w c:\Projekt\nordic\aws_iot\build\zephyr\merged.hex
    Reading symbols from c:/projekt/nordicsemi\v1.9.1\toolchain\opt\bin\arm-none-eabi-nm.exe --defined-only -S -l -C -p c:\Projekt\nordic\aws_iot\build\zephyr\merged.hex
    Launching GDB: "c:\\Projekt\\NordicSemi\\v1.9.1\\toolchain\\opt\\bin\\arm-none-eabi-gdb.exe" -q --interpreter=mi2 "c:\\Projekt\\nordic\\aws_iot\\build\\zephyr\\merged.hex"
        Set "showDevDebugOutput": true in your "launch.json" to see verbose GDB transactions here. Helpful to debug issues or report problems
    Launching gdb-server: "C:\\Program Files (x86)\\SEGGER\\JLink\\JLinkGDBServerCL.exe" -singlerun -nogui -if swd -port 50000 -swoport 50001 -telnetport 50002 -device nRF9160_xxAA -select usb=960008799 -rtos "C:\\Program Files (x86)\\SEGGER\\JLink\\GDBServer\\RTOSPlugin_Zephyr.dll"
        Please check TERMINAL tab (gdb-server) for output from C:\Program Files (x86)\SEGGER\JLink\JLinkGDBServerCL.exe
    Finished reading symbols from objdump: Time: 96 ms
    Finished reading symbols from nm: Time: 95 ms
    Reading symbols from c:\Projekt\nordic\aws_iot\build\zephyr\merged.hex...
    (No debugging symbols found in c:\Projekt\nordic\aws_iot\build\zephyr\merged.hex)
    WARNING: Cortex-Debug will deprecate use of GDB version 8 after July 2022. Please upgrade to version 9+
    0x00025b22 in ?? ()
    Program stopped, probably due to a reset and/or halt issued by debugger
    add symbol table from file "c:/Projekt/nordic/aws_iot/build/zephyr/zephyr.elf"
    (y or n) [answered Y; input not from terminal]
    Reading symbols from c:/Projekt/nordic/aws_iot/build/zephyr/zephyr.elf...
    add symbol table from file "c:/Projekt/nordic/aws_iot/build/mcuboot/zephyr/zephyr.elf"
    (y or n) [answered Y; input not from terminal]
    Reading symbols from c:/Projekt/nordic/aws_iot/build/mcuboot/zephyr/zephyr.elf...
    add symbol table from file "c:/Projekt/nordic/aws_iot/build/spm/zephyr/zephyr.elf"
    (y or n) [answered Y; input not from terminal]
    Reading symbols from c:/Projekt/nordic/aws_iot/build/spm/zephyr/zephyr.elf...
    2
    Resetting target
    
    Temporary breakpoint 2, main () at C:/Projekt/NordicSemi/v1.9.1/modules/hal/nordic/nrfx/hal/nrf_wdt.h:427
    427	    p_reg->RR[rr_register] = NRF_WDT_RR_VALUE;
    Reading symbols from c:/projekt\nordicsemi\v1.9.1\toolchain\opt\bin\arm-none-eabi-objdump.exe --syms -C -h -w c:\Projekt\nordic\aws_iot\build_1_enable_debug_options\zephyr\merged.hex
    Reading symbols from c:/projekt/nordicsemi\v1.9.1\toolchain\opt\bin\arm-none-eabi-nm.exe --defined-only -S -l -C -p c:\Projekt\nordic\aws_iot\build_1_enable_debug_options\zephyr\merged.hex
    Launching GDB: "c:\\Projekt\\NordicSemi\\v1.9.1\\toolchain\\opt\\bin\\arm-none-eabi-gdb.exe" -q --interpreter=mi2 "c:\\Projekt\\nordic\\aws_iot\\build_1_enable_debug_options\\zephyr\\merged.hex"
        Set "showDevDebugOutput": true in your "launch.json" to see verbose GDB transactions here. Helpful to debug issues or report problems
    Launching gdb-server: "C:\\Program Files (x86)\\SEGGER\\JLink\\JLinkGDBServerCL.exe" -singlerun -nogui -if swd -port 50000 -swoport 50001 -telnetport 50002 -device nRF9160_xxAA -select usb=960008799 -rtos "C:\\Program Files (x86)\\SEGGER\\JLink\\GDBServer\\RTOSPlugin_Zephyr.dll"
        Please check TERMINAL tab (gdb-server) for output from C:\Program Files (x86)\SEGGER\JLink\JLinkGDBServerCL.exe
    Finished reading symbols from objdump: Time: 89 ms
    Finished reading symbols from nm: Time: 92 ms
    Reading symbols from c:\Projekt\nordic\aws_iot\build_1_enable_debug_options\zephyr\merged.hex...
    (No debugging symbols found in c:\Projekt\nordic\aws_iot\build_1_enable_debug_options\zephyr\merged.hex)
    WARNING: Cortex-Debug will deprecate use of GDB version 8 after July 2022. Please upgrade to version 9+
    0x00000438 in ?? ()
    Program stopped, probably due to a reset and/or halt issued by debugger
    add symbol table from file "c:/Projekt/nordic/aws_iot/build_1_enable_debug_options/zephyr/zephyr.elf"
    (y or n) [answered Y; input not from terminal]
    Reading symbols from c:/Projekt/nordic/aws_iot/build_1_enable_debug_options/zephyr/zephyr.elf...
    add symbol table from file "c:/Projekt/nordic/aws_iot/build_1_enable_debug_options/mcuboot/zephyr/zephyr.elf"
    (y or n) [answered Y; input not from terminal]
    Reading symbols from c:/Projekt/nordic/aws_iot/build_1_enable_debug_options/mcuboot/zephyr/zephyr.elf...
    add symbol table from file "c:/Projekt/nordic/aws_iot/build_1_enable_debug_options/spm/zephyr/zephyr.elf"
    (y or n) [answered Y; input not from terminal]
    Reading symbols from c:/Projekt/nordic/aws_iot/build_1_enable_debug_options/spm/zephyr/zephyr.elf...
    2
    Resetting target
    [New Remote target]
    [Switching to Remote target]
    
    Thread 2 hit Temporary breakpoint 2, main () at C:/Projekt/NordicSemi/v1.9.1/modules/hal/nordic/nrfx/hal/nrf_wdt.h:427
    427	    p_reg->RR[rr_register] = NRF_WDT_RR_VALUE;
    Reading symbols from c:/projekt\nordicsemi\v1.9.1\toolchain\opt\bin\arm-none-eabi-objdump.exe --syms -C -h -w c:\Projekt\nordic\aws_iot\build_1_enable_debug_options\zephyr\merged.hex
    Reading symbols from c:/projekt/nordicsemi\v1.9.1\toolchain\opt\bin\arm-none-eabi-nm.exe --defined-only -S -l -C -p c:\Projekt\nordic\aws_iot\build_1_enable_debug_options\zephyr\merged.hex
    Launching GDB: "c:\\Projekt\\NordicSemi\\v1.9.1\\toolchain\\opt\\bin\\arm-none-eabi-gdb.exe" -q --interpreter=mi2 "c:\\Projekt\\nordic\\aws_iot\\build_1_enable_debug_options\\zephyr\\merged.hex"
        Set "showDevDebugOutput": true in your "launch.json" to see verbose GDB transactions here. Helpful to debug issues or report problems
    Launching gdb-server: "C:\\Program Files (x86)\\SEGGER\\JLink\\JLinkGDBServerCL.exe" -singlerun -nogui -if swd -port 50000 -swoport 50001 -telnetport 50002 -device nRF9160_xxAA -select usb=960008799 -rtos "C:\\Program Files (x86)\\SEGGER\\JLink\\GDBServer\\RTOSPlugin_Zephyr.dll"
        Please check TERMINAL tab (gdb-server) for output from C:\Program Files (x86)\SEGGER\JLink\JLinkGDBServerCL.exe
    Finished reading symbols from objdump: Time: 81 ms
    Finished reading symbols from nm: Time: 85 ms
    Reading symbols from c:\Projekt\nordic\aws_iot\build_1_enable_debug_options\zephyr\merged.hex...
    (No debugging symbols found in c:\Projekt\nordic\aws_iot\build_1_enable_debug_options\zephyr\merged.hex)
    WARNING: Cortex-Debug will deprecate use of GDB version 8 after July 2022. Please upgrade to version 9+
    0x00025b22 in ?? ()
    Program stopped, probably due to a reset and/or halt issued by debugger
    add symbol table from file "c:/Projekt/nordic/aws_iot/build_1_enable_debug_options/zephyr/zephyr.elf"
    (y or n) [answered Y; input not from terminal]
    Reading symbols from c:/Projekt/nordic/aws_iot/build_1_enable_debug_options/zephyr/zephyr.elf...
    add symbol table from file "c:/Projekt/nordic/aws_iot/build_1_enable_debug_options/mcuboot/zephyr/zephyr.elf"
    (y or n) [answered Y; input not from terminal]
    Reading symbols from c:/Projekt/nordic/aws_iot/build_1_enable_debug_options/mcuboot/zephyr/zephyr.elf...
    add symbol table from file "c:/Projekt/nordic/aws_iot/build_1_enable_debug_options/spm/zephyr/zephyr.elf"
    (y or n) [answered Y; input not from terminal]
    Reading symbols from c:/Projekt/nordic/aws_iot/build_1_enable_debug_options/spm/zephyr/zephyr.elf...
    2
    Resetting target
    [New Thread 536930240]
    [New Thread 536923376]
    [New Thread 536925696]
    [Switching to Thread 536930240]
    Run to 'main' timed out. Trying to pause program

  • Hi,

    As can be seen in debugging application, ENABLE_DEBUG_OPTIONS sets the following in the prj.conf
    CONFIG_DEBUG_OPTIMIZATIONS=y
    CONFIG_DEBUG_THREAD_INFO=y

    Best regards,
    Dejan

  • Hi,

    Could you please update nRF Command Line Tools to the version 10.16.0 (and J-Link v7.66a)?

    Best regards,
    Dejan

  • Hi,

    Now I have updated to version 10.16.0 of command line tools. I have tested quite a lot of times to debug, and it's a bit hard to figure out what is really happening. The behaviour is at least somewhat new.

    Every other time that I debug, the board is disconnected, and then reconnected. Then debugging doesn't work. I attach the printouts from the debug console. In the window "Disassembly" it says "Disassembly not available". This behaviour is also present when "Enable debug options" is not checked.

    The other times, when the board doesn't disconnect and reconnect, I have seen that either debugging works, or it doesn't. When debugging works, it will likely do that every other time (interwined with the disconnection behaviour) for a long period. And when debugging doesn't work, it will likely do that every other time for a long period.

    Best regards,
    Lars

    Reading symbols from c:/projekt\nordicsemi\v1.9.1\toolchain\opt\bin\arm-none-eabi-objdump.exe --syms -C -h -w c:\Projekt\nordic\aws_iot\build_1_enable_debug_options\zephyr\merged.hex
    Reading symbols from c:/projekt/nordicsemi\v1.9.1\toolchain\opt\bin\arm-none-eabi-nm.exe --defined-only -S -l -C -p c:\Projekt\nordic\aws_iot\build_1_enable_debug_options\zephyr\merged.hex
    Launching GDB: "c:\\Projekt\\NordicSemi\\v1.9.1\\toolchain\\opt\\bin\\arm-none-eabi-gdb.exe" -q --interpreter=mi2 "c:\\Projekt\\nordic\\aws_iot\\build_1_enable_debug_options\\zephyr\\merged.hex"
        Set "showDevDebugOutput": true in your "launch.json" to see verbose GDB transactions here. Helpful to debug issues or report problems
    Launching gdb-server: "C:\\Program Files (x86)\\SEGGER\\JLink\\JLinkGDBServerCL.exe" -singlerun -nogui -if swd -port 50000 -swoport 50001 -telnetport 50002 -device nRF9160_xxAA -select usb=960008799 -rtos "C:\\Program Files (x86)\\SEGGER\\JLink\\GDBServer\\RTOSPlugin_Zephyr.dll"
        Please check TERMINAL tab (gdb-server) for output from C:\Program Files (x86)\SEGGER\JLink\JLinkGDBServerCL.exe
    Finished reading symbols from objdump: Time: 96 ms
    Finished reading symbols from nm: Time: 83 ms
    Reading symbols from c:\Projekt\nordic\aws_iot\build_1_enable_debug_options\zephyr\merged.hex...
    (No debugging symbols found in c:\Projekt\nordic\aws_iot\build_1_enable_debug_options\zephyr\merged.hex)
    WARNING: Cortex-Debug will deprecate use of GDB version 8 after July 2022. Please upgrade to version 9+
    0x00000438 in ?? ()
    Program stopped, probably due to a reset and/or halt issued by debugger
    add symbol table from file "c:/Projekt/nordic/aws_iot/build_1_enable_debug_options/zephyr/zephyr.elf"
    (y or n) [answered Y; input not from terminal]
    Reading symbols from c:/Projekt/nordic/aws_iot/build_1_enable_debug_options/zephyr/zephyr.elf...
    add symbol table from file "c:/Projekt/nordic/aws_iot/build_1_enable_debug_options/mcuboot/zephyr/zephyr.elf"
    (y or n) [answered Y; input not from terminal]
    Reading symbols from c:/Projekt/nordic/aws_iot/build_1_enable_debug_options/mcuboot/zephyr/zephyr.elf...
    add symbol table from file "c:/Projekt/nordic/aws_iot/build_1_enable_debug_options/spm/zephyr/zephyr.elf"
    (y or n) [answered Y; input not from terminal]
    Reading symbols from c:/Projekt/nordic/aws_iot/build_1_enable_debug_options/spm/zephyr/zephyr.elf...
    2
    Resetting target
    [New Remote target]
    
    Thread 
    2 received signal SIGTRAP, Trace/breakpoint trap.
    [Switching to Remote target]
    0x00923e88 in ?? ()
    Debug-16: Enqueuing {"command":"disassemble","arguments":{"memoryReference":"0x00923e88","offset":0,"instructionOffset":-200,"instructionCount":400,"resolveSymbols":true},"type":"request","seq":16}
    Note: We detected the following memory regions as valid using gdb "info mem" and "objdump -h"
        This information is used to adjust bounds only when normal disassembly fails.
    ================================================================================
      Using following memory regions for disassembly
    ================================================================================
          Size   VMA Beg   VMA End   LMA Beg   LMA End  Attributes
    ================================================================================
      Unfortunately, No memory information from gdb (or gdb-server). Will try to manage without
      ------------------------------------------------------------------------------
      00007fa0  00000000  00007fa0  --------  --------  (.sec1) contents alloc load
      00010000  00010000  00020000  --------  --------  (.sec2) contents alloc load
      00010000  00020000  00030000  --------  --------  (.sec3) contents alloc load
      00010000  00030000  00040000  --------  --------  (.sec4) contents alloc load
      00006dd4  00040000  00046dd4  --------  --------  (.sec5) contents alloc load
    ================================================================================
    Debug-16: Dequeuing...
    Debug: Gdb command: -data-disassemble -s 0x00923b68 -e 0x009241a8 -- 5     1600 bytes 
    Error: GDB failed: Cannot access memory at address 0x923b68 (from data-disassemble -s 0x00923b68 -e 0x009241a8 -- 5)

Related