VSCode C ++ - 复合调试配置预启动任务(c ++)

时间:2018-02-13 01:01:11

标签: c++ json debugging visual-studio-code waf

我正在编写一个位于某些硬件和另一组软件之间的程序(c / c ++)。我编写了一个小程序,“模拟”硬件(无线电,CSP),并模拟另一组软件(TCP / IP套接字,CDH)。我希望能够同时调试所有3个。但是,我遇到的问题是,在为复合配置定义预启动任务时,它实际上并不需要。有没有办法触发这种情况,或者我应该在独立配置中运行构建?

我的构建系统是waf

tasks.json

{
    // See https://go.microsoft.com/fwlink/?LinkId=733558
    // for the documentation about the tasks.json format
    "version": "2.0.0",
    "tasks": [
        {
            "label": "waf-build",
            "type": "shell",
            "command": "./waf build",
            "group": {
                "kind": "build",
                "isDefault": true
            }
        }
    ]
}

launch.json:

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "CSP Loopback Test",
            "type": "cppdbg",
            "request": "launch",
            "program": "${workspaceFolder}/build/tests/csp_loop_test",
            "args": [],
            "stopAtEntry": false,
            "cwd": "${workspaceFolder}",
            "environment": [],
            "externalConsole": true,
            "MIMode": "gdb",
            "setupCommands": [
                {
                    "description": "Enable pretty-printing for gdb",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                }
            ]
        },
        {

            "name": "CSP Loopback Test (Build)",
            "type": "cppdbg",
            "request": "launch",
            "program": "${workspaceFolder}/build/tests/csp_loop_test",
            "args": [],
            "stopAtEntry": false,
            "cwd": "${workspaceFolder}",
            "environment": [],
            "externalConsole": true,
            "preLaunchTask": "waf-build",
            "MIMode": "gdb",
            "setupCommands": [
                {
                    "description": "Enable pretty-printing for gdb",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                }
            ]
        },
        {
            "name": "CDH Loopback Test",
            "type": "cppdbg",
            "request": "launch",
            "program": "${workspaceFolder}/build/tests/cdh_loop_test",
            "args": [],
            "stopAtEntry": false,
            "cwd": "${workspaceFolder}",
            "environment": [],
            "externalConsole": true,
            "MIMode": "gdb",
            "setupCommands": [
                {
                    "description": "Enable pretty-printing for gdb",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                }
            ]
        },
        {
            "name": "CDH Loopback Test (Build)",
            "type": "cppdbg",
            "request": "launch",
            "program": "${workspaceFolder}/build/tests/cdh_loop_test",
            "args": [],
            "stopAtEntry": false,
            "cwd": "${workspaceFolder}",
            "environment": [],
            "externalConsole": true,
            "preLaunchTask": "waf-build",
            "MIMode": "gdb",
            "setupCommands": [
                {
                    "description": "Enable pretty-printing for gdb",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                }
            ]
        },
        {
            "name": "CSP<->CDH Only No Args",
            "type": "cppdbg",
            "request": "launch",
            "program": "${workspaceFolder}/build/main",
            "args": [],
            "stopAtEntry": false,
            "cwd": "${workspaceFolder}",
            "environment": [],
            "externalConsole": true,
            "MIMode": "gdb",
            "setupCommands": [
                {
                    "description": "Enable pretty-printing for gdb",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                }
            ]
        },
        {
            "name": "CSP<->CDH Only No Args (Build)",
            "type": "cppdbg",
            "request": "launch",
            "program": "${workspaceFolder}/build/main",
            "args": [],
            "stopAtEntry": false,
            "cwd": "${workspaceFolder}",
            "environment": [],
            "externalConsole": true,
            "preLaunchTask": "waf-build",
            "MIMode": "gdb",
            "setupCommands": [
                {
                    "description": "Enable pretty-printing for gdb",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                }
            ]
        },
        {
            "name": "CSP<->CDH Only, localhost, /dev/ttyUSB0 (Build)",
            "type": "cppdbg",
            "request": "launch",
            "program": "${workspaceFolder}/build/main",
            "args": ["localhost", "/dev/ttyS0"],
            "stopAtEntry": false,
            "cwd": "${workspaceFolder}",
            "environment": [],
            "externalConsole": true,
            "preLaunchTask": "waf-build",
            "MIMode": "gdb",
            "setupCommands": [
                {
                    "description": "Enable pretty-printing for gdb",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                }
            ]
        }
    ],
    "compounds": [
        {
            "name": "Full Test",

            "preLaunchTask" : "waf-build",
            "configurations": ["CDH Loopback Test", "CSP Loopback Test", "CSP<->CDH Only No Args"]
        }
    ],
}

0 个答案:

没有答案