jedrzejboczar / nvim-dap-cortex-debug

Extension for nvim-dap providing integration with VS Code's cortex-debug
MIT License
35 stars 3 forks source link

Bug: The "path" argument must be of type string #7

Closed i-ilak closed 2 months ago

i-ilak commented 5 months ago

I have some trouble with the setup for this plugin. This is my adapter setup code

local dap = require('dap')
local dap_cortex_debug = require('dap-cortex-debug')

dap_cortex_debug.setup {
    debug = false,
    extension_path = nil,
    lib_extension = nil,
    node_path = '/opt/homebrew/bin/node',
    dapui_rtt = true,
    dap_vscode_filetypes = { 'c', 'cpp' },
}

Running :checkhealth ... gives

dap-cortex-debug: require("dap-cortex-debug.health").check()

nvim-dap-cortex-debug ~
- OK Node.js installed: v21.7.2
- OK cortex-debug extension found: /Users/iilak/.local/share/nvim/mason/share/cortex-debug
- OK Found debugadapter.js: /Users/iilak/.local/share/nvim/mason/share/cortex-debug/dist/debugadapter.js

My configuration is in a .vscode/launch.json file and looks like this

{
    "version": "0.2.0",
    "configurations": [
    {
        "name": "Debug_CM7",
        "type": "cortex-debug",
        "request": "launch",
        "breakAfterReset": false,
        "runToEntryPoint": "main",
        "preLaunchTask": "Build",
        "servertype": "openocd",
        "numberOfProcessors": 2,
        "targetProcessor": 0,
        "executable": "./build/CM7_firmware.elf",
        "device": "STM32H755",
        "configFiles": [
            "/opt/homebrew/share/openocd/scripts/interface/stlink.cfg",
            "/opt/homebrew/share/openocd/scripts/target/stm32h7x.cfg"
        ],
        "svdFile": "./STM32H755_CM7.svd",
        "showDevDebugOutput": "vscode"
    }
  ]
}

It was tested with vscode and worked perfectly fine. When I start the same configuration with nvim I get this error

[ DEBUG ] 2024-04-13T21:41:40Z+0200 ] ...ilak/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:1373 ]    "Spawning debug adapter"    {
  args = { "/Users/iilak/.local/share/nvim/mason/share/cortex-debug/dist/debugadapter.js" },
  command = "/opt/homebrew/bin/node",
  enrich_config = <function 1>,
  options = {
    detached = false
  },
  type = "executable"
}
[ DEBUG ] 2024-04-13T21:41:40Z+0200 ] ...ilak/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:1683 ]    "request"   {
  arguments = {
    adapterID = "nvim-dap",
    clientID = "neovim",
    clientName = "neovim",
    columnsStartAt1 = true,
    linesStartAt1 = true,
    locale = "en_US.UTF-8",
    pathFormat = "path",
    supportsProgressReporting = true,
    supportsRunInTerminalRequest = true,
    supportsStartDebuggingRequest = true,
    supportsVariableType = true
  },
  command = "initialize",
  seq = 1,
  type = "request"
}
[ DEBUG ] 2024-04-13T21:41:40Z+0200 ] ...ilak/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:957 ] 2   {
  body = {
    supportSuspendDebuggee = true,
    supportTerminateDebuggee = true,
    supportsConditionalBreakpoints = true,
    supportsConfigurationDoneRequest = true,
    supportsDataBreakpoints = true,
    supportsDisassembleRequest = true,
    supportsEvaluateForHovers = true,
    supportsFunctionBreakpoints = true,
    supportsGotoTargetsRequest = true,
    supportsHitConditionalBreakpoints = true,
    supportsInstructionBreakpoints = true,
    supportsLogPoints = true,
    supportsReadMemoryRequest = true,
    supportsRestartRequest = true,
    supportsSetVariable = true,
    supportsSteppingGranularity = true,
    supportsWriteMemoryRequest = true
  },
  command = "initialize",
  request_seq = 1,
  seq = 1,
  success = true,
  type = "response"
}
[ DEBUG ] 2024-04-13T21:41:40Z+0200 ] ...ilak/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:1683 ]    "request"   {
  arguments = {
    breakAfterReset = false,
    configFiles = { "/opt/homebrew/share/openocd/scripts/interface/stlink.cfg", "/opt/homebrew/share/openocd/scripts/target/stm32h7x.cfg" },
    debuggerArgs = {},
    device = "STM32H755",
    executable = "./build/CM7_firmware.elf",
    extensionPath = "/Users/iilak/.local/share/nvim/mason/share/cortex-debug",
    gdbServerConsolePort = 49226,
    graphConfig = {},
    name = "Debug_CM7",
    numberOfProcessors = 2,
    postAttachCommands = {},
    postLaunchCommands = {},
    postRestartCommands = {},
    preAttachCommands = {},
    preLaunchCommands = {},
    preLaunchTask = "Build",
    preRestartCommands = {},
    registerUseNaturalFormat = true,
    request = "launch",
    rttConfig = {
      decoders = {},
      enabled = false
    },
    runToEntryPoint = "main",
    searchDir = {},
    servertype = "openocd",
    showDevDebugOutput = "vscode",
    svdFile = "./STM32H755_CM7.svd",
    swoConfig = {
      cpuFrequency = 0,
      decoders = {},
      enabled = false,
      source = "probe",
      swoFrequency = 0
    },
    targetProcessor = 0,
    toolchainPrefix = "arm-none-eabi",
    type = "cortex-debug",
    variableUseNaturalFormat = true
  },
  command = "launch",
  seq = 2,
  type = "request"
}
[ DEBUG ] 2024-04-13T21:41:40Z+0200 ] ...ilak/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:957 ] 2   {
  body = {
    error = {
      format = "{_stack}",
      id = 1104,
      sendTelemetry = true,
      variables = {
        _exception = 
    'The "path" argument must be of type string. Received undefined', 
_stack = 'TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received undefined\n    at Object.join (node:path:1175:7)\n    
at U.normalizeArguments (/Users/iilak/.local/share/nvim/mason/packages/cortex-debug/extension/dist/debugadapter.js:2:193038)\n    
at U.launchAttachInit (/Users/iilak/.local/share/nvim/mason/packages/cortex-debug/extension/dist/debugadapter.js:2:190651)\n    
at U.launchRequest (/Users/iilak/.local/share/nvim/mason/packages/cortex-debug/extension/dist/debugadapter.js:2:192770)\n    
at U.dispatchRequest (/Users/iilak/.local/share/nvim/mason/packages/cortex-debug/extension/dist/debugadapter.js:2:5228)\n    
at U.dispatchRequest (/Users/iilak/.local/share/nvim/mason/packages/cortex-debug/extension/dist/debugadapter.js:2:17964)\n    
at U.handleMessage (/Users/iilak/.local/share/nvim/mason/packages/cortex-debug/extension/dist/debugadapter.js:2:22599)\n    
at U._handleData (/Users/iilak/.local/share/nvim/mason/packages/cortex-debug/extension/dist/debugadapter.js:2:24335)\n    
at Socket.<anonymous> (/Users/iilak/.local/share/nvim/mason/packages/cortex-debug/extension/dist/debugadapter.js:2:22934)\n    
at Socket.emit (node:events:519:28)'
      }
    }
  },
  command = "launch",
  message = 'TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received undefined\n    
at Object.join (node:path:1175:7)\n    
at U.normalizeArguments (/Users/iilak/.local/share/nvim/mason/packages/cortex-debug/extension/dist/debugadapter.js:2:193038)\n    
at U.launchAttachInit (/Users/iilak/.local/share/nvim/mason/packages/cortex-debug/extension/dist/debugadapter.js:2:190651)\n    
at U.launchRequest (/Users/iilak/.local/share/nvim/mason/packages/cortex-debug/extension/dist/debugadapter.js:2:192770)\n    
at U.dispatchRequest (/Users/iilak/.local/share/nvim/mason/packages/cortex-debug/extension/dist/debugadapter.js:2:5228)\n    
at U.dispatchRequest (/Users/iilak/.local/share/nvim/mason/packages/cortex-debug/extension/dist/debugadapter.js:2:17964)\n    
at U.handleMessage (/Users/iilak/.local/share/nvim/mason/packages/cortex-debug/extension/dist/debugadapter.js:2:22599)\n    
at U._handleData (/Users/iilak/.local/share/nvim/mason/packages/cortex-debug/extension/dist/debugadapter.js:2:24335)\n    
at Socket.<anonymous> (/Users/iilak/.local/share/nvim/mason/packages/cortex-debug/extension/dist/debugadapter.js:2:22934)\n    
at Socket.emit (node:events:519:28)',
  request_seq = 2,
  seq = 2,
  success = false,
  type = "response"
}

The path seems to me like a valid string... Any idea what is wrong?

jedrzejboczar commented 5 months ago

I think it's missing cwd. Try adding "cwd": "${workspaceFolder}",. If this works, then please also check if https://github.com/jedrzejboczar/nvim-dap-cortex-debug/tree/jb/default-cwd fixes the original problem (when cwd is not set).

i-ilak commented 5 months ago

Unfortunately, it did not/might have solved the issue, but now I get an other error...


[ DEBUG ] 2024-04-16T20:46:07Z+0200 ] ...ilak/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:1373 ]    "Spawning debug adapter"    {
  args = { "/Users/iilak/.local/share/nvim/mason/share/cortex-debug/dist/debugadapter.js" },
  command = "/opt/homebrew/bin/node",
  enrich_config = <function 1>,
  options = {
    detached = false
  },
  type = "executable"
}
[ DEBUG ] 2024-04-16T20:46:07Z+0200 ] ...ilak/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:1683 ]    "request"   {
  arguments = {
    adapterID = "nvim-dap",
    clientID = "neovim",
    clientName = "neovim",
    columnsStartAt1 = true,
    linesStartAt1 = true,
    locale = "en_US.UTF-8",
    pathFormat = "path",
    supportsProgressReporting = true,
    supportsRunInTerminalRequest = true,
    supportsStartDebuggingRequest = true,
    supportsVariableType = true
  },
  command = "initialize",
  seq = 1,
  type = "request"
}
[ DEBUG ] 2024-04-16T20:46:07Z+0200 ] ...ilak/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:957 ] 2   {
  body = {
    supportSuspendDebuggee = true,
    supportTerminateDebuggee = true,
    supportsConditionalBreakpoints = true,
    supportsConfigurationDoneRequest = true,
    supportsDataBreakpoints = true,
    supportsDisassembleRequest = true,
    supportsEvaluateForHovers = true,
    supportsFunctionBreakpoints = true,
    supportsGotoTargetsRequest = true,
    supportsHitConditionalBreakpoints = true,
    supportsInstructionBreakpoints = true,
    supportsLogPoints = true,
    supportsReadMemoryRequest = true,
    supportsRestartRequest = true,
    supportsSetVariable = true,
    supportsSteppingGranularity = true,
    supportsWriteMemoryRequest = true
  },
  command = "initialize",
  request_seq = 1,
  seq = 1,
  success = true,
  type = "response"
}
[ DEBUG ] 2024-04-16T20:46:09Z+0200 ] ...ilak/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:1683 ]    "request"   {
  arguments = {
    breakAfterReset = false,
    configFiles = { "interface/stlink.cfg", "target/stm32h7x.cfg" },
    cwd = "/Users/iilak/prg/internal/cas_embedded_systems/exercises/02_kunz/exercises",
    debuggerArgs = {},
    device = "STM32H755",
    executable = "./build/CM7_firmware.elf",
    extensionPath = "/Users/iilak/.local/share/nvim/mason/share/cortex-debug",
    gdbServerConsolePort = 55878,
    graphConfig = {},
    name = "Debug_CM7",
    numberOfProcessors = 2,
    postAttachCommands = {},
    postLaunchCommands = {},
    postRestartCommands = {},
    preAttachCommands = {},
    preLaunchCommands = {},
    preRestartCommands = {},
    registerUseNaturalFormat = true,
    request = "launch",
    rttConfig = {
      decoders = {},
      enabled = false
    },
    runToEntryPoint = "main",
    searchDir = {},
    servertype = "openocd",
    showDevDebugOutput = "vscode",
    svdFile = "./STM32H755_CM7.svd",
    swoConfig = {
      cpuFrequency = 0,
      decoders = {},
      enabled = false,
      source = "probe",
      swoFrequency = 0
    },
    targetProcessor = 0,
    toolchainPrefix = "arm-none-eabi",
    type = "cortex-debug",
    variableUseNaturalFormat = true
  },
  command = "launch",
  seq = 2,
  type = "request"
}
[ DEBUG ] 2024-04-16T20:46:09Z+0200 ] ...ilak/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:957 ] 2   {
  body = {
    category = "stdout",
    output = "Cortex-Debug: VSCode debugger extension version undefined git(652d042). Usage info: https://github.com/Marus/cortex-debug#usage"
  },
  event = "output",
  seq = 2,
  type = "event"
}
[ DEBUG ] 2024-04-16T20:46:09Z+0200 ] ...ilak/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:957 ] 2   {
  body = {
    category = "stderr",
    output = '"configuration": {\n    "runToEntryPoint": "main",\n    "targetProcessor": 0,\n    "device": "STM32H755",\n    "gdbServerConsolePort": 55878,\n    "searchDir": [],\n    "svdFile": "/Users/iilak/prg/internal/cas_embedded_systems/exercises/02_kunz/exercises/STM32H755_CM7.svd",\n    "configFiles": [\n        "interface/stlink.cfg",\n        "target/stm32h7x.cfg"\n    ],\n    "showDevDebugOutput": "raw",\n    "swoConfig": {\n        "source": "probe",\n        "enabled": false,\n        "decoders": [],\n        "swoFrequency": 0,\n        "cpuFrequency": 0\n    },\n    "registerUseNaturalFormat": true,\n    "extensionPath": "/Users/iilak/.local/share/nvim/mason/share/cortex-debug",\n    "rttConfig": {\n        "enabled": false,\n        "decoders": []\n    },\n    "toolchainPrefix": "arm-none-eabi",\n    "postRestartCommands": [],\n    "preRestartCommands": [],\n    "postAttachCommands": [],\n    "preAttachCommands": [],\n    "postLaunchCommands": [],\n    "preLaunchCommands": [],\n    "executable": "/Users/iilak/prg/internal/cas_embedded_systems/exercises/02_kunz/exercises/build/CM7_firmware.elf",\n    "graphConfig": [],\n    "cwd": "/Users/iilak/prg/internal/cas_embedded_systems/exercises/02_kunz/exercises",\n    "variableUseNaturalFormat": true,\n    "debuggerArgs": [],\n    "request": "launch",\n    "name": "Debug_CM7",\n    "numberOfProcessors": 2,\n    "servertype": "openocd",\n    "type": "cortex-debug",\n    "breakAfterReset": false,\n    "pvtShowDevDebugOutput": "vscode"\n}\n'
  },
  event = "output",
  seq = 3,
  type = "event"
}
[ DEBUG ] 2024-04-16T20:46:09Z+0200 ] ...ilak/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:957 ] 2   {
  body = {
    category = "stderr",
    output = "Reading symbols from arm-none-eabi-objdump --syms -C -h -w /Users/iilak/prg/internal/cas_embedded_systems/exercises/02_kunz/exercises/build/CM7_firmware.elf\n"
  },
  event = "output",
  seq = 4,
  type = "event"
}
[ DEBUG ] 2024-04-16T20:46:09Z+0200 ] ...ilak/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:957 ] 2   {
  body = {
    category = "stderr",
    output = "Reading symbols from arm-none-eabi-nm --defined-only -S -l -C -p /Users/iilak/prg/internal/cas_embedded_systems/exercises/02_kunz/exercises/build/CM7_firmware.elf\n"
  },
  event = "output",
  seq = 5,
  type = "event"
}
[ DEBUG ] 2024-04-16T20:46:09Z+0200 ] ...ilak/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:957 ] 2   {
  body = {
    category = "stderr",
    output = "Launching GDB: arm-none-eabi-gdb -q --interpreter=mi2\n"
  },
  event = "output",
  seq = 6,
  type = "event"
}
[ DEBUG ] 2024-04-16T20:46:09Z+0200 ] ...ilak/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:957 ] 2   {
  body = {
    category = "stderr",
    output = "1-gdb-version\n"
  },
  event = "output",
  seq = 7,
  type = "event"
}
[ DEBUG ] 2024-04-16T20:46:09Z+0200 ] ...ilak/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:957 ] 2   {
  body = {
    category = "stdout",
    output = 'From client: initialize({"adapterID":"nvim-dap","supportsRunInTerminalRequest":true,"linesStartAt1":true,"columnsStartAt1":true,"pathFormat":"path","clientName":"neovim","clientID":"neovim","supportsStartDebuggingRequest":true,"supportsProgressReporting":true,"supportsVariableType":true,"locale":"en_US.UTF-8"})\n'
  },
  event = "output",
  seq = 8,
  type = "event"
}
[ DEBUG ] 2024-04-16T20:46:09Z+0200 ] ...ilak/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:957 ] 2   {
  body = {
    category = "stdout",
    output = 'To client: {"seq":0,"type":"response","request_seq":1,"command":"initialize","success":true,"body":{"supportsHitConditionalBreakpoints":true,"supportsConfigurationDoneRequest":true,"supportsConditionalBreakpoints":true,"supportsLogPoints":true,"supportsFunctionBreakpoints":true,"supportsEvaluateForHovers":true,"supportsSetVariable":true,"supportsRestartRequest":true,"supportsGotoTargetsRequest":true,"supportSuspendDebuggee":true,"supportTerminateDebuggee":true,"supportsDataBreakpoints":true,"supportsDisassembleRequest":true,"supportsSteppingGranularity":true,"supportsInstructionBreakpoints":true,"supportsReadMemoryRequest":true,"supportsWriteMemoryRequest":true}}\n'
  },
  event = "output",
  seq = 9,
  type = "event"
}
[ DEBUG ] 2024-04-16T20:46:09Z+0200 ] ...ilak/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:957 ] 2   {
  body = {
    category = "stdout",
    output = 'From client: launch({"runToEntryPoint":"main","targetProcessor":0,"device":"STM32H755","gdbServerConsolePort":55878,"searchDir":[],"svdFile":"./STM32H755_CM7.svd","configFiles":["interface/stlink.cfg","target/stm32h7x.cfg"],"showDevDebugOutput":"vscode","swoConfig":{"source":"probe","enabled":false,"decoders":[],"swoFrequency":0,"cpuFrequency":0},"registerUseNaturalFormat":true,"extensionPath":"/Users/iilak/.local/share/nvim/mason/share/cortex-debug","rttConfig":{"enabled":false,"decoders":[]},"toolchainPrefix":"arm-none-eabi","postRestartCommands":[],"preRestartCommands":[],"postAttachCommands":[],"preAttachCommands":[],"postLaunchCommands":[],"preLaunchCommands":[],"executable":"./build/CM7_firmware.elf","graphConfig":[],"cwd":"/Users/iilak/prg/internal/cas_embedded_systems/exercises/02_kunz/exercises","variableUseNaturalFormat":true,"debuggerArgs":[],"request":"launch","name":"Debug_CM7","numberOfProcessors":2,"servertype":"openocd","type":"cortex-debug","breakAfterReset":false})\n'
  },
  event = "output",
  seq = 10,
  type = "event"
}
[ DEBUG ] 2024-04-16T20:46:09Z+0200 ] ...ilak/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:957 ] 2   {
  body = {
    category = "stdout",
    output = 'To client: {"seq":0,"type":"event","event":"output","body":{"category":"stdout","output":"Cortex-Debug: VSCode debugger extension version undefined git(652d042). Usage info: https://github.com/Marus/cortex-debug#usage"}}\n'
  },
  event = "output",
  seq = 11,
  type = "event"
}
[ DEBUG ] 2024-04-16T20:46:09Z+0200 ] ...ilak/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:957 ] 2   {
  body = {
    category = "stdout",
    output = 'To client: {"seq":0,"type":"event","event":"output","body":{"category":"stderr","output":"\\"configuration\\": {\\n    \\"runToEntryPoint\\": \\"main\\",\\n    \\"targetProcessor\\": 0,\\n    \\"device\\": \\"STM32H755\\",\\n    \\"gdbServerConsolePort\\": 55878,\\n    \\"searchDir\\": [],\\n    \\"svdFile\\": \\"/Users/iilak/prg/internal/cas_embedded_systems/exercises/02_kunz/exercises/STM32H755_CM7.svd\\",\\n    \\"configFiles\\": [\\n        \\"interface/stlink.cfg\\",\\n        \\"target/stm32h7x.cfg\\"\\n    ],\\n    \\"showDevDebugOutput\\": \\"raw\\",\\n    \\"swoConfig\\": {\\n        \\"source\\": \\"probe\\",\\n        \\"enabled\\": false,\\n        \\"decoders\\": [],\\n        \\"swoFrequency\\": 0,\\n        \\"cpuFrequency\\": 0\\n    },\\n    \\"registerUseNaturalFormat\\": true,\\n    \\"extensionPath\\": \\"/Users/iilak/.local/share/nvim/mason/share/cortex-debug\\",\\n    \\"rttConfig\\": {\\n        \\"enabled\\": false,\\n        \\"decoders\\": []\\n    },\\n    \\"toolchainPrefix\\": \\"arm-none-eabi\\",\\n    \\"postRestartCommands\\": [],\\n    \\"preRestartCommands\\": [],\\n    \\"postAttachCommands\\": [],\\n    \\"preAttachCommands\\": [],\\n    \\"postLaunchCommands\\": [],\\n    \\"preLaunchCommands\\": [],\\n    \\"executable\\": \\"/Users/iilak/prg/internal/cas_embedded_systems/exercises/02_kunz/exercises/build/CM7_firmware.elf\\",\\n    \\"graphConfig\\": [],\\n    \\"cwd\\": \\"/Users/iilak/prg/internal/cas_embedded_systems/exercises/02_kunz/exercises\\",\\n    \\"variableUseNaturalFormat\\": true,\\n    \\"debuggerArgs\\": [],\\n    \\"request\\": \\"launch\\",\\n   [...]\n'
  },
  event = "output",
  seq = 12,
  type = "event"
}
[ DEBUG ] 2024-04-16T20:46:09Z+0200 ] ...ilak/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:957 ] 2   {
  body = {
    category = "stdout",
    output = 'To client: {"seq":0,"type":"event","event":"output","body":{"category":"stderr","output":"Reading symbols from arm-none-eabi-objdump --syms -C -h -w /Users/iilak/prg/internal/cas_embedded_systems/exercises/02_kunz/exercises/build/CM7_firmware.elf\\n"}}\n'
  },
  event = "output",
  seq = 13,
  type = "event"
}
[ DEBUG ] 2024-04-16T20:46:09Z+0200 ] ...ilak/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:957 ] 2   {
  body = {
    category = "stdout",
    output = 'To client: {"seq":0,"type":"event","event":"output","body":{"category":"stderr","output":"Reading symbols from arm-none-eabi-nm --defined-only -S -l -C -p /Users/iilak/prg/internal/cas_embedded_systems/exercises/02_kunz/exercises/build/CM7_firmware.elf\\n"}}\n'
  },
  event = "output",
  seq = 14,
  type = "event"
}
[ DEBUG ] 2024-04-16T20:46:09Z+0200 ] ...ilak/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:957 ] 2   {
  body = {
    category = "stdout",
    output = 'To client: {"seq":0,"type":"event","event":"output","body":{"category":"stderr","output":"Launching GDB: arm-none-eabi-gdb -q --interpreter=mi2\\n"}}\n'
  },
  event = "output",
  seq = 15,
  type = "event"
}
[ DEBUG ] 2024-04-16T20:46:09Z+0200 ] ...ilak/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:957 ] 2   {
  body = {
    category = "stdout",
    output = 'To client: {"seq":0,"type":"event","event":"output","body":{"category":"stderr","output":"1-gdb-version\\n"}}\n'
  },
  event = "output",
  seq = 16,
  type = "event"
}
[ DEBUG ] 2024-04-16T20:46:09Z+0200 ] ...ilak/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:957 ] 2   {
  body = {
    category = "stdout",
    output = 'To client: {"seq":0,"type":"event","event":"custom-event-ports-allocated","body":{"info":[50000,50001,50002,50003,50004,50005,50006,50007]}}\n'
  },
  event = "output",
  seq = 17,
  type = "event"
}
[ DEBUG ] 2024-04-16T20:46:09Z+0200 ] ...ilak/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:957 ] 2   {
  body = {
    info = { 50000, 50001, 50002, 50003, 50004, 50005, 50006, 50007 }
  },
  event = "custom-event-ports-allocated",
  seq = 18,
  type = "event"
}
[ DEBUG ] 2024-04-16T20:46:09Z+0200 ] ...ilak/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:957 ] 2   {
  body = {
    category = "stdout",
    output = 'To client: {"seq":0,"type":"event","event":"custom-event-ports-done","body":{}}\n'
  },
  event = "output",
  seq = 19,
  type = "event"
}
[ DEBUG ] 2024-04-16T20:46:09Z+0200 ] ...ilak/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:957 ] 2   {
  body = vim.empty_dict(),
  event = "custom-event-ports-done",
  seq = 20,
  type = "event"
}
[ DEBUG ] 2024-04-16T20:46:09Z+0200 ] ...ilak/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:957 ] 2   {
  body = {
    category = "stderr",
    output = 'Launching gdb-server: openocd -c "gdb_port 50000" -c "tcl_port 50002" -c "telnet_port 50004" -s /Users/iilak/prg/internal/cas_embedded_systems/exercises/02_kunz/exercises -f /Users/iilak/.local/share/nvim/mason/share/cortex-debug/support/openocd-helpers.tcl -f interface/stlink.cfg -f target/stm32h7x.cfg\n'
  },
  event = "output",
  seq = 21,
  type = "event"
}
[ DEBUG ] 2024-04-16T20:46:09Z+0200 ] ...ilak/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:957 ] 2   {
  body = {
    category = "stdout",
    output = "    Please check TERMINAL tab (gdb-server) for output from openocd\n"
  },
  event = "output",
  seq = 22,
  type = "event"
}
[ DEBUG ] 2024-04-16T20:46:11Z+0200 ] ...ilak/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:957 ] 2   {
  body = {
    category = "stderr",
    output = "Finished reading symbols from objdump: Time: 31 ms\n"
  },
  event = "output",
  seq = 23,
  type = "event"
}
[ DEBUG ] 2024-04-16T20:46:11Z+0200 ] ...ilak/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:957 ] 2   {
  body = {
    category = "stderr",
    output = "OpenOCD: GDB Server Quit Unexpectedly. See gdb-server output in TERMINAL tab for more details."
  },
  event = "output",
  seq = 24,
  type = "event"
}
[ DEBUG ] 2024-04-16T20:46:11Z+0200 ] ...ilak/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:957 ] 2   {
  body = {
    category = "stdout",
    output = 'To client: {"seq":0,"type":"response","request_seq":2,"command":"launch","success":false,"message":"OpenOCD: GDB Server Quit Unexpectedly. See gdb-server output in TERMINAL tab for more details.","body":{"error":{"id":103,"format":"OpenOCD: GDB Server Quit Unexpectedly. See gdb-server output in TERMINAL tab for more details.","showUser":true}}}\n'
  },
  event = "output",
  seq = 25,
  type = "event"
}
[ DEBUG ] 2024-04-16T20:46:11Z+0200 ] ...ilak/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:957 ] 2   {
  body = {
    error = {
      format = "OpenOCD: GDB Server Quit Unexpectedly. See gdb-server output in TERMINAL tab for more details.",
      id = 103,
      showUser = true
    }
  },
  command = "launch",
  message = "OpenOCD: GDB Server Quit Unexpectedly. See gdb-server output in TERMINAL tab for more details.",
  request_seq = 2,
  seq = 26,
  success = false,
  type = "response"
}
[ DEBUG ] 2024-04-16T20:46:11Z+0200 ] ...ilak/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:957 ] 2   {
  body = {
    category = "stderr",
    output = "Finished reading symbols from nm: Time: 42 ms\n"
  },
  event = "output",
  seq = 27,
  type = "event"
}
[ DEBUG ] 2024-04-16T20:46:11Z+0200 ] ...ilak/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:957 ] 2   {
  body = {
    category = "stderr",
    output = '-> =thread-group-added,id="i1"\n'
  },
  event = "output",
  seq = 28,
  type = "event"
}
[ DEBUG ] 2024-04-16T20:46:11Z+0200 ] ...ilak/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:957 ] 2   {
  body = {
    category = "stderr",
    output = '-> ~"GNU gdb (Arm GNU Toolchain 13.2.rel1 (Build arm-13.7)) 13.2.90.20231008-git\\n"\n'
  },
  event = "output",
  seq = 29,
  type = "event"
}
[ DEBUG ] 2024-04-16T20:46:11Z+0200 ] ...ilak/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:957 ] 2   {
  body = {
    category = "stderr",
    output = '-> ~"Copyright (C) 2023 Free Software Foundation, Inc.\\n"\n'
  },
  event = "output",
  seq = 30,
  type = "event"
}
[ DEBUG ] 2024-04-16T20:46:11Z+0200 ] ...ilak/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:957 ] 2   {
  body = {
    category = "stderr",
    output = '-> ~"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."\n'
  },
  event = "output",
  seq = 31,
  type = "event"
}
[ DEBUG ] 2024-04-16T20:46:11Z+0200 ] ...ilak/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:957 ] 2   {
  body = {
    category = "stderr",
    output = '-> ~"\\nType \\"show copying\\" and \\"show warranty\\" for details.\\n"\n'
  },
  event = "output",
  seq = 32,
  type = "event"
}
[ DEBUG ] 2024-04-16T20:46:11Z+0200 ] ...ilak/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:957 ] 2   {
  body = {
    category = "stderr",
    output = '-> ~"This GDB was configured as \\"--host=aarch64-apple-darwin20.6.0 --target=arm-none-eabi\\".\\n"\n'
  },
  event = "output",
  seq = 33,
  type = "event"
}
[ DEBUG ] 2024-04-16T20:46:11Z+0200 ] ...ilak/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:957 ] 2   {
  body = {
    category = "stderr",
    output = '-> ~"Type \\"show configuration\\" for configuration details.\\n"\n'
  },
  event = "output",
  seq = 34,
  type = "event"
}
[ DEBUG ] 2024-04-16T20:46:11Z+0200 ] ...ilak/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:957 ] 2   {
  body = {
    category = "stderr",
    output = '-> ~"For bug reporting instructions, please see:\\n"\n'
  },
  event = "output",
  seq = 35,
  type = "event"
}
[ DEBUG ] 2024-04-16T20:46:11Z+0200 ] ...ilak/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:957 ] 2   {
  body = {
    category = "stderr",
    output = '-> ~"<https://bugs.linaro.org/>.\\n"\n'
  },
  event = "output",
  seq = 36,
  type = "event"
}
[ DEBUG ] 2024-04-16T20:46:11Z+0200 ] ...ilak/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:957 ] 2   {
  body = {
    category = "stderr",
    output = '-> ~"Find the GDB manual and other documentation resources online at:\\n    <"\n'
  },
  event = "output",
  seq = 37,
  type = "event"
}
[ DEBUG ] 2024-04-16T20:46:11Z+0200 ] ...ilak/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:957 ] 2   {
  body = {
    category = "stderr",
    output = '-> ~"http://www.gnu.org/software/gdb/documentation/>.\\n\\n"\n'
  },
  event = "output",
  seq = 38,
  type = "event"
}
[ DEBUG ] 2024-04-16T20:46:11Z+0200 ] ...ilak/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:957 ] 2   {
  body = {
    category = "stderr",
    output = '-> ~"For help, type \\"help\\".\\n"\n'
  },
  event = "output",
  seq = 39,
  type = "event"
}
[ DEBUG ] 2024-04-16T20:46:11Z+0200 ] ...ilak/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:957 ] 2   {
  body = {
    category = "stderr",
    output = '-> ~"Type \\"apropos word\\" to search for commands related to \\"word\\".\\n"\n'
  },
  event = "output",
  seq = 40,
  type = "event"
}
[ DEBUG ] 2024-04-16T20:46:11Z+0200 ] ...ilak/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:957 ] 2   {
  body = {
    category = "stderr",
    output = "-> 1^done\n"
  },
  event = "output",
  seq = 41,
  type = "event"
}
[ DEBUG ] 2024-04-16T20:46:11Z+0200 ] ...ilak/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:957 ] 2   {
  body = {
    category = "stderr",
    output = "2-gdb-set mi-async on\n"
  },
  event = "output",
  seq = 42,
  type = "event"
}
[ DEBUG ] 2024-04-16T20:46:11Z+0200 ] ...ilak/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:957 ] 2   {
  body = {
    category = "stderr",
    output = "-> 2^done\n"
  },
  event = "output",
  seq = 43,
  type = "event"
}
[ DEBUG ] 2024-04-16T20:46:11Z+0200 ] ...ilak/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:957 ] 2   {
  body = {
    category = "stderr",
    output = '3-interpreter-exec console "set print demangle on"\n'
  },
  event = "output",
  seq = 44,
  type = "event"
}
[ DEBUG ] 2024-04-16T20:46:11Z+0200 ] ...ilak/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:957 ] 2   {
  body = {
    category = "stderr",
    output = "-> 3^done\n"
  },
  event = "output",
  seq = 45,
  type = "event"
}
[ DEBUG ] 2024-04-16T20:46:11Z+0200 ] ...ilak/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:957 ] 2   {
  body = {
    category = "stderr",
    output = '4-interpreter-exec console "set print asm-demangle on"\n'
  },
  event = "output",
  seq = 46,
  type = "event"
}
[ DEBUG ] 2024-04-16T20:46:11Z+0200 ] ...ilak/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:957 ] 2   {
  body = {
    category = "stderr",
    output = '-> =cmd-param-changed,param="print asm-demangle",value="on"\n'
  },
  event = "output",
  seq = 47,
  type = "event"
}
[ DEBUG ] 2024-04-16T20:46:11Z+0200 ] ...ilak/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:957 ] 2   {
  body = {
    category = "stderr",
    output = "-> 4^done\n"
  },
  event = "output",
  seq = 48,
  type = "event"
}
[ DEBUG ] 2024-04-16T20:46:11Z+0200 ] ...ilak/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:957 ] 2   {
  body = {
    category = "stderr",
    output = "5-enable-pretty-printing\n"
  },
  event = "output",
  seq = 49,
  type = "event"
}
[ DEBUG ] 2024-04-16T20:46:11Z+0200 ] ...ilak/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:957 ] 2   {
  body = {
    category = "stderr",
    output = "-> 5^done\n"
  },
  event = "output",
  seq = 50,
  type = "event"
}
[ DEBUG ] 2024-04-16T20:46:11Z+0200 ] ...ilak/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:957 ] 2   {
  body = {
    category = "stderr",
    output = '6-interpreter-exec console "source /Users/iilak/.local/share/nvim/mason/share/cortex-debug/support/gdbsupport.init"\n'
  },
  event = "output",
  seq = 51,
  type = "event"
}
[ DEBUG ] 2024-04-16T20:46:11Z+0200 ] ...ilak/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:957 ] 2   {
  body = {
    category = "stderr",
    output = "-> 6^done\n"
  },
  event = "output",
  seq = 52,
  type = "event"
}
[ DEBUG ] 2024-04-16T20:46:11Z+0200 ] ...ilak/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:957 ] 2   {
  body = {
    category = "stderr",
    output = '7-interpreter-exec console "source /Users/iilak/.local/share/nvim/mason/share/cortex-debug/support/gdb-swo.init"\n'
  },
  event = "output",
  seq = 53,
  type = "event"
}
[ DEBUG ] 2024-04-16T20:46:11Z+0200 ] ...ilak/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:957 ] 2   {
  body = {
    category = "stderr",
    output = '-> =cmd-param-changed,param="language",value="c"\n'
  },
  event = "output",
  seq = 54,
  type = "event"
}
[ DEBUG ] 2024-04-16T20:46:11Z+0200 ] ...ilak/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:957 ] 2   {
  body = {
    category = "stderr",
    output = '-> =cmd-param-changed,param="language",value="auto"\n'
  },
  event = "output",
  seq = 55,
  type = "event"
}
[ DEBUG ] 2024-04-16T20:46:11Z+0200 ] ...ilak/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:957 ] 2   {
  body = {
    category = "stderr",
    output = "-> 7^done\n"
  },
  event = "output",
  seq = 56,
  type = "event"
}
[ DEBUG ] 2024-04-16T20:46:11Z+0200 ] ...ilak/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:957 ] 2   {
  body = {
    category = "stderr",
    output = '8-interpreter-exec console "set output-radix 0xa"\n'
  },
  event = "output",
  seq = 57,
  type = "event"
}
[ DEBUG ] 2024-04-16T20:46:11Z+0200 ] ...ilak/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:957 ] 2   {
  body = {
    category = "stderr",
    output = '-> ~"Output radix now set to decimal 10, hex a, octal 12.\\n"\n'
  },
  event = "output",
  seq = 58,
  type = "event"
}
[ DEBUG ] 2024-04-16T20:46:11Z+0200 ] ...ilak/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:957 ] 2   {
  body = {
    category = "console",
    output = "Output radix now set to decimal 10, hex a, octal 12.\n"
  },
  event = "output",
  seq = 59,
  type = "event"
}
[ DEBUG ] 2024-04-16T20:46:11Z+0200 ] ...ilak/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:957 ] 2   {
  body = {
    category = "stderr",
    output = "-> 8^done\n"
  },
  event = "output",
  seq = 60,
  type = "event"
}
[ DEBUG ] 2024-04-16T20:46:11Z+0200 ] ...ilak/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:957 ] 2   {
  body = {
    category = "stderr",
    output = '9-interpreter-exec console "set input-radix 0xa"\n'
  },
  event = "output",
  seq = 61,
  type = "event"
}
[ DEBUG ] 2024-04-16T20:46:11Z+0200 ] ...ilak/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:957 ] 2   {
  body = {
    category = "stderr",
    output = '-> ~"Input radix now set to decimal 10, hex a, octal 12.\\n"\n'
  },
  event = "output",
  seq = 62,
  type = "event"
}
[ DEBUG ] 2024-04-16T20:46:11Z+0200 ] ...ilak/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:957 ] 2   {
  body = {
    category = "console",
    output = "Input radix now set to decimal 10, hex a, octal 12.\n"
  },
  event = "output",
  seq = 63,
  type = "event"
}
[ DEBUG ] 2024-04-16T20:46:11Z+0200 ] ...ilak/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:957 ] 2   {
  body = {
    category = "stderr",
    output = "-> 9^done\n"
  },
  event = "output",
  seq = 64,
  type = "event"
}
[ DEBUG ] 2024-04-16T20:46:11Z+0200 ] ...ilak/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:957 ] 2   {
  body = {
    category = "stderr",
    output = '10-file-exec-and-symbols "/Users/iilak/prg/internal/cas_embedded_systems/exercises/02_kunz/exercises/build/CM7_firmware.elf"\n'
  },
  event = "output",
  seq = 65,
  type = "event"
}
[ DEBUG ] 2024-04-16T20:46:11Z+0200 ] ...ilak/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:957 ] 2   {
  body = {
    category = "stderr",
    output = "-> 10^done\n"
  },
  event = "output",
  seq = 66,
  type = "event"
}

And the terminal output is

Cortex-Debug: VSCode debugger extension version undefined git(652d042). Usage info: https://github.com/Marus/cortex-debug#usage"configuration": {
    "runToEntryPoint": "main",
    "targetProcessor": 0,
    "device": "STM32H755",
    "gdbServerConsolePort": 55878,
    "searchDir": [],
    "svdFile": "/Users/iilak/prg/internal/cas_embedded_systems/exercises/02_kunz/exercises/STM32H755_CM7.svd",
    "configFiles": [
        "interface/stlink.cfg",
        "target/stm32h7x.cfg"
    ],
    "showDevDebugOutput": "raw",
    "swoConfig": {
        "source": "probe",
        "enabled": false,
        "decoders": [],
        "swoFrequency": 0,
        "cpuFrequency": 0
    },
    "registerUseNaturalFormat": true,
    "extensionPath": "/Users/iilak/.local/share/nvim/mason/share/cortex-debug",
    "rttConfig": {
        "enabled": false,
        "decoders": []
    },
    "toolchainPrefix": "arm-none-eabi",
    "postRestartCommands": [],
    "preRestartCommands": [],
    "postAttachCommands": [],
    "preAttachCommands": [],
    "postLaunchCommands": [],
    "preLaunchCommands": [],
    "executable": "/Users/iilak/prg/internal/cas_embedded_systems/exercises/02_kunz/exercises/build/CM7_firmware.elf",
    "graphConfig": [],
    "cwd": "/Users/iilak/prg/internal/cas_embedded_systems/exercises/02_kunz/exercises",
    "variableUseNaturalFormat": true,
    "debuggerArgs": [],
    "request": "launch",
    "name": "Debug_CM7",
    "numberOfProcessors": 2,
    "servertype": "openocd",
    "type": "cortex-debug",
    "breakAfterReset": false,
    "pvtShowDevDebugOutput": "vscode"
}
Reading symbols from arm-none-eabi-objdump --syms -C -h -w /Users/iilak/prg/internal/cas_embedded_systems/exercises/02_kunz/exercises/build/CM7_firmware.elf
Reading symbols from arm-none-eabi-nm --defined-only -S -l -C -p /Users/iilak/prg/internal/cas_embedded_systems/exercises/02_kunz/exercises/build/CM7_firmware.elf
Launching GDB: arm-none-eabi-gdb -q --interpreter=mi2
1-gdb-version
From client: initialize({"adapterID":"nvim-dap","supportsRunInTerminalRequest":true,"linesStartAt1":true,"columnsStartAt1":true,"pathFormat":"path","clientName":"neovim","clientID":"neovim","supportsStartDebuggingRequest":true,"supportsProgressReporting":true,"supportsVariableType":true,"locale":"en_US.UTF-8"})
To client: {"seq":0,"type":"response","request_seq":1,"command":"initialize","success":true,"body":{"supportsHitConditionalBreakpoints":true,"supportsConfigurationDoneRequest":true,"supportsConditionalBreakpoints":true,"supportsLogPoints":true,"supportsFunctionBreakpoints":true,"supportsEvaluateForHovers":true,"supportsSetVariable":true,"supportsRestartRequest":true,"supportsGotoTargetsRequest":true,"supportSuspendDebuggee":true,"supportTerminateDebuggee":true,"supportsDataBreakpoints":true,"supportsDisassembleRequest":true,"supportsSteppingGranularity":true,"supportsInstructionBreakpoints":true,"supportsReadMemoryRequest":true,"supportsWriteMemoryRequest":true}}
From client: launch({"runToEntryPoint":"main","targetProcessor":0,"device":"STM32H755","gdbServerConsolePort":55878,"searchDir":[],"svdFile":"./STM32H755_CM7.svd","configFiles":["interface/stlink.cfg","target/stm32h7x.cfg"],"showDevDebugOutput":"vscode","swoConfig":{"source":"probe","enabled":false,"decoders":[],"swoFrequency":0,"cpuFrequency":0},"registerUseNaturalFormat":true,"extensionPath":"/Users/iilak/.local/share/nvim/mason/share/cortex-debug","rttConfig":{"enabled":false,"decoders":[]},"toolchainPrefix":"arm-none-eabi","postRestartCommands":[],"preRestartCommands":[],"postAttachCommands":[],"preAttachCommands":[],"postLaunchCommands":[],"preLaunchCommands":[],"executable":"./build/CM7_firmware.elf","graphConfig":[],"cwd":"/Users/iilak/prg/internal/cas_embedded_systems/exercises/02_kunz/exercises","variableUseNaturalFormat":true,"debuggerArgs":[],"request":"launch","name":"Debug_CM7","numberOfProcessors":2,"servertype":"openocd","type":"cortex-debug","breakAfterReset":false})
To client: {"seq":0,"type":"event","event":"output","body":{"category":"stdout","output":"Cortex-Debug: VSCode debugger extension version undefined git(652d042). Usage info: https://github.com/Marus/cortex-debug#usage"}}
To client: {"seq":0,"type":"event","event":"output","body":{"category":"stderr","output":"\"configuration\": {\n    \"runToEntryPoint\": \"main\",\n    \"targetProcessor\": 0,\n    \"device\": \"STM32H755\",\n    \"gdbServerConsolePort\": 55878,\n    \"searchDir\": [],\n    \"svdFile\": \"/Users/iilak/prg/internal/cas_embedded_systems/exercises/02_kunz/exercises/STM32H755_CM7.svd\",\n    \"configFiles\": [\n        \"interface/stlink.cfg\",\n        \"target/stm32h7x.cfg\"\n    ],\n    \"showDevDebugOutput\": \"raw\",\n    \"swoConfig\": {\n        \"source\": \"probe\",\n        \"enabled\": false,\n        \"decoders\": [],\n        \"swoFrequency\": 0,\n        \"cpuFrequency\": 0\n    },\n    \"registerUseNaturalFormat\": true,\n    \"extensionPath\": \"/Users/iilak/.local/share/nvim/mason/share/cortex-debug\",\n    \"rttConfig\": {\n        \"enabled\": false,\n        \"decoders\": []\n    },\n    \"toolchainPrefix\": \"arm-none-eabi\",\n    \"postRestartCommands\": [],\n    \"preRestartCommands\": [],\n    \"postAttachCommands\": [],\n    \"preAttachCommands\": [],\n    \"postLaunchCommands\": [],\n    \"preLaunchCommands\": [],\n    \"executable\": \"/Users/iilak/prg/internal/cas_embedded_systems/exercises/02_kunz/exercises/build/CM7_firmware.elf\",\n    \"graphConfig\": [],\n    \"cwd\": \"/Users/iilak/prg/internal/cas_embedded_systems/exercises/02_kunz/exercises\",\n    \"variableUseNaturalFormat\": true,\n    \"debuggerArgs\": [],\n    \"request\": \"launch\",\n   [...]
To client: {"seq":0,"type":"event","event":"output","body":{"category":"stderr","output":"Reading symbols from arm-none-eabi-objdump --syms -C -h -w /Users/iilak/prg/internal/cas_embedded_systems/exercises/02_kunz/exercises/build/CM7_firmware.elf\n"}}
To client: {"seq":0,"type":"event","event":"output","body":{"category":"stderr","output":"Reading symbols from arm-none-eabi-nm --defined-only -S -l -C -p /Users/iilak/prg/internal/cas_embedded_systems/exercises/02_kunz/exercises/build/CM7_firmware.elf\n"}}
To client: {"seq":0,"type":"event","event":"output","body":{"category":"stderr","output":"Launching GDB: arm-none-eabi-gdb -q --interpreter=mi2\n"}}
To client: {"seq":0,"type":"event","event":"output","body":{"category":"stderr","output":"1-gdb-version\n"}}
To client: {"seq":0,"type":"event","event":"custom-event-ports-allocated","body":{"info":[50000,50001,50002,50003,50004,50005,50006,50007]}}
To client: {"seq":0,"type":"event","event":"custom-event-ports-done","body":{}}
Launching gdb-server: openocd -c "gdb_port 50000" -c "tcl_port 50002" -c "telnet_port 50004" -s /Users/iilak/prg/internal/cas_embedded_systems/exercises/02_kunz/exercises -f /Users/iilak/.local/share/nvim/mason/share/cortex-debug/support/openocd-helpers.tcl -f interface/stlink.cfg -f target/stm32h7x.cfg
    Please check TERMINAL tab (gdb-server) for output from openocd
Finished reading symbols from objdump: Time: 31 ms
OpenOCD: GDB Server Quit Unexpectedly. See gdb-server output in TERMINAL tab for more details.To client: {"seq":0,"type":"response","request_seq":2,"command":"launch","success":false,"message":"OpenOCD: GDB Server Quit Unexpectedly. See gdb-server output in TERMINAL tab for more details.","body":{"error":{"id":103,"format":"OpenOCD: GDB Server Quit Unexpectedly. See gdb-server output in TERMINAL tab for more details.","showUser":true}}}
Finished reading symbols from nm: Time: 42 ms
-> =thread-group-added,id="i1"
-> ~"GNU gdb (Arm GNU Toolchain 13.2.rel1 (Build arm-13.7)) 13.2.90.20231008-git\n"
-> ~"Copyright (C) 2023 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=aarch64-apple-darwin20.6.0 --target=arm-none-eabi\".\n"
-> ~"Type \"show configuration\" for configuration details.\n"
-> ~"For bug reporting instructions, please see:\n"
-> ~"<https://bugs.linaro.org/>.\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-gdb-set mi-async on
-> 2^done
3-interpreter-exec console "set print demangle on"
-> 3^done
4-interpreter-exec console "set print asm-demangle on"
-> =cmd-param-changed,param="print asm-demangle",value="on"
-> 4^done
5-enable-pretty-printing
-> 5^done
6-interpreter-exec console "source /Users/iilak/.local/share/nvim/mason/share/cortex-debug/support/gdbsupport.init"
-> 6^done
7-interpreter-exec console "source /Users/iilak/.local/share/nvim/mason/share/cortex-debug/support/gdb-swo.init"
-> =cmd-param-changed,param="language",value="c"
-> =cmd-param-changed,param="language",value="auto"
-> 7^done
8-interpreter-exec console "set output-radix 0xa"
-> ~"Output radix now set to decimal 10, hex a, octal 12.\n"
Output radix now set to decimal 10, hex a, octal 12.
-> 8^done
9-interpreter-exec console "set input-radix 0xa"
-> ~"Input radix now set to decimal 10, hex a, octal 12.\n"
Input radix now set to decimal 10, hex a, octal 12.
-> 9^done
10-file-exec-and-symbols "/Users/iilak/prg/internal/cas_embedded_systems/exercises/02_kunz/exercises/build/CM7_firmware.elf"
-> 10^done

Any ideas what is going on?

Edit: I just also tried you other branch without the cwd line in the launch.json. It did not work for me. The error here was

Error on launch: Unable to find executable file at ${workspaceFolder}/build/CM7_firmware.elf.

If you need a more detailed log for this error, let me know!

oyvindaakre commented 5 months ago

Thanks for the extension :)

I'm also facing the same error message as in the previous post Error on launch: Unable to find executable file at ${workspaceFolder}/...

I get this error on both master (bff05f173f17d22c2920335e5fa8ea1f957f7eaf) and https://github.com/jedrzejboczar/nvim-dap-cortex-debug/tree/jb/default-cwd.

Is there a nice way to print the value of $workspaceRoot to better understand where the plugin is looking for the elf-file?

Please let me know if you need more information from me :)

My .vscode/launch.json

{
            "cwd": "${workspaceRoot}",
            "executable": "./build/main.elf",
            "name": "Debug optimized",
            "request": "launch",
            "type": "cortex-debug",
            "servertype": "jlink",
            "device": "STM32L462VE",
            "runToEntryPoint": "main",
            "preLaunchTask": "build-debug"
        },

My lua-configuration looks like this (Marus/cortex-debug installed with Mason):

    -- DAP configuration
    {
        "mfussenegger/nvim-dap", -- DAP client

        dependencies = {
            -- Creates a beautiful debugger UI
            -- 'rcarriga/nvim-dap-ui',

            -- Required dependency for nvim-dap-ui
            -- 'nvim-neotest/nvim-nio',

            -- Installs the debug adapters for you
            "williamboman/mason.nvim",
            "jay-babu/mason-nvim-dap.nvim",

            -- Add your own debuggers here
            "jedrzejboczar/nvim-dap-cortex-debug", -- An extension for nvim-dap providing integration with Marus/cortex-debug debug adapter.
        },
        config = function()
            local dap = require("dap")
            dap.set_log_level("DEBUG")
            -- Set up and register with nvim-dap
            require("dap-cortex-debug").setup({
                debug = true, -- log debug messages
                -- path to cortex-debug extension, supports vim.fn.glob
                -- by default tries to guess: mason.nvim or VSCode extensions
                extension_path = nil,
                lib_extension = nil, -- shared libraries extension, tries auto-detecting, e.g. 'so' on unix
                node_path = "node", -- path to node.js executable
                dapui_rtt = true, -- register nvim-dap-ui RTT element
                -- make :DapLoadLaunchJSON register cortex-debug for C/C++, set false to disable
                dap_vscode_filetypes = { "c", "cpp" },
            })
            require("dap.ext.vscode").load_launchjs()

            -- Debugger keymap
            vim.keymap.set("n", "<F5>", dap.continue, { desc = "Debug: Start/Continue" })
            vim.keymap.set("n", "<F1>", dap.step_into, { desc = "Debug: Step Into" })
            vim.keymap.set("n", "<F2>", dap.step_over, { desc = "Debug: Step Over" })
            vim.keymap.set("n", "<F3>", dap.step_out, { desc = "Debug: Step Out" })
            vim.keymap.set("n", "<leader>b", dap.toggle_breakpoint, { desc = "Debug: Toggle Breakpoint" })
            vim.keymap.set("n", "<leader>B", function()
                dap.set_breakpoint(vim.fn.input("Breakpoint condition: "))
            end, { desc = "Debug: Set Breakpoint" })
        end,
    },
jedrzejboczar commented 5 months ago

Sorry for terrible responsiveness, but I haven't had much time recently.

@i-ilak As for your first test - what is the issue? Doesn't debug session start? Because it seems to have resolved your cwd, and I don't see errors in the log file.

@oyvindaakre Regarding the workspaceFolder problem - I force-pushed a fix to branch https://github.com/jedrzejboczar/nvim-dap-cortex-debug/tree/jb/default-cwd. It looks like the expansion of things like ${workspaceFolder} is done by nvim-dap before calling nvim-dap-cortex-debug adapter, so I am using vim.fn.getcwd() directly.

As far as I know there is no such a thing as workspaceRoot. These variables are expanded by VSCode and nvim-dap mimics this behaviour. You can see available variables here: https://github.com/jedrzejboczar/nvim-dap/blob/master/lua/dap.lua#L203, so change your config to use workspaceFolder and it should work.

oyvindaakre commented 5 months ago

@jedrzejboczar thanks for the quick reply! You're absolutely right, if I update my launch configs to use workspaceFolder then it works out of the box :D My launch configs are from ~2018 and I only found out right now that workspaceRoot was being deprecated around that time :laughing: The proper solution for me is to update the launch config in our projects, but In the mean time I added this ugly lua hack to replace ${workspaceRoot} with vim.fn.getcwd()

require("dap.ext.vscode").json_decode = require("json5").parse
require("dap.ext.vscode").load_launchjs() -- load .vsocde/launch.json

local c_table = dap.configurations.c
if c_table ~= nil then
    for _, v in pairs(c_table) do
        v["cwd"] = vim.fn.getcwd() -- replaces ${workspaceRoot} with cwd
    end

    dap.configurations.c = c_table -- write back configuration to dap
end