Skip to content

Running gdbserver as a preLaunchTask - need to press start/stop button several times #898

@nikitablack

Description

@nikitablack
  • VSCode Version: Code 1.14.0 (b8cd5b9556d8b70ea560d35b903422363f6c5c40, 2017-07-10T20:36:40.018Z)
  • OS Version: Linux x64 4.4.0-53-generic
  • Extensions:
Extension Author (truncated) Version
vscode-docker Pet 0.0.16
tslint eg2 0.16.0
language-haskell jus 2.3.1
cpptools ms- 0.12.1
debugger-for-chrome msj 3.1.6
cmake twx 0.0.17
cmake-tools vec 0.10.2
debug web 0.20.0
c-cpp-snippets wlh 0.1.0

Hello. Thank you for the great tool - I'm using vscode/cpptools everyday and happy with it.

Now to the problem. I have the following task in tasks.json:

{
    "taskName": "docker build&run",
    "linux": {
        "args": [
            "\"docker run --rm --privileged -p 2222:2222 -v ~/path/:/path/ -w /path/build cpp_tools bash -c 'cmake --build . && gdbserver localhost:2222 ./app'\""
        ]
    },
    "group": {
        "kind": "build",
        "isDefault": true
    }
}

As you can see, it starts a docker container that builds an executable and runs gdbserver inside.

Here's my launch.json:

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "(gdb) remote",
            "type": "cppdbg",
            "request": "launch",
            "preLaunchTask": "docker build&run",
            "program": "${workspaceRoot}/build/app",
            "args": [],
            "stopAtEntry": false,
            "cwd": "${workspaceRoot}/build",
            "environment": [],
            "externalConsole": true,
            "MIMode": "gdb",
            "miDebuggerServerAddress": "localhost:2222",
            "sourceFileMap": {
                "/path/": "~/path/"
            },
            "setupCommands": [
                {
                    "description": "Enable pretty-printing for gdb",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                }
            ]
        }
    ]
}

I want to build an app and start the debug session with F5 button. The problem is that I need to press F5 twice - the first press builds an app and starts the debug server in docker container and the second press launches my application (which successfully connects). The problem appears both for F5 and Start Debugging button in GUI.
Also I have to press stop button 3 (three) times in order to stop an application (both for Shift+F5 and the Stop button in GUI).

Metadata

Metadata

Assignees

No one assigned

    Labels

    debuggermore info neededThe issue report is not actionable in its current state

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions