4

I am writing a program (c/c++) that sits between some hardware and another set of software. I have written a little program that "emulates" the hardware (a radio, CSP), and that emulates the other set of software (a TCP/IP socket, CDH). I want to be able to debug all 3 at the same time. However, the issue I run into is that, when defining a pre-launch task for the compound configuration, it doesn't actually take. Is there a way to trigger that to happen, or should I just run the build in the standalone configs?

My build system is 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"]
        }
    ],
}
Shaken_U
  • 164
  • 13

0 Answers0