Cannot debug MinGW anymore
See original GitHub issueBrief Issue Summary
I’m not able to debug anymore with Visual Studio Code 1.42 (user), CMake Tools 1.3.0, MinGW 17.1 (GCC 9.2.0) from nuwen (https://nuwen.net/mingw.html)
Pressing the [Debug] button, I get the message "Launch program ‘BuildPath \ FullExecutableFileAndDirectory’ do not exists.
Where BuildPath is my current cmake build path: ‘c:\project\build’ and FullExecutableFileAndDirectory if the full path to my current selected executable: c:\project\bin\foo.exe
Concatenated: c:\project\build\c:\project\bin\foo.exe
This is the content of my launch.json:
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "(gdb) Launch",
"type": "cppdbg",
"request": "launch",
"program": "${command:cmake.launchTargetPath}",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"miDebuggerPath": "C:\\MinGW\\bin\\gdb.exe",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
},
]
}
Expected:
Do not concatenate the build directory and the full path of the executable.
CMake Tools Log
2020-02-12T12:21:27.945Z [info] [main] Building folder: Example Exercise1
2020-02-12T12:21:28.140Z [debug] [main] Saving open files before configure/build
2020-02-12T12:21:28.334Z [info] [build] Starting build
2020-02-12T12:21:28.376Z [debug] [driver] Start build Exercise1
2020-02-12T12:21:28.376Z [debug] [driver] Runnnig pre-configure checks and steps
2020-02-12T12:21:28.380Z [info] [proc] Executing command: "C:\Program Files\CMake\bin\cmake.EXE" --build c:/Work/Example/build --config Debug --target Exercise1 -- -j 6
2020-02-12T12:21:29.442Z [info] [build] [ 16%] Built target minifb
2020-02-12T12:21:29.599Z [info] [build] [ 70%] Built target MindShake
2020-02-12T12:21:30.034Z [info] [build] [ 90%] Built target engine
2020-02-12T12:21:30.374Z [info] [build] [100%] Built target Exercise1
2020-02-12T12:21:30.595Z [debug] [cmakefileapi-parser] Read reply folder: c:\Work\Example\build\.cmake\api\v1\reply
2020-02-12T12:21:30.596Z [debug] [cmakefileapi-parser] Found index files: ["cache-v2-d187fc0f5e5cb0f39708.json","codemodel-v2-c72d883b4302cc6ec5bf.json","index-2020-02-12T12-05-33-0061.json","target-engine-Debug-49188a974d00e619c592.json","target-Exercise1-Debug-c62fdad287cc5c21f043.json","target-input_events-Debug-73563e3136b10a57f189.json","target-input_events_cpp-Debug-ba210035d24b7dc7d152.json","target-MindShake-Debug-845d700a4f3d9bdb73d6.json","target-minifb-Debug-8833223ab5d7ed2dd34f.json","target-multiple_windows-Debug-f85e8bac54486d63b285.json","target-noise-Debug-da12f99242748f96d7ba.json","target-TestSceneNode-Debug-2f1544916dff6ff6cbea.json"]
2020-02-12T12:21:30.613Z [debug] [driver] Run _refreshExpansions
2020-02-12T12:21:30.613Z [debug] [driver] Run _refreshExpansions cb
2020-02-12T12:21:30.623Z [info] [build] Build finished with exit code 0
2020-02-12T12:21:30.630Z [debug] [cache] Reading CMake cache file c:/Work/Example/build/CMakeCache.txt
2020-02-12T12:21:30.631Z [debug] [cache] Parsing CMake cache string
2020-02-12T12:21:30.646Z [info] [proc] Executing command: C:/MinGW/bin/gdb.exe --version
2020-02-12T12:21:30.806Z [debug] [main] Debug configuration from cache: {"type":"cppdbg","name":"Debug Exercise1","request":"launch","cwd":"${workspaceFolder}","args":[],"MIMode":"gdb","miDebuggerPath":"C:/MinGW/bin/gdb.exe","setupCommands":[{"description":"Enable pretty-printing for gdb","text":"-enable-pretty-printing","ignoreFailures":true}],"program":"C:\\Work\\Example\\build\\C:\\Work\\Example\\bin\\Exercise1.exe"}
2020-02-12T12:21:30.806Z [debug] [main] Starting debugger with following configuration. {"workspace":"file:///c%3A/Work/Example","config":{"type":"cppdbg","name":"Debug Exercise1","request":"launch","cwd":"${workspaceFolder}","args":[],"MIMode":"gdb","miDebuggerPath":"C:/MinGW/bin/gdb.exe","setupCommands":[{"description":"Enable pretty-printing for gdb","text":"-enable-pretty-printing","ignoreFailures":true}],"program":"C:\\Work\\Example\\build\\C:\\Work\\Example\\bin\\Exercise1.exe"}}
2020-02-12T12:21:30.852Z [debug] [cache] Reading CMake cache file c:/Work/Example/build/CMakeCache.txt
2020-02-12T12:21:30.856Z [debug] [cache] Parsing CMake cache string
2020-02-12T12:21:33.354Z [debug] [extension] [5791] cmake.debugTarget finished (returned undefined)
Developer Tools Log
abstractExtensionService.ts:396 [idleberg.nsis]: Unknown language in `contributes.nsis.language`. Provided value: haskell
_logMessageInConsole @ abstractExtensionService.ts:396
console.ts:137 [Extension Host] activating extension
console.ts:137 [Extension Host] starting language server
console.ts:137 [Extension Host] (node:2208) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
t.log @ console.ts:137
console.ts:137 [Extension Host] (node:2208) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
t.log @ console.ts:137
console.ts:137 [Extension Host] [CMakeTools] 2020-02-12T12:34:58.139Z [debug] [main] Safe constructing new CMakeTools instance
console.ts:137 [Extension Host] [CMakeTools] 2020-02-12T12:34:58.140Z [debug] [variant] Constructing VariantManager
console.ts:137 [Extension Host] [CMakeTools] 2020-02-12T12:34:58.143Z [debug] [main] Constructing new CMakeTools instance
console.ts:137 [Extension Host] [CMakeTools] 2020-02-12T12:34:58.144Z [debug] [main] Starting CMakeTools second-phase init
console.ts:137 [Extension Host] [CMakeTools] 2020-02-12T12:34:58.323Z [info] [variant] Loaded new set of variants
console.ts:137 [Extension Host] [CMakeTools] 2020-02-12T12:34:58.327Z [debug] [main] CMakeTools instance initialization complete.
console.ts:137 [Extension Host] [CMakeTools] 2020-02-12T12:34:58.354Z [debug] [kit] Reading kits file C:\Users\caragone\AppData\Local\CMakeTools\cmake-tools-kits.json
console.ts:137 [Extension Host] [CMakeTools] 2020-02-12T12:34:58.452Z [info] [kit] Successfully loaded 22 kits from C:\Users\caragone\AppData\Local\CMakeTools\cmake-tools-kits.json
console.ts:137 [Extension Host] [CMakeTools] 2020-02-12T12:34:58.459Z [debug] [kit] Not reading non-existent kits file: c:\Work\Example\.vscode\cmake-kits.json
console.ts:137 [Extension Host] [CMakeTools] 2020-02-12T12:34:58.460Z [debug] [main] Injecting new Kit into CMake driver
console.ts:137 [Extension Host] [CMakeTools] 2020-02-12T12:34:58.472Z [debug] [extension] Configuring workspace on open file:///c%3A/Work/Example
console.ts:137 [Extension Host] [CMakeTools] 2020-02-12T12:34:58.474Z [info] [main] Configuring folder: Example
console.ts:137 [Extension Host] [CMakeTools] 2020-02-12T12:34:58.474Z [debug] [main] Saving open files before configure/build
console.ts:137 [Extension Host] [CMakeTools] 2020-02-12T12:34:59.193Z [debug] [main] Starting new CMake driver
console.ts:137 [Extension Host] [CMakeTools] 2020-02-12T12:34:59.193Z [debug] [main] Starting CMake driver
console.ts:137 [Extension Host] [CMakeTools] 2020-02-12T12:34:59.195Z [debug] [cmakefileapi-driver] Creating instance of CMakeFileApiDriver
console.ts:137 [Extension Host] [CMakeTools] 2020-02-12T12:34:59.196Z [debug] [driver] CMakeDriver Kit set to GCC 8.2.0
console.ts:137 [Extension Host] [CMakeTools] 2020-02-12T12:34:59.198Z [debug] [driver] Trying to detect generator supported by system
console.ts:137 [Extension Host] [CMakeTools] 2020-02-12T12:34:59.214Z [debug] [driver] Command version test return code -1
console.ts:137 [Extension Host] [CMakeTools] 2020-02-12T12:34:59.222Z [debug] [driver] Command version test return code -1
console.ts:137 [Extension Host] [CMakeTools] 2020-02-12T12:34:59.328Z [debug] [driver] Command version test return code 0
console.ts:137 [Extension Host] [CMakeTools] 2020-02-12T12:34:59.328Z [debug] [driver] Run _refreshExpansions
console.ts:137 [Extension Host] [CMakeTools] 2020-02-12T12:34:59.328Z [debug] [driver] Run _refreshExpansions cb
console.ts:137 [Extension Host] [CMakeTools] 2020-02-12T12:34:59.331Z [debug] [cache] Reading CMake cache file c:/Work/Example/build/CMakeCache.txt
console.ts:137 [Extension Host] [CMakeTools] 2020-02-12T12:34:59.333Z [debug] [cache] Parsing CMake cache string
console.ts:137 [Extension Host] [CMakeTools] 2020-02-12T12:34:59.360Z [debug] [cmakefileapi-parser] Read reply folder: c:\Work\Example\build\.cmake\api\v1\reply
console.ts:137 [Extension Host] [CMakeTools] 2020-02-12T12:34:59.362Z [debug] [cmakefileapi-parser] Found index files: ["cache-v2-d187fc0f5e5cb0f39708.json","codemodel-v2-c72d883b4302cc6ec5bf.json","index-2020-02-12T12-05-33-0061.json","target-engine-Debug-49188a974d00e619c592.json","target-Exercise1-Debug-c62fdad287cc5c21f043.json","target-input_events-Debug-73563e3136b10a57f189.json","target-input_events_cpp-Debug-ba210035d24b7dc7d152.json","target-MindShake-Debug-845d700a4f3d9bdb73d6.json","target-minifb-Debug-8833223ab5d7ed2dd34f.json","target-multiple_windows-Debug-f85e8bac54486d63b285.json","target-noise-Debug-da12f99242748f96d7ba.json","target-TestSceneNode-Debug-2f1544916dff6ff6cbea.json"]
console.ts:137 [Extension Host] [CMakeTools] 2020-02-12T12:34:59.393Z [debug] [driver] Setting new variant , Disable optimizations - include debug information.
console.ts:137 [Extension Host] [CMakeTools] 2020-02-12T12:34:59.394Z [debug] [driver] Run _refreshExpansions
console.ts:137 [Extension Host] [CMakeTools] 2020-02-12T12:34:59.394Z [debug] [driver] Run _refreshExpansions cb
console.ts:137 [Extension Host] [CMakeTools] 2020-02-12T12:35:00.032Z [debug] [driver] Start configure
console.ts:137 [Extension Host] [CMakeTools] 2020-02-12T12:35:00.033Z [debug] [driver] Runnnig pre-configure checks and steps
console.ts:137 [Extension Host] [CMakeTools] 2020-02-12T12:35:00.035Z [debug] [driver] Using compilers in GCC 8.2.0 for configure
console.ts:137 [Extension Host] [CMakeTools] 2020-02-12T12:35:00.040Z [debug] [driver] Run _refreshExpansions
console.ts:137 [Extension Host] [CMakeTools] 2020-02-12T12:35:00.041Z [debug] [driver] Run _refreshExpansions cb
console.ts:137 [Extension Host] [CMakeTools] 2020-02-12T12:35:00.050Z [debug] [cmakefileapi-driver] Invoking CMake C:\Program Files\CMake\bin\cmake.EXE with arguments ["--no-warn-unused-cli","-DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE","-DCMAKE_BUILD_TYPE:STRING=Debug","-DCMAKE_C_COMPILER:FILEPATH=C:\\MinGW\\bin\\gcc.exe","-DCMAKE_CXX_COMPILER:FILEPATH=C:\\MinGW\\bin\\g++.exe","-Hc:/Work/Example","-Bc:/Work/Example/build","-G","Unix Makefiles"]
console.ts:137 [Extension Host] [CMakeTools] 2020-02-12T12:35:00.059Z [info] [proc] Executing command: "C:\Program Files\CMake\bin\cmake.EXE" --no-warn-unused-cli -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -DCMAKE_BUILD_TYPE:STRING=Debug -DCMAKE_C_COMPILER:FILEPATH=C:\MinGW\bin\gcc.exe -DCMAKE_CXX_COMPILER:FILEPATH=C:\MinGW\bin\g++.exe -Hc:/Work/Example -Bc:/Work/Example/build -G "Unix Makefiles"
console.ts:137 [Extension Host] [CMakeTools] 2020-02-12T12:35:00.287Z [info] [cmake] Not searching for unused variables given on the command line.
console.ts:137 [Extension Host] [CMakeTools] 2020-02-12T12:35:00.535Z [error] [cmake] Processing Example
t.log @ console.ts:137
console.ts:137 [Extension Host] [CMakeTools] 2020-02-12T12:35:00.546Z [error] [cmake] Processing MiniFB
t.log @ console.ts:137
console.ts:137 [Extension Host] [CMakeTools] 2020-02-12T12:35:00.547Z [error] [cmake] Done MiniFB
t.log @ console.ts:137
console.ts:137 [Extension Host] [CMakeTools] 2020-02-12T12:35:00.551Z [error] [cmake] Processing MindShake
t.log @ console.ts:137
console.ts:137 [Extension Host] [CMakeTools] 2020-02-12T12:35:00.552Z [error] [cmake] CMAKE_BUILD_TYPE: Debug
t.log @ console.ts:137
console.ts:137 [Extension Host] [CMakeTools] 2020-02-12T12:35:00.590Z [error] [cmake] CMAKE_BUILD_TYPE: Debug
t.log @ console.ts:137
console.ts:137 [Extension Host] [CMakeTools] 2020-02-12T12:35:00.613Z [info] [cmake] -- Configuring done
console.ts:137 [Extension Host] [CMakeTools] 2020-02-12T12:35:01.450Z [info] [cmake] -- Generating done
console.ts:137 [Extension Host] [CMakeTools] 2020-02-12T12:35:02.131Z [info] [cmake] -- Build files have been written to: C:/Work/Example/build
console.ts:137 [Extension Host] [CMakeTools] 2020-02-12T12:35:02.149Z [debug] [cmakefileapi-parser] Read reply folder: c:\Work\Example\build\.cmake\api\v1\reply
console.ts:137 [Extension Host] [CMakeTools] 2020-02-12T12:35:02.150Z [debug] [cmakefileapi-parser] Found index files: ["cache-v2-d187fc0f5e5cb0f39708.json","codemodel-v2-c72d883b4302cc6ec5bf.json","index-2020-02-12T12-35-02-0128.json","target-engine-Debug-49188a974d00e619c592.json","target-Exercise1-Debug-c62fdad287cc5c21f043.json","target-input_events-Debug-73563e3136b10a57f189.json","target-input_events_cpp-Debug-ba210035d24b7dc7d152.json","target-MindShake-Debug-845d700a4f3d9bdb73d6.json","target-minifb-Debug-8833223ab5d7ed2dd34f.json","target-multiple_windows-Debug-f85e8bac54486d63b285.json","target-noise-Debug-da12f99242748f96d7ba.json","target-TestSceneNode-Debug-2f1544916dff6ff6cbea.json"]
console.ts:137 [Extension Host] [CMakeTools] 2020-02-12T12:35:02.753Z [debug] [cache] Reading CMake cache file c:/Work/Example/build/CMakeCache.txt
console.ts:137 [Extension Host] [CMakeTools] 2020-02-12T12:35:02.756Z [debug] [cache] Parsing CMake cache string
console.ts:137 [Extension Host] [CMakeTools] 2020-02-12T12:35:03.680Z [debug] [cache] Reading CMake cache file c:/Work/Example/build/CMakeCache.txt
console.ts:137 [Extension Host] [CMakeTools] 2020-02-12T12:35:03.682Z [debug] [cache] Parsing CMake cache string
console.ts:137 [Extension Host] [CMakeTools] 2020-02-12T12:35:19.309Z [debug] [extension] [1399] cmake.debugTarget started
console.ts:137 [Extension Host] [CMakeTools] 2020-02-12T12:35:20.141Z [info] [main] Building folder: Example Exercise1
console.ts:137 [Extension Host] [CMakeTools] 2020-02-12T12:35:20.324Z [debug] [main] Saving open files before configure/build
console.ts:137 [Extension Host] [CMakeTools] 2020-02-12T12:35:20.608Z [info] [build] Starting build
console.ts:137 [Extension Host] [CMakeTools] 2020-02-12T12:35:20.642Z [debug] [driver] Start build Exercise1
console.ts:137 [Extension Host] [CMakeTools] 2020-02-12T12:35:20.642Z [debug] [driver] Runnnig pre-configure checks and steps
console.ts:137 [Extension Host] [CMakeTools] 2020-02-12T12:35:20.752Z [info] [proc] Executing command: "C:\Program Files\CMake\bin\cmake.EXE" --build c:/Work/Example/build --config Debug --target Exercise1 -- -j 6
console.ts:137 [Extension Host] [CMakeTools] 2020-02-12T12:35:21.872Z [info] [build] [ 16%] Built target minifb
console.ts:137 [Extension Host] [CMakeTools] 2020-02-12T12:35:22.029Z [info] [build] [ 70%] Built target MindShake
console.ts:137 [Extension Host] [CMakeTools] 2020-02-12T12:35:22.448Z [info] [build] [ 90%] Built target engine
console.ts:137 [Extension Host] [CMakeTools] 2020-02-12T12:35:22.798Z [info] [build] [100%] Built target Exercise1
console.ts:137 [Extension Host] [CMakeTools] 2020-02-12T12:35:22.998Z [debug] [cmakefileapi-parser] Read reply folder: c:\Work\Example\build\.cmake\api\v1\reply
console.ts:137 [Extension Host] [CMakeTools] 2020-02-12T12:35:22.999Z [debug] [cmakefileapi-parser] Found index files: ["cache-v2-d187fc0f5e5cb0f39708.json","codemodel-v2-c72d883b4302cc6ec5bf.json","index-2020-02-12T12-35-02-0128.json","target-engine-Debug-49188a974d00e619c592.json","target-Exercise1-Debug-c62fdad287cc5c21f043.json","target-input_events-Debug-73563e3136b10a57f189.json","target-input_events_cpp-Debug-ba210035d24b7dc7d152.json","target-MindShake-Debug-845d700a4f3d9bdb73d6.json","target-minifb-Debug-8833223ab5d7ed2dd34f.json","target-multiple_windows-Debug-f85e8bac54486d63b285.json","target-noise-Debug-da12f99242748f96d7ba.json","target-TestSceneNode-Debug-2f1544916dff6ff6cbea.json"]
console.ts:137 [Extension Host] [CMakeTools] 2020-02-12T12:35:23.017Z [debug] [driver] Run _refreshExpansions
console.ts:137 [Extension Host] [CMakeTools] 2020-02-12T12:35:23.017Z [debug] [driver] Run _refreshExpansions cb
console.ts:137 [Extension Host] [CMakeTools] 2020-02-12T12:35:23.029Z [info] [build] Build finished with exit code 0
console.ts:137 [Extension Host] [CMakeTools] 2020-02-12T12:35:23.039Z [debug] [cache] Reading CMake cache file c:/Work/Example/build/CMakeCache.txt
console.ts:137 [Extension Host] [CMakeTools] 2020-02-12T12:35:23.041Z [debug] [cache] Parsing CMake cache string
console.ts:137 [Extension Host] [CMakeTools] 2020-02-12T12:35:23.075Z [info] [proc] Executing command: C:/MinGW/bin/gdb.exe --version
console.ts:137 [Extension Host] [CMakeTools] 2020-02-12T12:35:23.277Z [debug] [main] Debug configuration from cache: {"type":"cppdbg","name":"Debug Exercise1","request":"launch","cwd":"${workspaceFolder}","args":[],"MIMode":"gdb","miDebuggerPath":"C:/MinGW/bin/gdb.exe","setupCommands":[{"description":"Enable pretty-printing for gdb","text":"-enable-pretty-printing","ignoreFailures":true}],"program":"C:\\Work\\Example\\build\\C:\\Work\\Example\\bin\\Exercise1.exe"}
console.ts:137 [Extension Host] [CMakeTools] 2020-02-12T12:35:23.277Z [debug] [main] Starting debugger with following configuration. {"workspace":"file:///c%3A/Work/Example","config":{"type":"cppdbg","name":"Debug Exercise1","request":"launch","cwd":"${workspaceFolder}","args":[],"MIMode":"gdb","miDebuggerPath":"C:/MinGW/bin/gdb.exe","setupCommands":[{"description":"Enable pretty-printing for gdb","text":"-enable-pretty-printing","ignoreFailures":true}],"program":"C:\\Work\\Example\\build\\C:\\Work\\Example\\bin\\Exercise1.exe"}}
console.ts:137 [Extension Host] [CMakeTools] 2020-02-12T12:35:23.312Z [debug] [cache] Reading CMake cache file c:/Work/Example/build/CMakeCache.txt
console.ts:137 [Extension Host] [CMakeTools] 2020-02-12T12:35:23.314Z [debug] [cache] Parsing CMake cache string
console.ts:137 [Extension Host] [CMakeTools] 2020-02-12T12:35:27.037Z [debug] [extension] [1399] cmake.debugTarget finished (returned undefined)
Platform and Versions
- Operating System: Windows
- CMake Version: 3.15.4
- VSCode Version: 1.42
- CMake Tools Extension Version: 1.3.0
- Compiler/Toolchain: MinGW 17.1 (GCC 9.2.0) from nuwen (https://nuwen.net/mingw.html)
Other Notes/Information
Issue Analytics
- State:
- Created 4 years ago
- Comments:8 (5 by maintainers)
Top Results From Across the Web
Issue when debugging with gdb after compiling with the ...
I can compile with the official mingw-w64 gcc and debug with gdb of msys2 and it works fine. But in reverse, if I...
Read more >Debugging with mingw64 impossible - Code::Blocks Forums
The problem happens if start debugging without any breakpoints and, during execution, I set a new breakpoint. The Debugger Log says:.
Read more >Thread: Re: [Mingw-users] [ Mingw-users ] dbghelp integration
Seems nobody cares about solid debugging mechanisms anymore, and MinGW provides no solution for core dumps, the mechanism used everywhere else.
Read more >Troubleshooting Tips: Failed Debugging with GDB
One common problem is that cygwin or other tool chains are installed and have changed the global system path, and the wrong toolchain...
Read more >WinGDB Known problems
Debugging with GDB under Visual Studio. ... MinGW: Can't debug, "no source available for current location" message shows up. Program is compiled with...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I faced the same problem on windows with the msvc compiler using CMake FileAPI Driver. I was able to fix it with a small change in src\drivers\cmakefileapi\api_helpers.ts line 130. You need to remove redundant paht.join here.
should be executable_path = path.normalize(executable_path.path);
Visual Studio Professional 2017, version 15.9.19
Fixed in 1.3.1