microsoft / vscode-cpptools

Official repository for the Microsoft C/C++ extension for VS Code.
Other
5.42k stars 1.52k forks source link

_NT_SYMBOL_PATH environment is not appreciated by the debugger #1247

Open avkonst opened 6 years ago

avkonst commented 6 years ago

I think it is bug, although I am not sure if it is supported feature.

* Operating System and version: Windows 7
* VS Code version and if you are using the Insiders build: 1.17.2 (not Insiders)
* C/C++ extension version: 0.14.2
* Other extensions you installed and if the issue persists after disabling them: not sure
* step-by-step instructions to reproduce the issue: 

I am launching a binary under the debugger with the following settings:

     {
            "name": "(Windows) Launch",
            "type": "cppvsdbg",
            "request": "launch",
            "program": "${workspaceFolder}/target/debug/hello_cargo.exe",
            "args": [],
            "stopAtEntry": false,
            "cwd": "${workspaceFolder}",
            "environment": [],
            "externalConsole": true
        }

A binary is a sample rust program compiled to native MSVC.

The debugger shows the output:

-------------------------------------------------------------------
You may only use the C/C++ Extension for Visual Studio Code with
Visual Studio Code, Visual Studio or Visual Studio for Mac software
to help you develop and test your applications.
-------------------------------------------------------------------
Loaded 'C:\Projects\Tait\hello_cargo\target\debug\hello_cargo.exe'. Symbols loaded.
Loaded 'C:\Windows\System32\ntdll.dll'. Cannot find or open the PDB file.
Loaded 'C:\Windows\System32\kernel32.dll'. Cannot find or open the PDB file.
Loaded 'C:\Windows\System32\KernelBase.dll'. Cannot find or open the PDB file.
Loaded 'C:\Windows\System32\advapi32.dll'. Cannot find or open the PDB file.
Loaded 'C:\Windows\System32\msvcrt.dll'. Cannot find or open the PDB file.
Loaded 'C:\Windows\System32\sechost.dll'. Cannot find or open the PDB file.
Loaded 'C:\Windows\System32\rpcrt4.dll'. Cannot find or open the PDB file.
Loaded 'C:\Windows\System32\ws2_32.dll'. Cannot find or open the PDB file.
Loaded 'C:\Windows\System32\nsi.dll'. Cannot find or open the PDB file.
Loaded 'C:\Windows\System32\vcruntime140.dll'. Cannot find or open the PDB file.
Loaded 'C:\Windows\System32\api-ms-win-crt-runtime-l1-1-0.dll'. Cannot find or open the PDB file.
Loaded 'C:\Windows\System32\ucrtbase.dll'. Cannot find or open the PDB file.
Loaded 'C:\Windows\System32\api-ms-win-core-timezone-l1-1-0.dll'. Cannot find or open the PDB file.
Loaded 'C:\Windows\System32\api-ms-win-core-file-l2-1-0.dll'. Cannot find or open the PDB file.
Loaded 'C:\Windows\System32\api-ms-win-core-localization-l1-2-0.dll'. Cannot find or open the PDB file.

I can set a breakpoint in my code and catch it successfully, but frames from ntdll, kernel32, etc. are not resolved. Although, I have got symbols path set:

_NT_SYMBOL_PATH=srv*C:\symbols*http://msdl.microsoft.com/downloads/symbols

Local symbols cache folder is not getting populated.

Expected behavior:

pieandcakes commented 6 years ago

@avkonst With the debugger that we ship with VSCode we don't support using a symbol server. We currently only support having the symbols locally.

avkonst commented 6 years ago

Great. Thanks. Would you accept it as a feature request in this case?

pieandcakes commented 6 years ago

I have marked it as a feature request.

bsed commented 6 years ago

I have same problem

-------------------------------------------------------------------
You may only use the C/C++ Extension for Visual Studio Code with
Visual Studio Code, Visual Studio or Visual Studio for Mac software
to help you develop and test your applications.
-------------------------------------------------------------------
Loaded 'E:\workspace\rust\hello_world\target\debug\hello_world.exe'. Symbols loaded.
Loaded 'C:\Windows\System32\ntdll.dll'. Cannot find or open the PDB file.
Loaded 'C:\Windows\System32\kernel32.dll'. Cannot find or open the PDB file.
Loaded 'C:\Windows\System32\KernelBase.dll'. Cannot find or open the PDB file.
Loaded 'C:\Windows\System32\ucrtbase.dll'. Cannot find or open the PDB file.
Loaded 'C:\Windows\System32\vcruntime140.dll'. Cannot find or open the PDB file.
The thread 8244 has exited with code 0 (0x0).
nsubtil commented 6 years ago

This is preventing me from using vscode as my IDE. +1 for this request.

sytran commented 5 years ago

++ for this request.

I have the same problem and the code did not stop at the break point.

My code is the same hello.cpp code as demonstrated in this talk C++Now 2018 https://www.youtube.com/watch?v=-erXR6k9TeE


Loaded 'C:\sytranSwDev\vsCode\hello_vsCode\hello'. Symbols loaded. Loaded 'C:\Windows\System32\ntdll.dll'. Cannot find or open the PDB file. Loaded 'C:\Windows\System32\kernel32.dll'. Cannot find or open the PDB file. Loaded 'C:\Windows\System32\KernelBase.dll'. Cannot find or open the PDB file. The thread 6616 has exited with code 0 (0x0). Loaded 'C:\Windows\System32\api-ms-win-core-synch-l1-2-0.dll'. Cannot find or open the PDB file. The program '[4068] hello' has exited with code 0 (0x0).

pieandcakes commented 5 years ago

@sytran This is specifically for Rust to load outside symbols. The video you sent is regular C++. Please be sure you have compiled with symbols and are using the same type of debugger for the compiler (Visual C++ versus GNU C++). The issue here isn't that you can't hit a breakpoint but that we don't respect loading of system PDBs.

yinguoxiangyi commented 5 years ago

I have the same problem ,but the .dll file already exits in 'C:\Windows\System32' , I am very confused. Thanks for your help! image

Steelskin commented 1 month ago

If anyone else is stumbling upon this bug as they are attempting to use a symbol server, this is now supported by cppvsdbg. The documentation is here.

For instance, you'll have to add the following to your debug configuration:

{
    "version": "0.2.0",
    "configurations": [
        {
            "type": "cppvsdbg",
            "request": "launch",
            "name": "Launch with symbol server",
            "program": "/path/to/program.exe",
            "symbolOptions": {
                "searchPaths": [
                    "https://my-companies-symbols-server"
                ],
                "searchMicrosoftSymbolServer": true,
            }
        },
    ]
}

In most cases, I guess you'll only need the "searchMicrosoftSymbolServer": true part.