我正在尝试在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代码调试该程序时,收到以下错误:
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).
gcc版本: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
}
]
}
]
}
您可能会注意到这不是Stopped due to shared library event - Visual Studio Code的副本,因为我已经在使用-g开关了。
我想知道如何解决此问题。预先谢谢你。
答案 0 :(得分:0)
假设使用"additionalSOLibSearchPath"
的{{1}}选项无济于事,以下设置可能会将共享库添加到launch.json
的考虑之内:>
gdb
PS:尽管如此,"setupCommands":[
{
"description": "Additional libs for gdb",
"text": "set solib-search-path sharedLibraryPath/lib"
}
]
仍可能会发出gdb
警告。