code-debug icon indicating copy to clipboard operation
code-debug copied to clipboard

Running launch task does nothing for a couple of seconds and then stops without any error log

Open ASL07 opened this issue 6 years ago • 5 comments

Hi I'm trying to debug a ESP32 app. I can connect to the GDB server using command line but it seems that I'm doing something wrong in VSCode and I can't find out what. Tried both launch and attach requests. My GDB server is running on port 3333. When I click launch, I can see the pause/stop buttons, and after a couple of seconds the process finishes. The GDB server does not show any connection logs and VSCode does not display any logs either. I verified all the paths are ok

Please could you help me to troubleshoot this. Thanks!

{
    "version": "0.2.0",
    "configurations": [
      {
        "type": "gdb",
        "request": "attach",
        "name": "Attach to gdbserver",
        "executable": "./build/ble_ibeacon_demo.elf",
        "target": ":3333",
        "remote": true,
        "gdbpath": "/Users/developer/esp/xtensa-esp32-elf-gdb",
        "cwd": "${workspaceRoot}",
        "valuesFormatting": "parseText",
        "autorun": [
          "mon reset halt",
          "flushregs",
          "thb app_main",
          "c"
        ],
      },
      {
        "type": "gdb",
        "request": "launch",
        "name": "Launch Program",
        "target": "./build/ble_ibeacon_demo.elf",
        "cwd": "${workspaceFolder}",
        "gdbpath": "/Users/developer/esp/xtensa-esp32-elf-gdb",
        "autorun": [
          "target remote :3333",
          "mon reset halt",
          "flushregs",
          "thb app_main",
          "c"
        ],
        "preLaunchTask": "openocd-start"
      }
    ]
  }

ASL07 avatar May 27 '19 08:05 ASL07

try setting

"printCalls": true,
"showDevDebugOutput": true

in your debug configuration for it to show logs of what it's doing

WebFreak001 avatar May 27 '19 11:05 WebFreak001

@WebFreak001 , I have the same issue trying to debug a Crystal project.

launch.json:

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Debug",
            "type": "lldb-mi",
            "request": "launch",
            "target": "./bin/${workspaceFolderBasename}",
            "cwd": "${workspaceRoot}",
            "preLaunchTask": "Compile",
            "printCalls": true,
            "showDevDebugOutput": true
        }
    ]
}

tasks.json:

{
    "version": "2.0.0",
    "tasks": [
        {
            "label": "Compile",
            "command": "shards build --debug ${workspaceFolderBasename}",
            "type": "shell"
        }
    ]
}

The debug console output is:

GDB -> App: {"outOfBandRecord":[{"isStream":false,"type":"notify","asyncClass":"library-loaded","output":[["id","/Users/abranzeanu/dev/crystal/tx/bin/tx"],["target-name","/Users/abranzeanu/dev/crystal/tx/bin/tx"],["host-name","/Users/abranzeanu/dev/crystal/tx/bin/tx"],["symbols-loaded","0"],["loaded_addr","-"],["size","2314240"]]}]}
Running executable
4-exec-run
GDB -> App: {"token":3,"outOfBandRecord":[],"resultRecords":{"resultClass":"done","results":[["bkpt",[["number","1"],["type","breakpoint"],["disp","keep"],["enabled","y"],["addr","0xffffffffffffffff"],["func","??"],["file","??"],["fullname","??/??"],["line","0"],["pending",null]]]]}}
GDB -> App: {"outOfBandRecord":[{"isStream":false,"type":"notify","asyncClass":"breakpoint-modified","output":[["bkpt",[["number","1"],["type","breakpoint"],["disp","keep"],["enabled","y"],["addr","0xffffffffffffffff"],["func","??"],["file","??"],["fullname","??/??"],["line","0"],["pending",null]]]]}]}
5-thread-info
GDB -> App: {"token":4,"outOfBandRecord":[],"resultRecords":{"resultClass":"error","results":[["msg","process exited with status -1 (Error 1)"]]}}
GDB -> App: {"token":5,"outOfBandRecord":[],"resultRecords":{"resultClass":"done","results":[["threads","[]"]]}}

texpert avatar Oct 21 '19 16:10 texpert

with that error output I would just assume you are compiling without debug information. Also I think you might need to give your task a proper id/name, I don't know if the label key is enough to define it.

Please try it out in the command line if it even works there with lldb-mi

WebFreak001 avatar Oct 21 '19 19:10 WebFreak001

The vscode tasks have no such property as id or name.

Also, CodeLLDB is working from the start with the minimal debug configuration.

texpert avatar Oct 22 '19 09:10 texpert

Works with GDB (gdb 8.3 on High Sierra)!

texpert avatar Oct 23 '19 13:10 texpert