Vscode-cpptools: Regression, MinGW GDB debugging no longer works. You can't do that when your target is `exec' file-exec-and-symbols

Created on 22 Sep 2020  路  8Comments  路  Source: microsoft/vscode-cpptools

Type: Debugger

Describe the bug

  • OS and Version: Windows 10.0.19041
  • VS Code Version:

Version: 1.49.1 (user setup)
Commit: 58bb7b2331731bf72587010e943852e13e6fd3cf
Date: 2020-09-16T23:27:51.792Z
Electron: 9.2.1
Chrome: 83.0.4103.122
Node.js: 12.14.1
V8: 8.3.110.13-electron.0
OS: Windows_NT x64 10.0.19041

  • C/C++ Extension Version: v1.0.1

  • Other extensions you installed (and if the issue persists after disabling them):

code --install-extension 13xforever.language-x86-64-assembly
code --install-extension austin.code-gnu-global
code --install-extension bierner.markdown-preview-github-styles
code --install-extension cheshirekow.cmake-format
code --install-extension cschlosser.doxdocgen
code --install-extension DavidAnson.vscode-markdownlint
code --install-extension dracula-theme.theme-dracula
code --install-extension foxundermoon.shell-format
code --install-extension gerane.Theme-Batman
code --install-extension GitHub.vscode-pull-request-github
code --install-extension jeff-hykin.better-cpp-syntax
code --install-extension mads-hartmann.bash-ide-vscode
code --install-extension melak47.ninja-syntax
code --install-extension ms-dotnettools.csharp
code --install-extension ms-python.python
code --install-extension ms-vscode-remote.remote-containers
code --install-extension ms-vscode-remote.remote-ssh
code --install-extension ms-vscode-remote.remote-ssh-edit
code --install-extension ms-vscode-remote.remote-wsl
code --install-extension ms-vscode-remote.vscode-remote-extensionpack
code --install-extension ms-vscode.cmake-tools
code --install-extension ms-vscode.cpptools
code --install-extension ms-vscode.cpptools-extension-pack
code --install-extension ms-vscode.cpptools-themes
code --install-extension ms-vsliveshare.vsliveshare
code --install-extension ms-vsliveshare.vsliveshare-audio
code --install-extension ms-vsonline.vsonline
code --install-extension npclaudiu.vscode-gn
code --install-extension spadin.remote-x11-ssh
code --install-extension twxs.cmake
code --install-extension v8-torque.vscode-torque
code --install-extension yzhang.markdown-all-in-one

Issue does persist after disabling all c++ related extensions

  • A clear and concise description of what the bug is.

When running a debug session the process fails showing a message box saying that the executable is missing or invalid,
but the file is there and I can run it manually from the shell.

This used to work 2 weeks ago and for a very long time before.

To Reproduce
Please include a code sample and launch.json configuration.

{
    "version": "0.2.0",
    "configurations": [

                    {
                    "name": "OpenGLDemo",
                    "type": "cppdbg",
                    "request": "launch",
                    "args": ["C:/Code/AeonGUI/images/script.svg"],
                    "stopAtEntry": false,
                    "cwd": "C:/Code/AeonGUI/mingw64",
                    "environment": [
                        {
                            "name":"PATH",
                            "value":"C:/Code/AeonGUI/mingw64/bin;C:/msys64/mingw64/bin"
                        }                    
                    ],
                    "externalConsole": true,
                    "program": "C:/Code/AeonGUI/mingw64/bin/OpenGLDemo.exe",
                    "miDebuggerPath": "C:/msys64/mingw64/bin/gdb.exe",
                    "MIMode": "gdb",
                    "setupCommands": [
                        {
                            "description": "Enable pretty-printing for gdb",
                            "text": "-enable-pretty-printing",
                            "ignoreFailures": true
                        },
                        {
                            "description": "Enable all-exceptions",
                            "text": "catch throw",
                            "ignoreFailures": true
                        }
                    ],
                    "logging": {
                        "trace": true,
                        "traceResponse": true,
                        "engineLogging": true
                    },
                }
    ]
}

Steps to reproduce the behavior:

  1. Build solution
  2. click on the play button for debbugin
  3. See error

Additional context
If applicable, please include logging by adding "logging": { "engineLogging": true, "trace": true, "traceResponse": true } in your launch.json
Add any other context about the problem here including log or error messages in your Debug Console or Output windows.

--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (161) LaunchOptions<LocalLaunchOptions xmlns='http://schemas.microsoft.com/vstudio/MDDDebuggerOptions/2014'\r\n"},"seq":2}
1: (161) LaunchOptions<LocalLaunchOptions xmlns='http://schemas.microsoft.com/vstudio/MDDDebuggerOptions/2014'
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (186) LaunchOptions  ExePath='C:\\Code\\AeonGUI\\mingw64\\bin\\OpenGLDemo.exe'\r\n"},"seq":4}
1: (186) LaunchOptions  ExePath='C:\Code\AeonGUI\mingw64\bin\OpenGLDemo.exe'
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (186) LaunchOptions  WorkingDirectory='C:\\Code\\AeonGUI\\mingw64'\r\n"},"seq":6}
1: (186) LaunchOptions  WorkingDirectory='C:\Code\AeonGUI\mingw64'
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (186) LaunchOptions  ExeArguments='C:/Code/AeonGUI/images/script.svg'\r\n"},"seq":8}
1: (186) LaunchOptions  ExeArguments='C:/Code/AeonGUI/images/script.svg'
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (186) LaunchOptions  MIMode='gdb'\r\n"},"seq":10}
1: (186) LaunchOptions  MIMode='gdb'
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (187) LaunchOptions  MIDebuggerPath='C:/msys64/mingw64/bin/gdb.exe'\r\n"},"seq":12}
1: (187) LaunchOptions  MIDebuggerPath='C:/msys64/mingw64/bin/gdb.exe'
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (187) LaunchOptions  WaitDynamicLibLoad='false'\r\n"},"seq":14}
1: (187) LaunchOptions  WaitDynamicLibLoad='false'
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (187) LaunchOptions  ExternalConsole='true'\r\n"},"seq":16}
1: (187) LaunchOptions  ExternalConsole='true'
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (187) LaunchOptions>\r\n"},"seq":18}
1: (187) LaunchOptions>
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (187) LaunchOptions    <SetupCommands>\r\n"},"seq":20}
1: (187) LaunchOptions    <SetupCommands>
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (188) LaunchOptions        <Command IgnoreFailures='true' Description='Enable pretty-printing for gdb'>-enable-pretty-printing</Command>\r\n"},"seq":22}
1: (188) LaunchOptions        <Command IgnoreFailures='true' Description='Enable pretty-printing for gdb'>-enable-pretty-printing</Command>
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (188) LaunchOptions        <Command IgnoreFailures='true' Description='Enable all-exceptions'>catch throw</Command>\r\n"},"seq":24}
1: (188) LaunchOptions        <Command IgnoreFailures='true' Description='Enable all-exceptions'>catch throw</Command>
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (188) LaunchOptions    </SetupCommands>\r\n"},"seq":26}
1: (188) LaunchOptions    </SetupCommands>
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (188) LaunchOptions    <Environment>\r\n"},"seq":28}
1: (188) LaunchOptions    <Environment>
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (188) LaunchOptions        <EnvironmentEntry Name='PATH' Value='C:/Code/AeonGUI/mingw64/bin;C:/msys64/mingw64/bin' />\r\n"},"seq":30}
1: (188) LaunchOptions        <EnvironmentEntry Name='PATH' Value='C:/Code/AeonGUI/mingw64/bin;C:/msys64/mingw64/bin' />
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (188) LaunchOptions    </Environment>\r\n"},"seq":32}
1: (188) LaunchOptions    </Environment>
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (188) LaunchOptions</LocalLaunchOptions>\r\n"},"seq":34}
1: (188) LaunchOptions</LocalLaunchOptions>
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (257) Starting: \"C:/msys64/mingw64/bin/gdb.exe\" --interpreter=mi\r\n"},"seq":36}
1: (257) Starting: "C:/msys64/mingw64/bin/gdb.exe" --interpreter=mi
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (266) DebuggerPid=15436\r\n"},"seq":38}
1: (266) DebuggerPid=15436
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (469) ->=thread-group-added,id=\"i1\"\r\n"},"seq":40}
1: (469) ->=thread-group-added,id="i1"
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (470) ->~\"GNU gdb (GDB) 9.2\\n\"\r\n"},"seq":42}
1: (470) ->~"GNU gdb (GDB) 9.2\n"
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (470) ->~\"Copyright (C) 2020 Free Software Foundation, Inc.\\n\"\r\n"},"seq":44}
1: (470) ->~"Copyright (C) 2020 Free Software Foundation, Inc.\n"
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (471) ->~\"License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>\\nThis is free software: you are free to change and redistribute it.\\nThere is NO WARRANTY, to the extent permitted by law.\"\r\n"},"seq":46}
1: (471) ->~"License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>\nThis is free software: you are free to change and redistribute it.\nThere is NO WARRANTY, to the extent permitted by law."
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (471) ->~\"\\nType \\\"show copying\\\" and \\\"show warranty\\\" for details.\\n\"\r\n"},"seq":48}
1: (471) ->~"\nType \"show copying\" and \"show warranty\" for details.\n"
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (471) ->~\"This GDB was configured as \\\"x86_64-w64-mingw32\\\".\\n\"\r\n"},"seq":50}
1: (471) ->~"This GDB was configured as \"x86_64-w64-mingw32\".\n"
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (471) ->~\"Type \\\"show configuration\\\" for configuration details.\\n\"\r\n"},"seq":52}
1: (471) ->~"Type \"show configuration\" for configuration details.\n"
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (471) ->~\"For bug reporting instructions, please see:\\n\"\r\n"},"seq":54}
1: (471) ->~"For bug reporting instructions, please see:\n"
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (471) ->~\"<http://www.gnu.org/software/gdb/bugs/>.\\n\"\r\n"},"seq":56}
1: (471) ->~"<http://www.gnu.org/software/gdb/bugs/>.\n"
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (471) ->~\"Find the GDB manual and other documentation resources online at:\\n    <http://www.gnu.org/software/gdb/documentation/>.\"\r\n"},"seq":58}
1: (471) ->~"Find the GDB manual and other documentation resources online at:\n    <http://www.gnu.org/software/gdb/documentation/>."
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (471) ->~\"\\n\\n\"\r\n"},"seq":60}
1: (471) ->~"\n\n"
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (471) ->~\"For help, type \\\"help\\\".\\n\"\r\n"},"seq":62}
1: (471) ->~"For help, type \"help\".\n"
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (471) ->~\"Type \\\"apropos word\\\" to search for commands related to \\\"word\\\".\\n\"\r\n"},"seq":64}
1: (471) ->~"Type \"apropos word\" to search for commands related to \"word\".\n"
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (477) ->(gdb)\r\n"},"seq":66}
1: (477) ->(gdb)
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (482) <-1001-gdb-set target-async on\r\n"},"seq":68}
1: (482) <-1001-gdb-set target-async on
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (492) ->1001^done\r\n"},"seq":70}
1: (492) ->1001^done
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (492) ->(gdb)\r\n"},"seq":72}
1: (492) ->(gdb)
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (493) ->&\"\\n\"\r\n"},"seq":74}
1: (493) ->&"\n"
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (493) ->^done\r\n"},"seq":76}
1: (493) ->^done
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (493) ->(gdb)\r\n"},"seq":78}
1: (493) ->(gdb)
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (494) 1001: elapsed time 12\r\n"},"seq":80}
1: (494) 1001: elapsed time 12
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (505) <-1002-enable-pretty-printing\r\n"},"seq":82}
1: (505) <-1002-enable-pretty-printing
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (508) ->1002^done\r\n"},"seq":84}
1: (508) ->1002^done
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (508) ->(gdb)\r\n"},"seq":86}
1: (508) ->(gdb)
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (508) 1002: elapsed time 2\r\n"},"seq":88}
1: (508) 1002: elapsed time 2
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (508) ->&\"\\n\"\r\n"},"seq":90}
1: (508) ->&"\n"
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (508) ->^done\r\n"},"seq":92}
1: (508) ->^done
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (508) ->(gdb)\r\n"},"seq":94}
1: (508) ->(gdb)
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (512) <-1003-interpreter-exec console \"catch throw\"\r\n"},"seq":96}
1: (512) <-1003-interpreter-exec console "catch throw"
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (523) ->~\"Catchpoint 1 (throw)\\n\"\r\n"},"seq":98}
1: (523) ->~"Catchpoint 1 (throw)\n"
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (524) ->=breakpoint-created,bkpt={number=\"1\",type=\"catchpoint\",disp=\"keep\",enabled=\"y\",what=\"exception throw\",catch-type=\"throw\",times=\"0\"}\r\n"},"seq":100}
1: (524) ->=breakpoint-created,bkpt={number="1",type="catchpoint",disp="keep",enabled="y",what="exception throw",catch-type="throw",times="0"}
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (524) ->1003^done\r\n"},"seq":102}
1: (524) ->1003^done
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (524) ->(gdb)\r\n"},"seq":104}
1: (524) ->(gdb)
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (524) ->&\"\\n\"\r\n"},"seq":106}
1: (524) ->&"\n"
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (524) ->^done\r\n"},"seq":108}
1: (524) ->^done
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (524) ->(gdb)\r\n"},"seq":110}
1: (524) ->(gdb)
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (528) 1003: elapsed time 16\r\n"},"seq":112}
1: (528) 1003: elapsed time 16
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (529) <-1004-interpreter-exec console \"set pagination off\"\r\n"},"seq":114}
1: (529) <-1004-interpreter-exec console "set pagination off"
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (539) ->=cmd-param-changed,param=\"pagination\",value=\"off\"\r\n"},"seq":116}
1: (539) ->=cmd-param-changed,param="pagination",value="off"
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (549) ->1004^done\r\n"},"seq":118}
1: (549) ->1004^done
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (549) 1004: elapsed time 20\r\n"},"seq":120}
1: (549) 1004: elapsed time 20
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (549) <-1005-gdb-set auto-solib-add on\r\n"},"seq":122}
1: (549) <-1005-gdb-set auto-solib-add on
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (549) ->(gdb)\r\n"},"seq":124}
1: (549) ->(gdb)
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (549) ->&\"\\n\"\r\n"},"seq":126}
1: (549) ->&"\n"
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (549) ->^done\r\n"},"seq":128}
1: (549) ->^done
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (549) ->(gdb)\r\n"},"seq":130}
1: (549) ->(gdb)
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (555) ->1005^done\r\n"},"seq":132}
1: (555) ->1005^done
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (555) ->(gdb)\r\n"},"seq":134}
1: (555) ->(gdb)
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (555) ->&\"\\n\"\r\n"},"seq":136}
1: (555) ->&"\n"
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (556) ->^done\r\n"},"seq":138}
1: (556) ->^done
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (556) ->(gdb)\r\n"},"seq":140}
1: (556) ->(gdb)
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (555) 1005: elapsed time 6\r\n"},"seq":142}
1: (555) 1005: elapsed time 6
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (556) <-1006-gdb-set solib-search-path C:\\\\Code\\\\AeonGUI\\\\mingw64\\\\bin;\r\n"},"seq":144}
1: (556) <-1006-gdb-set solib-search-path C:\\Code\\AeonGUI\\mingw64\\bin;
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (571) ->1006^done\r\n"},"seq":146}
1: (571) ->1006^done
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (571) ->(gdb)\r\n"},"seq":148}
1: (571) ->(gdb)
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (571) 1006: elapsed time 15\r\n"},"seq":150}
1: (571) 1006: elapsed time 15
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (571) ->&\"\\n\"\r\n"},"seq":152}
1: (571) ->&"\n"
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (572) ->^done\r\n"},"seq":154}
1: (572) ->^done
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (572) ->(gdb)\r\n"},"seq":156}
1: (572) ->(gdb)
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (571) <-1007-environment-cd C:\\\\Code\\\\AeonGUI\\\\mingw64\r\n"},"seq":158}
1: (571) <-1007-environment-cd C:\\Code\\AeonGUI\\mingw64
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (586) ->1007^done\r\n"},"seq":160}
1: (586) ->1007^done
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (586) ->(gdb)\r\n"},"seq":162}
1: (586) ->(gdb)
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (586) ->&\"\\n\"\r\n"},"seq":164}
1: (586) ->&"\n"
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (586) ->^done\r\n"},"seq":166}
1: (586) ->^done
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (587) ->(gdb)\r\n"},"seq":168}
1: (587) ->(gdb)
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (586) 1007: elapsed time 15\r\n"},"seq":170}
1: (586) 1007: elapsed time 15
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (587) <-1008-gdb-set new-console on\r\n"},"seq":172}
1: (587) <-1008-gdb-set new-console on
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (602) ->1008^done\r\n"},"seq":174}
1: (602) ->1008^done
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (602) ->(gdb)\r\n"},"seq":176}
1: (602) ->(gdb)
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (602) 1008: elapsed time 15\r\n"},"seq":178}
1: (602) 1008: elapsed time 15
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (602) ->&\"\\n\"\r\n"},"seq":180}
1: (602) ->&"\n"
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (602) ->^done\r\n"},"seq":182}
1: (602) ->^done
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (602) ->(gdb)\r\n"},"seq":184}
1: (602) ->(gdb)
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (602) <-1009-interpreter-exec console \"show configuration\"\r\n"},"seq":186}
1: (602) <-1009-interpreter-exec console "show configuration"
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (618) ->~\"This GDB was configured as follows:\\n   configure --host=\"\r\n"},"seq":188}
1: (618) ->~"This GDB was configured as follows:\n   configure --host="
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (618) ->~\"x86_64-w64-mingw32 --target=x86_64-w64-mingw32\\n\"\r\n"},"seq":190}
1: (618) ->~"x86_64-w64-mingw32 --target=x86_64-w64-mingw32\n"
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (618) ->~\"             --with-auto-load-dir=$debugdir:$datadir/auto-load\\n             --with-auto-load-safe-path=\"\r\n"},"seq":192}
1: (618) ->~"             --with-auto-load-dir=$debugdir:$datadir/auto-load\n             --with-auto-load-safe-path="
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (618) ->~\"$debugdir:$datadir/auto-load\\n\"\r\n"},"seq":194}
1: (618) ->~"$debugdir:$datadir/auto-load\n"
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (618) ->~\"             --with-expat\\n\"\r\n"},"seq":196}
1: (618) ->~"             --with-expat\n"
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (619) ->~\"             --with-gdb-datadir=/mingw64/share/gdb (relocatable)\\n\"\r\n"},"seq":198}
1: (619) ->~"             --with-gdb-datadir=/mingw64/share/gdb (relocatable)\n"
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (619) ->~\"             --with-jit-reader-dir=/mingw64/lib/gdb (relocatable)\\n\"\r\n"},"seq":200}
1: (619) ->~"             --with-jit-reader-dir=/mingw64/lib/gdb (relocatable)\n"
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (619) ->~\"             --without-libunwind-ia64\\n\"\r\n"},"seq":202}
1: (619) ->~"             --without-libunwind-ia64\n"
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (619) ->~\"             --with-lzma\\n\"\r\n"},"seq":204}
1: (619) ->~"             --with-lzma\n"
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (619) ->~\"             --without-babeltrace\\n\\t\\t\"\r\n"},"seq":206}
1: (619) ->~"             --without-babeltrace\n\t\t"
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (619) ->~\"             --without-intel-pt\\n\"\r\n"},"seq":208}
1: (619) ->~"             --without-intel-pt\n"
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (619) ->~\"             --with-mpfr\\n\"\r\n"},"seq":210}
1: (619) ->~"             --with-mpfr\n"
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (619) ->~\"             --with-xxhash\\n\"\r\n"},"seq":212}
1: (619) ->~"             --with-xxhash\n"
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (619) ->~\"             --with-python=/mingw64 (relocatable)\\n\"\r\n"},"seq":214}
1: (619) ->~"             --with-python=/mingw64 (relocatable)\n"
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (620) ->~\"             --without-guile\\n\"\r\n"},"seq":216}
1: (620) ->~"             --without-guile\n"
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (620) ->~\"             --disable-source-highlight\\n\"\r\n"},"seq":218}
1: (620) ->~"             --disable-source-highlight\n"
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (620) ->~\"             --with-separate-debug-dir=/mingw64/lib/debug (relocatable)\\n\"\r\n"},"seq":220}
1: (620) ->~"             --with-separate-debug-dir=/mingw64/lib/debug (relocatable)\n"
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (620) ->~\"             --with-system-gdbinit=/mingw64/etc/gdbinit (relocatable)\\n\"\r\n"},"seq":222}
1: (620) ->~"             --with-system-gdbinit=/mingw64/etc/gdbinit (relocatable)\n"
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (620) ->~\"\\n(\\\"Relocatable\\\" means the directory can be moved with the GDB installation\\ntree, and GDB will still find it.)\\n\"\r\n"},"seq":224}
1: (620) ->~"\n(\"Relocatable\" means the directory can be moved with the GDB installation\ntree, and GDB will still find it.)\n"
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (620) ->1009^done\r\n"},"seq":226}
1: (620) ->1009^done
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (621) ->(gdb)\r\n"},"seq":228}
1: (621) ->(gdb)
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (621) ->&\"\\n\"\r\n"},"seq":230}
1: (621) ->&"\n"
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (621) ->^done\r\n"},"seq":232}
1: (621) ->^done
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (621) ->(gdb)\r\n"},"seq":234}
1: (621) ->(gdb)
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (621) 1009: elapsed time 18\r\n"},"seq":236}
1: (621) 1009: elapsed time 18
--> E (output): {"type":"event","event":"output","body":{"category":"telemetry","output":"VS/Diagnostics/Debugger/MIEngine/WindowsRuntime","data":{"VS.Diagnostics.Debugger.MIEngine.WindowsRuntime":"MinGW"}},"seq":238}
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (624) <-1010-file-exec-and-symbols C:\\\\Code\\\\AeonGUI\\\\mingw64\\\\bin\\\\OpenGLDemo.exe\r\n"},"seq":240}
1: (624) <-1010-file-exec-and-symbols C:\\Code\\AeonGUI\\mingw64\\bin\\OpenGLDemo.exe
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (927) ->1010^error,msg=\"You can't do that when your target is `exec'\"\r\n"},"seq":242}
1: (927) ->1010^error,msg="You can't do that when your target is `exec'"
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (927) ->(gdb)\r\n"},"seq":244}
1: (927) ->(gdb)
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (927) 1010: elapsed time 303\r\n"},"seq":246}
1: (927) 1010: elapsed time 303
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (927) ->&\"\\n\"\r\n"},"seq":248}
1: (927) ->&"\n"
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (927) ->^done\r\n"},"seq":250}
1: (927) ->^done
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (928) ->(gdb)\r\n"},"seq":252}
1: (928) ->(gdb)
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (935) <--gdb-exit\r\n"},"seq":254}
1: (935) <--gdb-exit
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (935) Send Event AD7MessageEvent\r\n"},"seq":256}
1: (935) Send Event AD7MessageEvent
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (939) <-logout\r\n"},"seq":258}
1: (939) <-logout
--> E (output): {"type":"event","event":"output","body":{"category":"telemetry","output":"VS/Diagnostics/Debugger/Launch","data":{"VS.Diagnostics.Debugger.ImplementationName":"Microsoft.MIDebugEngine","VS.Diagnostics.Debugger.EngineVersion":"16.5.10630.1","VS.Diagnostics.Debugger.HostVersion":"16.5.10630.1","VS.Diagnostics.Debugger.AdapterId":"cppdbg","VS.Diagnostics.Debugger.Launch.ErrorCode":1005,"VS.Diagnostics.Debugger.Launch.IsError":true}},"seq":260}
--> R (launch-2): {"type":"response","request_seq":2,"success":false,"command":"launch","message":"Unable to start debugging. Program path 'C:\\Code\\AeonGUI\\mingw64\\bin\\OpenGLDemo.exe' is missing or invalid.\r\n\r\nGDB failed with message: You can't do that when your target is `exec'\r\n\r\nThis may occur if the process's executable was changed after the process was started, such as when installing an update. Try re-launching the application or restarting the machine.","body":{"error":{"id":1005,"format":"Unable to start debugging. Program path 'C:\\Code\\AeonGUI\\mingw64\\bin\\OpenGLDemo.exe' is missing or invalid.\r\n\r\nGDB failed with message: You can't do that when your target is `exec'\r\n\r\nThis may occur if the process's executable was changed after the process was started, such as when installing an update. Try re-launching the application or restarting the machine."}},"seq":262}
debugger

All 8 comments

The error is:

Unable to start debugging. 
Program path 'C:\\Code\\AeonGUI\\mingw64\\bin\\OpenGLDemo.exe' is missing or invalid.
GDB failed with message: You can't do that when your target is `exec'
This may occur if the process's executable was changed after the process was started, such as when installing an update. Try re-launching the application or restarting the machine.

I just tested with MSYS2 x64
Ran:

pacman -Syu
pacman -Su gdb
pacman -Su gcc

and successfully debugged a simple program.

Couple of questions:

  1. Can you run C:\\Code\\AeonGUI\\mingw64\\bin\\OpenGLDemo.exe from the command line?
  2. Do you have a minimal project that you can share that runs into this issue?

Hi @WardenGnaw ,
Yes, the file exists and runs without issue provided that "C:/Code/AeonGUI/mingw64/bin;C:/msys64/mingw64/bin" is part of the path.

You can test this with my project, AeonGUI

clone it, move to the project root directory then run:

pacman -S --needed --noconfirm mingw-w64-x86_64-make mingw-w64-x86_64-cmake mingw-w64-x86_64-python2 mingw-w64-x86_64-python2-pip flex bison mingw-w64-x86_64-libxml2 mingw-w64-x86_64-zlib mingw-w64-x86_64-libpng mingw-w64-x86_64-cairo mingw-w64-x86_64-v8
mkdir mingw64
cd mingw64
cmake -G"MSYS Makefiles" ..

Then open the folder with vscode, you can build using the build task or from the terminal with make, then run debug on the OpenGLDemo debug target (it is the only one there)

Thanks for looking this up. 馃榿

I'm running into issues building the project:

C:\Users\user\Projects\AeonGUI\build>cmake -G\"MSYS Makefiles\" ..
-- Could NOT find OpenGL (missing: OPENGL_gl_LIBRARY)
-- Could NOT find Freetype (missing: FREETYPE_LIBRARY) (found version "2.10.2")
-- Could NOT find LibXml2 (missing: LIBXML2_LIBRARY) (found version "2.9.10")
-- Parser code will be generated from Flex and Bison code.
-- Build the 'update-parser-code' target if you want to update the pre-generated code.
-- Generating debug launch configuration for OpenGLDemo
-- Up-to-date: C:/Users/user/Projects/AeonGUI/build/share/aeongui/copyright
-- Configuring done
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
FREETYPE_LIBRARY
    linked by target "AeonGUI" in directory C:/Users/user/Projects/AeonGUI/core
LIBXML2_LIBRARY (ADVANCED)
    linked by target "AeonGUI" in directory C:/Users/user/Projects/AeonGUI/core
OPENGL_gl_LIBRARY (ADVANCED)
    linked by target "OpenGLDemo" in directory C:/Users/user/Projects/AeonGUI/demos/OpenGL
OPENGL_glu_LIBRARY (ADVANCED)
    linked by target "OpenGLDemo" in directory C:/Users/user/Projects/AeonGUI/demos/OpenGL

-- Generating done
CMake Generate step failed.  Build files cannot be regenerated correctly.

Are there additional packages that I need to install?

Are there additional packages that I need to install?

It does seem so, sorry:

pacman -S --needed --noconfirm mingw-w64-x86_64-libxml2 mingw-w64-x86_64-freetype

should take care of libxml2 and freetype, but the missing opengl lib is strange, it should be part of the winapi package, try installing freeglut which should have it as a dependency:

pacman -S --needed --noconfirm mingw-w64-x86_64-freeglut

Ok, apparently:

$ pacman -Qo /mingw64/x86_64-w64-mingw32/lib/libopengl32.a
/mingw64/x86_64-w64-mingw32/lib/libopengl32.a is owned by mingw-w64-x86_64-crt-git 8.0.0.5966.f5da805f-1

so the package to install to get OpenGL is mingw-w64-x86_64-crt-git? 馃I never had to manually install it. weird.

Edit:
It may be because you installed gcc (which is msys gcc) and not mingw-w64-x86_64-gcc?
on that note make sure you install mingw-w64-x86_64-gdb as well.

I can also repro this with a simple hello world app.

What I can find so far is that the GDB 9.2 may be missing the load command.

If your GDB does not have a load command, attempting to execute it gets the error message "You can't do that when your target is ..."

Running -file-exec-file ./bin/OpenGLDemo.exe works, but -file-symbol-file ./bin/OpenGLDemo.exe causes the "You can't do that when your target is 'exec'

Without loading the symbols, the debugger does not have the necessary information to show variables, set breakpoints, or show call stack.

This is with:

mingw-w64-x86_64-gcc-10.2.0-3
mingw-w64-x86_64-gdb-9.2-2

Repro steps:
Create a simple hello world app.
Compile g++ -g main.cpp -o a.exe
Debug with gdb --intepreter=mi
and in GDB

-file-exec-and-symbols ./a.exe
^error,msg="You can't do that when your target is `exec'"

This would be a bug for GDB. https://sourceware.org/bugzilla/

I thought that could be a possibility, I'll see what I can find out.

@WardenGnaw seems like it is a known issue and is being fixed at https://github.com/msys2/MINGW-packages/issues/7004,
so I am closing this.

Thank you very much for your help!

Was this page helpful?
0 / 5 - 0 ratings