本文介绍了Visual Studio Code 忽略调试符号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

我正在尝试在 Mint VM 上使用 Visual Studio 代码调试 C,代码如下:

I'm trying to debug C using visual studio code on a Mint VM, code is as follows:

#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 调试这个程序时,我收到以下错误:

based on the output of ls -l, I can verify that gcc is adding symbols.When I attempt to debug this program using vs-code using the C/C++ extension, I receive the following error:

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

gcc version: 5.4.0 20160609

vs-c 版本:1.24.1

vs-c version: 1.24.1

我的launch.json文件如下:

my launch.json file is as follows:

{
    "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 的副本由于共享库事件 - Visual Studio Code 因为我已经在使用 -g 开关.

You may note that this is not a duplicate of Stopped due to shared library event - Visual Studio Code because I am already using the -g switch.

我想知道如何解决这个问题.提前致谢.

I would like to know how I can fix this. Thank you in advance.

推荐答案

假设使用 launch.json"additionalSOLibSearchPath" 选项没有帮助,以下设置可能将共享库添加到 gdb 的考虑中:

Assuming the use of "additionalSOLibSearchPath" option of launch.json did not help, the following setting might add a shared library into gdb's consideration:

"setupCommands":[
    {
        "description": "Additional libs for gdb",
        "text": "set solib-search-path sharedLibraryPath/lib"
    }
]

PS:gdb 可能仍会引发 Stopped 由于共享库事件(未添加或删除库) 警告,不过.

PS: gdb may still raise Stopped due to shared library event (no libraries added or removed) warning, nevertheless.

这篇关于Visual Studio Code 忽略调试符号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-07 03:14