Process Visual Studio代码,调试子进程不工作

Process Visual Studio代码,调试子进程不工作,process,gdb,visual-studio-code,fork,Process,Gdb,Visual Studio Code,Fork,我有一个确切的问题: 但那里的解决方案并不奏效 我尝试过同样的简单示例代码 #include <stdio.h> #include <sys/types.h> #include <unistd.h> int main() { pid_t pid = fork(); if (pid != 0) { printf("Main process\n"); } else { printf("Forked pro

我有一个确切的问题:

但那里的解决方案并不奏效

我尝试过同样的简单示例代码

#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>

int main()
{
    pid_t pid = fork();
    if (pid != 0) {
        printf("Main process\n");
    } else {
        printf("Forked process\n");
    }

    return 0;
}

我遇到了同样的问题,我解决了这个问题:


 "setupCommands": [
                    {
                        "description": "Enable funcy printing to gdb",
                        "text": "-enable-pretty-printing",
                        "ignoreFailures": true
                    },
                    {   "description":"In this mode GDB will be attached to both processes after a call to fork() or vfork().",
                        "text": "-gdb-set detach-on-fork off",
                        "ignoreFailures": true
                    },
                    {   "description": "The new process is debugged after a fork. The parent process runs unimpeded.",
                        "text": "-gdb-set follow-fork-mode child",
                        "ignoreFailures": true
                    }
                ],


 "setupCommands": [
                    {
                        "description": "Enable funcy printing to gdb",
                        "text": "-enable-pretty-printing",
                        "ignoreFailures": true
                    },
                    {   "description":"In this mode GDB will be attached to both processes after a call to fork() or vfork().",
                        "text": "-gdb-set detach-on-fork off",
                        "ignoreFailures": true
                    },
                    {   "description": "The new process is debugged after a fork. The parent process runs unimpeded.",
                        "text": "-gdb-set follow-fork-mode child",
                        "ignoreFailures": true
                    }
                ],