我正在尝试在 Mint VM 上使用 Visual Studio 代码调试 C,代码如下:
#include <stdio.h>
int main(int numargs, char* argvector[])
{
printf("test\n");
return(0);
}
编译为:
gcc test.c -g -o test
根据 ls -l 的输出,我可以验证 gcc 正在添加符号。
当我尝试使用 C/C++ 扩展使用 vs-code 调试该程序时,收到以下错误:
Warning: Debuggee TargetArchitecture not detected, assuming x86_64.
=cmd-param-changed,param="pagination",value="off"
Stopped due to shared library event (no libraries added or removed)
Loaded '/lib64/ld-linux-x86-64.so.2'. Symbols loaded.
Breakpoint 1, main (numargs=1, argvector=0x7fffffffdd18) at test.c:5
5 printf("test\n");
[Inferior 1 (process 8322) exited normally]
The program '/home/ccsd/test/test' has exited with code 0 (0x00000000).
海湾合作委员会版本:5.4.0 20160609
vs-c 版本:1.24.1
我的launch.json文件如下:
{
"version": "0.2.0",
"configurations": [
{
"name": "(gdb) Launch",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/grow",
"processName": "grow",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": true,
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
}
]
}
您可能会注意到,这不是重复的由于共享库事件而停止 - Visual Studio Code https://stackoverflow.com/questions/48071176/stopped-due-to-shared-library-event-visual-studio-code因为我已经在使用 -g 开关。
我想知道如何解决这个问题。先感谢您。