[SOLVED] Issues with GDB debugging

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

  • [SOLVED] Issues with GDB debugging

    Hi,

    I'm working on VS-Code and use Cortex Debug plugin to debug my IMXRT1176. When program is linked to rum von NOR flash all is working fine, but when it's configured to rum von RAM debugging in VS-Code is not possible (Debugger reset MCU but then start program from NOR and not from RAM). When using generated elf file with OZONE I can debug without problems.

    It seems like JLinkGDBServerCL.exe wont set PC/SP according information from elf after reset/loading. I try to fix this with jLinkScript but was not able to write PC because several commands i.e. "Elf.GetExprValue("ResetISR");" or "Target.SetReg("PC", PC);" won't work.

    I want to load jdebug file from OZONE with JLinkGDBServerCL.exe but i can't find how it's done.

    I would be grateful for any suggestion how to solve my issue.
  • Hi,

    A J-Link script file is the wrong approach here.
    GDB Server has zero knowledge about the ELF file. All the debug information parsing (function/variable names, stack frames, ...) is done by GDB which has access to the ELF file.
    GDB only provides the extracted binary application data to GDB Server for the download into the target device.

    This means, the settings of PC & SP based on the ELF info is something, you would have to do on the VSCode / GDB side, rather than on the J-Link / GDB Server side.


    BR
    Alex
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.
  • Thanks,

    after some research I found at least a solution which work after additional restart, add:
    "postRestartCommands": [
    "load",
    "set $pc = &ResetISR",
    to my launch.json to tell GDB to set PC. Not yet found something for initial launch but still searching.