microsoft / microsoft/vscode-cpptools

Debug attach session never starts (endless waiting/loading)

Open
#12,120 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug debugger help wanted
Dominant language
TypeScript
Stars
6.2k
Forks
1.7k
Avg merge
14h 46m
Merged PRs (30d)
61

Description

Environment
  • OS and version: Ubuntu 22.04
  • VS Code: 1.87.2
  • C/C++ extension: 1.19.8
  • OS and version of remote machine (if applicable):
  • GDB / LLDB version: 12.2 (tested with 14.1 also)
Bug Summary and Steps to Reproduce

Bug Summary:

For different kind of C++ projects in my company (complex or not) the attach debug session never starts nor attaches to the target PID at first time. The solution is always to kill the OpenDAP PID and launch again the attach debug config.

Sometimes it says waiting for connection but others it just show the attach configu in the Debug console and nothing more.

Steps to reproduce:

  1. Create launch.json with these configs.
  2. Execute config.
Debugger Configurations
 {
      "name": "whatever Attach sim.bin",
      "type": "cppdbg",
      "request": "attach",
      "program": "${workspaceFolder}/build/sim/default_rig/sim/sim.bin",
      "processId": "${input:findPidSimulatorsim.bin}",
      "MIMode": "gdb",
      "logging": {
        "trace": true,
        "engineLogging": true,
        "traceResponse": true,
      },
      "additionalSOLibSearchPath": "/opt/lib/:${input:whateverSysPath}/sysroots/x86-whatever-linux/usr/lib/:/lib/i386-linux-gnu:${input:whateverBuild}/Debug/platform/osal:${workspaceFolder}/build/whatever-x86/Debug/platform/osal_modules",
      "setupCommands": [
        {
          "description": "Enable pretty-printing for gdb",
          "text": "-enable-pretty-printing",
          "ignoreFailures": false
        },
        {
          "description": "ignore SIGUSR1 signal",
          "text": "handle SIGUSR1 nostop noprint pass",
          "ignoreFailures": false
        },
        {
          "description": "disable non stop mode",
          "text": "-gdb-set non-stop 0",
          "ignoreFailures": false
        },
        {
          "description": "set async",
          "text": "-gdb-set mi-async 1",
          "ignoreFailures": false
        },
        {
          "description": "set sysroot",
          "text": "-gdb-set sysroot ${input:whateverSysPath}/sysroots/x86-whatever-linux/",
          "ignoreFailures": false
        },
        {
          "text": "set auto-load safe-path /",
          "ignoreFailures": false
        },
        {
          "text": "set print object on",
          "ignoreFailures": false
        },
        {
          "text": "set print vtbl on",
          "ignoreFailures": false
        }
      ]
    },
 "inputs": [
    {
      "id": "whateverBuild",
      "type": "command",
      "command": "shellCommand.execute",
      "args": {
        "command": "ls ${workspaceFolder}/build/whatever*",
        "useSingleResult": true
      }
    },
    {
      "id": "whateverSysPath",
      "type": "command",
      "command": "shellCommand.execute",
      "args": {
        "command": "ls -d -1 /opt/sdks/*/*",
        "useSingleResult": true
      }
    },
    {
      "id": "findPidSimulatoriosim.bin",
      "type": "command",
      "command": "shellCommand.execute",
      "args": {
        "command": "pgrep -f 'sim.bin' | grep -v $$",
        "useSingleResult": true
      }
    },
Debugger Logs
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (128) LaunchOptions{\"name\":\"whatever_project Attach sim.bin\",\"type\":\"cppdbg\",\"request\":\"attach\",\"program\":\"/home/borjamf/workspace/whatever_project/build/sim/default_rig/sim/sim.bin\",\"processId\":\"13706\",\"MIMode\":\"gdb\",\"logging\":{\"trace\":true,\"engineLogging\":true,\"traceResponse\":true},\"additionalSOLibSearchPath\":\"/opt/lib/:/opt/sdks/whatever-sdk/x86_4/sysroots/x86-whatever-linux/usr/lib/:/lib/i386-linux-gnu:Debug/Debug/platform/osal:/home/borjamf/workspace/whatever_project/build/whatever-sdk_x86_4/Debug/platform/osal_modules\",\"setupCommands\":[{\"description\":\"Enable pretty-printing for gdb\",\"text\":\"-enable-pretty-printing\",\"ignoreFailures\":false},{\"description\":\"ignore SIGUSR1 signal\",\"text\":\"handle SIGUSR1 nostop noprint pass\",\"ignoreFailures\":false},{\"description\":\"disable non stop mode\",\"text\":\"-gdb-set non-stop 0\",\"ignoreFailures\":false},{\"description\":\"set async\",\"text\":\"-gdb-set mi-async 1\",\"ignoreFailures\":false},{\"description\":\"set sysroot\",\"text\":\"-gdb-set sysroot /opt/sdks/whatever-sdk/x86_4/sysroots/x86-whatever-linux/\",\"ignoreFailures\":false},{\"text\":\"set auto-load safe-path /\",\"ignoreFailures\":false},{\"text\":\"set print object on\",\"ignoreFailures\":false},{\"text\":\"set print vtbl on\",\"ignoreFailures\":false}],\"__configurationTarget\":6,\"__sessionId\":\"db4b7f4d-10cd-4703-9a6f-2b0a7fef4054\"}\n"},"seq":2}
1: (128) LaunchOptions{"name":"whatever_project Attach Docker iosim.bin","type":"cppdbg","request":"attach","program":"/home/borjamf/workspace/whatever_project/build/sim/default_rig/sim/sim.bin","processId":"13706","MIMode":"gdb","logging":{"trace":true,"engineLogging":true,"traceResponse":true},"additionalSOLibSearchPath":"/opt/lib/:/opt/sdks/whatever-sdk/x86_4/sysroots/x86-whatever-linux/usr/lib/:/lib/i386-linux-gnu:Debug/Debug/platform/osal:/home/borjamf/workspace/whatever_project/build/whatever-sdk_x86_4/Debug/platform/osal_modules","setupCommands":[{"description":"Enable pretty-printing for gdb","text":"-enable-pretty-printing","ignoreFailures":false},{"description":"ignore SIGUSR1 signal","text":"handle SIGUSR1 nostop noprint pass","ignoreFailures":false},{"description":"disable non stop mode","text":"-gdb-set non-stop 0","ignoreFailures":false},{"description":"set async","text":"-gdb-set mi-async 1","ignoreFailures":false},{"description":"set sysroot","text":"-gdb-set sysroot /opt/sdks/whatever-sdk/x86_4/sysroots/x86-whatever-linux/","ignoreFailures":false},{"text":"set auto-load safe-path /","ignoreFailures":false},{"text":"set print object on","ignoreFailures":false},{"text":"set print vtbl on","ignoreFailures":false}],"__configurationTarget":6,"__sessionId":"db4b7f4d-10cd-4703-9a6f-2b0a7fef4054"}
Other Extensions

No response

Additional Information

top output process, resource usage

imagen

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the attach configuration from launch.json on Ubuntu with GDB, then inspect the debugger logs around the waiting state and the OpenDAP process. Done means the first attach attempt starts and attaches to the target PID without killing the OpenDAP process and launching again.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, typescript, vscode
Domain
devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.