0

When launching Cortex-Debug in VSCode, the command gdb-set mi-async on triggers the error Failed to generate gdb commands: Cannot change this setting while the inferior is running. As a result, I cannot debug on VSCode. Full error report below.

Cortex-Debug: VSCode debugger extension version 1.12.0 git(d7a405a). Usage info: https://github.com/Marus/cortex-debug#usage
Reading symbols from arm-none-eabi-objdump.exe --syms -C -h -w C:/Users/UserName/Documents/repos/stm32f7-ethercat-node/main.elf
Reading symbols from arm-none-eabi-nm.exe --defined-only -S -l -C -p C:/Users/UserName/Documents/repos/stm32f7-ethercat-node/main.elf
Launching GDB: arm-none-eabi-gdb.exe -q --interpreter=mi2
1-gdb-version
Launching gdb-server: openocd.exe -c "gdb_port 50000" -c "tcl_port 50001" -c "telnet_port 50002" -s "C:\\Users\\UserName\\Documents\\repos\\stm32f7-ethercat-node" -f "c:/Users/UserName/.vscode/extensions/marus25.cortex-debug-1.12.0/support/openocd-helpers.tcl" -f board/st_nucleo_f7.cfg
    Please check TERMINAL tab (gdb-server) for output from openocd.exe
-> =thread-group-added,id="i1"
-> =cmd-param-changed,param="detach-on-fork",value="off"
-> =cmd-param-changed,param="mi-async",value="on"
Finished reading symbols from objdump: Time: 129 ms
Finished reading symbols from nm: Time: 232 ms
-> =thread-group-started,id="i1",pid="42000"
-> &"warning: No executable has been specified and target does not support\ndetermining executable automatically.  Try using the \"file\" command."
warning: No executable has been specified and target does not support
determining executable automatically.  Try using the "file" command.
-> &"\n"

-> =thread-created,id="1",group-id="i1"
-> ~"0x0800873e in ?? ()\n"
-> *stopped,frame={addr="0x0800873e",func="??",args=[],arch="arm"},thread-id="1",stopped-threads="all"
mi2.status = stopped
Program stopped, probably due to a reset and/or halt issued by debugger
-> @"Unable to match requested speed 2000 kHz, using 1800 kHz\n"
Unable to match requested speed 2000 kHz, using 1800 kHz
-> @"Unable to match requested speed 2000 kHz, using 1800 kHz\n"
Unable to match requested speed 2000 kHz, using 1800 kHz
-> @"[stm32f7x.cpu] halted due to debug-request, current mode: Thread \n"
[stm32f7x.cpu] halted due to debug-request, current mode: Thread
-> @"xPSR: 0x01000000 pc: 0x08000aa0 msp: 0x20080000\n"
xPSR: 0x01000000 pc: 0x08000aa0 msp: 0x20080000
-> @"Unable to match requested speed 8000 kHz, using 4000 kHz\n"
Unable to match requested speed 8000 kHz, using 4000 kHz
-> @"Unable to match requested speed 8000 kHz, using 4000 kHz\n"
Unable to match requested speed 8000 kHz, using 4000 kHz
-> ~"GNU gdb (GNU Arm Embedded Toolchain 10.3-2021.10) 10.2.90.20210621-git\n"
-> ~"Copyright (C) 2021 Free Software Foundation, Inc.\n"
-> ~"License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>\nThis is free software: you are free to change and redistribute it.\nThere is NO WARRANTY, to the extent permitted by law."
-> ~"\nType \"show copying\" and \"show warranty\" for details.\n"
-> ~"This GDB was configured as \"--host=i686-w64-mingw32 --target=arm-none-eabi\".\n"
-> ~"Type \"show configuration\" for configuration details.\n"
-> ~"For bug reporting instructions, please see:\n"
-> ~"<https://www.gnu.org/software/gdb/bugs/>.\n"
-> ~"Find the GDB manual and other documentation resources online at:\n    <http://www.gnu.org/software/gdb/documentation/>."
-> ~"\n\n"
-> ~"For help, type \"help\".\n"
-> ~"Type \"apropos word\" to search for commands related to \"word\".\n"
-> 1^done
2-thread-list-ids
0x0800873e in ?? ()
-> 2^done,thread-ids={thread-id="1"},current-thread-id="1",number-of-threads="1"
3-thread-list-ids
-> 3^done,thread-ids={thread-id="1"},current-thread-id="1",number-of-threads="1"
4-gdb-set mi-async on
-> 4^error,msg="Cannot change this setting while the inferior is running."
5-interpreter-exec console "set print demangle on"
Failed to generate gdb commands: Cannot change this setting while the inferior is running. (from gdb-set mi-async on)
Cannot change this setting while the inferior is running.
    at i (c:\Users\UserName\.vscode\extensions\marus25.cortex-debug-1.12.0\dist\debugadapter.js:2:147816)
    at handlers.<computed> (c:\Users\UserName\.vscode\extensions\marus25.cortex-debug-1.12.0\dist\debugadapter.js:2:148310)
    at c:\Users\UserName\.vscode\extensions\marus25.cortex-debug-1.12.0\dist\debugadapter.js:2:135616
    at Array.forEach (<anonymous>)
    at b.onOutput (c:\Users\UserName\.vscode\extensions\marus25.cortex-debug-1.12.0\dist\debugadapter.js:2:135045)
    at b.stdout (c:\Users\UserName\.vscode\extensions\marus25.cortex-debug-1.12.0\dist\debugadapter.js:2:134462)
    at Socket.emit (node:events:513:28)
    at addChunk (node:internal/streams/readable:315:12)
    at readableAddChunk (node:internal/streams/readable:289:9)
    at Readable.push (node:internal/streams/readable:228:10)

I checked for the error in other sources, and it is related to not being able to halt the inferior. However, if I connect the debugger to the remote target in the command line, halt the execution, and try to run set mi-async on, the same error message is displayed.

I wonder if the change of settings has to be done before the target is attached. Any leads are appreciated.

Versions

  • VSCode Version: 1.79.2
  • Cortex-Debug Version: v1.12.0
  • OS: Windows 11 22H2
  • GDB Version: GNU gdb (GNU Arm Embedded Toolchain 10.3-2021.10) 10.2.90.20210621-git
  • Compiler Toolchain Version: gcc version 10.3.1 20210824 (release) (GNU Arm Embedded Toolchain 10.3-2021.10)

launch.json

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "openOCD Debug",
            "cwd": "${workspaceRoot}",
            "executable": "${workspaceRoot}/main.elf",
            "request": "launch",
            "type": "cortex-debug",
            "servertype": "openocd",
            "device": "STM32F767",
            "configFiles": [
                "board/st_nucleo_f7.cfg"
            ],
            "svdFile": "${workspaceRoot}/STM32F7x7.svd",
            "preLaunchTask": "Build All",
            "showDevDebugOutput": "raw",
        }
    ]
}

.gdbinit

target remote localhost:50007
monitor reset init
monitor halt
Hyori
  • 1
  • 1
  • You will need to `set mi-async on` before starting any inferior and before connecting to a remote target. This setting relates to how GDB controls inferiors. GDB doesn't currently support changing this setting once things are up and running. As the MI interface is intended for use by programmed frontends, the expectation is that a frontend will be written either for async mode, or non-async mode. If a f/e wants async mode then it would adjust this setting as soon as it started GDB before doing anything else. – Andrew Jun 17 '23 at 06:55

0 Answers0