Vscode-cpptools: gdb(msys2) on windows cannot find source

Created on 26 Sep 2016  Â·  12Comments  Â·  Source: microsoft/vscode-cpptools

VSCode version: 1.5.3
OS: Windows 10 1607
Debugger: gdb, in MSYS 2

Source code is stored in the same location as it was compiled from, gdb runs normally, but debugger cannot find my source code. Source viewer outputs

Source \home\Yienschwen\gdbTest\main.cc is not available.

The path is actually the same path in MSYS2 environment. So is there a way to map the source code lookup path? Or to specify the path of cygpath when using gdb?

Feature Request debugger

Most helpful comment

Thanks @JoyBinY - that setting does work, in my case I added a more universal setting:

            "sourceFileMap": {
                "/c/": "c:/",
                "/d/": "d:/",
                "/e/": "e:/",
                "/f/": "f:/"
            },

All 12 comments

Thanks for reporting this.

The issue is vscode sees the windows view of the file system. AFAIK, msys2 does not work with cygpath, but msys2 isn't one of currently tested platforms, so I'm not entirely sure. We can take this as a feature request to support msys2 on windows.

In the meantime, manual source mapping is on our backlog, but hasn't yet been shipped. This would allow someone to specify a replacement for a path. In the case above, it would likely replace \home with something relative to the windows view of the file system.

I'm using this extension since a few months with MSYS2 and it works fine. I can't test the current version because of #233, but I will try to reproduce your problem with >0.9.2 soon.

Okay I've got the C++ extension working again under Windows and tested debugging with MSYS2: Everything works fine for me.

Maybe it's your build system which inserts the paths in the wrong format? Have you added "miDebuggerPath": "C:\\msys64\\mingw64\\bin\\gdb.exe" to launch.json?

@jhasse, how are you compiling? Is gcc running such that it is seeing windows style paths or virtualized unix style paths? It seems the original poster is getting unix style paths compiled into symbols: "\home\YienschwengdbTest\main.cc". VSCode expects windows paths. On Cygwin, we use cygpath to map from virtualized unix paths to windows paths, but we haven't investigated anything like that for mingw.

VSCode version: 1.15.0
OS: Windows 10 1511
Debugger: gdb, in MSYS 2
add path like this in the launch.json file
"sourceFileMap": { "/H/Code/Develop_code/server": "H:/Code/Develop_code/server" },
BTW work slowly.. ...

Thanks @JoyBinY - that setting does work, in my case I added a more universal setting:

            "sourceFileMap": {
                "/c/": "c:/",
                "/d/": "d:/",
                "/e/": "e:/",
                "/f/": "f:/"
            },

how are you compiling?

With MinGW64 from MSYS2.

With GCC from MSYS2
Target : i686-pc-msys

Target : i686-pc-msys

Does that mean with the MSYS2 shell (and not the MinGW32/64 shell)?

yes, here i use the msys-gcc which installed by using command pacman -S gcc.
msys-gcc is difference from msys-gcc which is installed by mingw-get-setup.exe .
Using gcc -v can show more information, and you can find "Target : i686-pc-msys" there

I mean MinGW from MSYS2 which is placed in C:/msys64/mingw64/bin/gcc.exe for example. This will get used if you open the MinGW64 shell shortcut.

This is an older issue and hasn't had any updates. Please comment/open a new issue if it is still happening.

Was this page helpful?
0 / 5 - 0 ratings