debugging 如何启动和调试从管道读取程序?

thigvfpy  于 2022-11-14  发布在  其他
关注(0)|答案(1)|浏览(127)

我需要调试我的程序callfilter,当它在Visual Studio中像这样启动时代码:

zcat file.gz | build/callfilter/callfilter -M 10

这在vscode中可行吗?下面是它的当前启动配置,它可以在没有任何管道输入的情况下启动它:

"configurations": [
        {
            "name": "(gdb) callfilter",
            "type": "cppdbg",
            "request": "launch",
            "program": "${workspaceFolder}/build/callfilter/callfilter",
            "args": ["-M", "10"],
            "stopAtEntry": true,
            "cwd": "${workspaceFolder}",
            "environment": [],
            
            "externalConsole": false,
            "MIMode": "gdb",
            "setupCommands": [
                {
                    "description": "Enable pretty-printing for gdb",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                }
            ]
        },
mqkwyuun

mqkwyuun1#

它的工作原理是填充args以从管道中读取:"args": ["<", "in.txt"]
更多信息,请访问:https://code.visualstudio.com/docs/editor/debugging#_redirect-inputoutput-tofrom-the-debug-target

相关问题