Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove problematic environment variables from the debugger environment #2442

Closed
camelator opened this issue Mar 18, 2022 · 29 comments · Fixed by #2496
Closed

Remove problematic environment variables from the debugger environment #2442

camelator opened this issue Mar 18, 2022 · 29 comments · Fixed by #2496
Labels
bug a bug in the product Feature: debug/launch
Milestone

Comments

@camelator
Copy link

Brief Issue Summary

From the following page:
https://code.visualstudio.com/docs/cpp/cmake-linux#_create-a-cmake-hello-world-project

after completed all steps, Start DEBUG produces the following errors:
The program '/home/christian/code/cpp/testconst2/build/testconst2' has exited with code 42 (0x0000002a).

ERROR: Unable to start debugging. Unexpected GDB output from command "-interpreter-exec console "set env COMP_WORDBREAKS
"'><=;|&("". Problem parsing arguments: interpreter-exec console "set env COMP_WORDBREAKS

Here is what I've done:

1/ Check environment

11:48:08 |base|christian@ryzen testconst2 → cmake --version
cmake version 3.16.3

CMake suite maintained and supported by Kitware (kitware.com/cmake).
11:50:03 |base|christian@ryzen testconst2 → gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/9/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none:hsa
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 9.4.0-1ubuntu120.04' --with-bugurl=file:///usr/share/doc/gcc-9/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++,gm2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-9 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-9-yTrUTS/gcc-9-9.4.0/debian/tmp-nvptx/usr,hsa --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 9.4.0 (Ubuntu 9.4.0-1ubuntu1
20.04)

2/ Create a CMake project

mkdir cmakeQuickStart
cd cmakeQuickStart
code .

3/ Create a CMake hello world project

Here is cmakelists.txt
cmake_minimum_required(VERSION 3.0.0)
project(quickStart VERSION 0.1.0)

include(CTest)
enable_testing()

add_executable(quickStart main.cpp)

set(CPACK_PROJECT_NAME ${PROJECT_NAME})
set(CPACK_PROJECT_VERSION ${PROJECT_VERSION})
include(CPack)

4/ Configure helloWorld
Done - no issues

5/ Select variant
Debug selected - no issue

6/ CMake configure
Done - no issues

7/ Build hello world
Done - No Issues

[main] Building folder: cmakeQuickStart
[build] Starting build
[proc] Executing command: /usr/bin/cmake --build /home/christian/code/cpp/cmakeQuickStart/build --config Debug --target all -j 18 --
[build] Scanning dependencies of target quickStart
[build] [ 50%] Building CXX object CMakeFiles/quickStart.dir/main.cpp.o
[build] [100%] Linking CXX executable quickStart
[build] [100%] Built target quickStart
[build] Build finished with exit code 0

8/ Debug hello world
In the console log:
ERROR: Undefined command: "". Try "help".
The program '/home/christian/code/cpp/cmakeQuickStart/build/quickStart' has exited with code 42 (0x0000002a).

I found the following in another window:
The program '/home/christian/code/cpp/cmakeQuickStart/build/quickStart' has exited with code 42 (0x0000002a).
ERROR: Unable to start debugging. Unexpected GDB output from command "-interpreter-exec console "set env COMP_WORDBREAKS
"'><=;|&("". Problem parsing arguments: interpreter-exec console "set env COMP_WORDBREAKS

Any help?

@gilanghamidy
Copy link

gilanghamidy commented Mar 19, 2022

I also have the same issue. Reverting to the previous version fixes the problem. I am using Fedora 35 with GCC, LLVM, and CMake toolchain installed from the repo

I pulled my hair for one hour confused why suddenly I cannot do debugging anymore. I thought I changed some config in the PC, but it turned out this extension was updated just few hours before, which breaks debugging -_-

@elahehrashedi elahehrashedi added bug a bug in the product regression used to work and no longer does. Regressions are typically high priority labels Mar 21, 2022
@elahehrashedi
Copy link
Contributor

elahehrashedi commented Mar 22, 2022

I couldn't repro the issue on Linux using version 1.9.2 and 1.10.5. Nothing stood out as to why the debugger wouldn't work.
Can you set "Cmake: logging level" to "debug" and share the output window? That will help us get more info.

image

@bobbrow bobbrow added Feature: debug/launch more info needed More info is needed from the community for us to properly triage and investigate. labels Mar 22, 2022
@gilanghamidy
Copy link

I couldn't repro the issue on Linux using version 1.9.2 and 1.10.5. Nothing stood out as to why the debugger wouldn't work. Can you set "Cmake: logging level" to "debug" and share the output window? That will help us get more info.

image

[proc] Executing command: /usr/lib64/ccache/gdb --version
[proc] Executing command: gdb --version
[main] Debug configuration from cache:
{
   "type":"cppdbg",
   "name":"Debug MyProject",
   "request":"launch",
   "cwd":"/home/gmhmd/Source/MyProject/build",
   "args":[
      
   ],
   "MIMode":"gdb",
   "miDebuggerPath":"gdb",
   "setupCommands":[
      {
         "description":"Enable pretty-printing for gdb",
         "text":"-enable-pretty-printing",
         "ignoreFailures":true
      }
   ],
   "program":"/home/gmhmd/Source/MyProject/build/MyProject"
}


[main] Starting debugger with following configuration. 

{
   "workspace":"file:///home/gmhmd/Source/MyProject",
   "config":{
      "type":"cppdbg",
      "name":"Debug MyProject",
      "request":"launch",
      "cwd":"/home/gmhmd/Source/MyProject/build",
      "args":[
         
      ],
      "MIMode":"gdb",
      "miDebuggerPath":"gdb",
      "setupCommands":[
         {
            "description":"Enable pretty-printing for gdb",
            "text":"-enable-pretty-printing",
            "ignoreFailures":true
         },
         {
            "description":"Set Disassembly Flavor to Intel",
            "text":"-gdb-set disassembly-flavor intel",
            "ignoreFailures":true
         }
      ],
      "program":"/home/gmhmd/Source/MyProject/build/MyProject",
      "stopAtEntry":false,
      "environment":[
         {
            "name":"SHELL",
            "value":"/bin/bash"
         },
         {
            "name":"DOTNET_ROOT",
            "value":"/usr/lib64/dotnet"
         },
         {
            "name":"EDITOR",
            "value":"/usr/bin/nano"
         },
         {
            "name":"PWD",
            "value":"/home/gmhmd"
         },
         {
            "name":"LOGNAME",
            "value":"gmhmd"
         },
         {
            "name":"XDG_SESSION_TYPE",
            "value":"tty"
         },
         {
            "name":"MOTD_SHOWN",
            "value":"pam"
         },
         {
            "name":"HOME",
            "value":"/home/gmhmd"
         },
         {
            "name":"LANG",
            "value":"en_US.UTF-8"
         },
         {
            "name":"VSCODE_AGENT_FOLDER",
            "value":"/home/gmhmd/.vscode-server"
         },
         {
            "name":"SSH_CONNECTION",
            "value":"10.45.103.128 64255 134.58.39.68 22"
         },
         {
            "name":"DOTNET_BUNDLE_EXTRACT_BASE_DIR",
            "value":"/home/gmhmd/.cache/dotnet_bundle_extract"
         },
         {
            "name":"MOZ_GMP_PATH",
            "value":"/usr/lib64/mozilla/plugins/gmp-gmpopenh264/system-installed"
         },
         {
            "name":"XDG_SESSION_CLASS",
            "value":"user"
         },
         {
            "name":"SELINUX_ROLE_REQUESTED",
            "value":""
         },
         {
            "name":"LESSOPEN",
            "value":"||/usr/bin/lesspipe.sh %s"
         },
         {
            "name":"USER",
            "value":"gmhmd"
         },
         {
            "name":"SELINUX_USE_CURRENT_RANGE",
            "value":""
         },
         {
            "name":"SHLVL",
            "value":"1"
         },
         {
            "name":"XDG_SESSION_ID",
            "value":"33"
         },
         {
            "name":"XDG_RUNTIME_DIR",
            "value":"/run/user/1000"
         },
         {
            "name":"SSH_CLIENT",
            "value":"10.45.103.128 64255 22"
         },
         {
            "name":"DEBUGINFOD_URLS",
            "value":"https://debuginfod.fedoraproject.org/ "
         },
         {
            "name":"which_declare",
            "value":"declare -f"
         },
         {
            "name":"KDEDIRS",
            "value":"/usr"
         },
         {
            "name":"XDG_DATA_DIRS",
            "value":"/home/gmhmd/.local/share/flatpak/exports/share:/var/lib/flatpak/exports/share:/usr/local/share:/usr/share:/var/lib/snapd/desktop"
         },
         {
            "name":"PATH",
            "value":"/home/gmhmd/.vscode-server/bin/c722ca6c7eed3d7987c0d5c3df5c45f6b15e77d1/bin/remote-cli:/home/gmhmd/.local/bin:/home/gmhmd/bin:/usr/lib64/ccache:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/home/gmhmd/.dotnet/tools:/var/lib/snapd/snap/bin:/home/gmhmd/bin/arcanist/bin:/home/gmhmd/bin/arcanist/bin"
         },
         {
            "name":"SELINUX_LEVEL_REQUESTED",
            "value":""
         },
         {
            "name":"DBUS_SESSION_BUS_ADDRESS",
            "value":"unix:path=/run/user/1000/bus"
         },
         {
            "name":"GTX_USE_PORTAL",
            "value":"1"
         },
         {
            "name":"BASH_FUNC_which%%",
            "value":"() {  ( alias;\n eval ${which_declare} ) | /usr/bin/which --tty-only --read-alias --read-functions --show-tilde --show-dot \"$@\"\n}"
         },
         {
            "name":"_",
            "value":"/home/gmhmd/.vscode-server/bin/c722ca6c7eed3d7987c0d5c3df5c45f6b15e77d1/node"
         },
         {
            "name":"HISTCONTROL",
            "value":"ignoredups"
         },
         {
            "name":"HISTSIZE",
            "value":"1000"
         },
         {
            "name":"HOSTNAME",
            "value":"heliosky"
         },
         {
            "name":"MAIL",
            "value":"/var/spool/mail/gmhmd"
         },
         {
            "name":"VSCODE_LOG_NATIVE",
            "value":"false"
         },
         {
            "name":"VSCODE_AMD_ENTRYPOINT",
            "value":"vs/workbench/api/node/extensionHostProcess"
         },
         {
            "name":"VSCODE_PIPE_LOGGING",
            "value":"true"
         },
         {
            "name":"VSCODE_VERBOSE_LOGGING",
            "value":"true"
         },
         {
            "name":"VSCODE_EXTHOST_WILL_SEND_SOCKET",
            "value":"true"
         },
         {
            "name":"VSCODE_HANDLES_UNCAUGHT_ERRORS",
            "value":"true"
         },
         {
            "name":"VSCODE_LOG_STACK",
            "value":"false"
         },
         {
            "name":"VSCODE_NLS_CONFIG",
            "value":"{\"locale\":\"en\",\"availableLanguages\":{}}"
         },
         {
            "name":"BROWSER",
            "value":"/home/gmhmd/.vscode-server/bin/c722ca6c7eed3d7987c0d5c3df5c45f6b15e77d1/bin/helpers/browser.sh"
         },
         {
            "name":"VSCODE_CWD",
            "value":"/home/gmhmd"
         },
         {
            "name":"VSCODE_IPC_HOOK_CLI",
            "value":"/run/user/1000/vscode-ipc-da7bbb1b-91fd-4cea-ad62-238c8a4d43a3.sock"
         },
         {
            "name":"APPLICATION_INSIGHTS_NO_DIAGNOSTIC_CHANNEL",
            "value":"1"
         }
      ],
      "externalConsole":false
   },
   "environment":[
      {
         "name":"SHELL",
         "value":"/bin/bash"
      },
      {
         "name":"DOTNET_ROOT",
         "value":"/usr/lib64/dotnet"
      },
      {
         "name":"EDITOR",
         "value":"/usr/bin/nano"
      },
      {
         "name":"PWD",
         "value":"/home/gmhmd"
      },
      {
         "name":"LOGNAME",
         "value":"gmhmd"
      },
      {
         "name":"XDG_SESSION_TYPE",
         "value":"tty"
      },
      {
         "name":"MOTD_SHOWN",
         "value":"pam"
      },
      {
         "name":"HOME",
         "value":"/home/gmhmd"
      },
      {
         "name":"LANG",
         "value":"en_US.UTF-8"
      },
      {
         "name":"VSCODE_AGENT_FOLDER",
         "value":"/home/gmhmd/.vscode-server"
      },
      {
         "name":"SSH_CONNECTION",
         "value":"10.45.103.128 64255 134.58.39.68 22"
      },
      {
         "name":"DOTNET_BUNDLE_EXTRACT_BASE_DIR",
         "value":"/home/gmhmd/.cache/dotnet_bundle_extract"
      },
      {
         "name":"MOZ_GMP_PATH",
         "value":"/usr/lib64/mozilla/plugins/gmp-gmpopenh264/system-installed"
      },
      {
         "name":"XDG_SESSION_CLASS",
         "value":"user"
      },
      {
         "name":"SELINUX_ROLE_REQUESTED",
         "value":""
      },
      {
         "name":"LESSOPEN",
         "value":"||/usr/bin/lesspipe.sh %s"
      },
      {
         "name":"USER",
         "value":"gmhmd"
      },
      {
         "name":"SELINUX_USE_CURRENT_RANGE",
         "value":""
      },
      {
         "name":"SHLVL",
         "value":"1"
      },
      {
         "name":"XDG_SESSION_ID",
         "value":"33"
      },
      {
         "name":"XDG_RUNTIME_DIR",
         "value":"/run/user/1000"
      },
      {
         "name":"SSH_CLIENT",
         "value":"10.45.103.128 64255 22"
      },
      {
         "name":"DEBUGINFOD_URLS",
         "value":"https://debuginfod.fedoraproject.org/ "
      },
      {
         "name":"which_declare",
         "value":"declare -f"
      },
      {
         "name":"KDEDIRS",
         "value":"/usr"
      },
      {
         "name":"XDG_DATA_DIRS",
         "value":"/home/gmhmd/.local/share/flatpak/exports/share:/var/lib/flatpak/exports/share:/usr/local/share:/usr/share:/var/lib/snapd/desktop"
      },
      {
         "name":"PATH",
         "value":"/home/gmhmd/.vscode-server/bin/c722ca6c7eed3d7987c0d5c3df5c45f6b15e77d1/bin/remote-cli:/home/gmhmd/.local/bin:/home/gmhmd/bin:/usr/lib64/ccache:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/home/gmhmd/.dotnet/tools:/var/lib/snapd/snap/bin:/home/gmhmd/bin/arcanist/bin:/home/gmhmd/bin/arcanist/bin"
      },
      {
         "name":"SELINUX_LEVEL_REQUESTED",
         "value":""
      },
      {
         "name":"DBUS_SESSION_BUS_ADDRESS",
         "value":"unix:path=/run/user/1000/bus"
      },
      {
         "name":"GTX_USE_PORTAL",
         "value":"1"
      },
      {
         "name":"BASH_FUNC_which%%",
         "value":"() {  ( alias;\n eval ${which_declare} ) | /usr/bin/which --tty-only --read-alias --read-functions --show-tilde --show-dot \"$@\"\n}"
      },
      {
         "name":"_",
         "value":"/home/gmhmd/.vscode-server/bin/c722ca6c7eed3d7987c0d5c3df5c45f6b15e77d1/node"
      },
      {
         "name":"HISTCONTROL",
         "value":"ignoredups"
      },
      {
         "name":"HISTSIZE",
         "value":"1000"
      },
      {
         "name":"HOSTNAME",
         "value":"heliosky"
      },
      {
         "name":"MAIL",
         "value":"/var/spool/mail/gmhmd"
      },
      {
         "name":"VSCODE_LOG_NATIVE",
         "value":"false"
      },
      {
         "name":"VSCODE_AMD_ENTRYPOINT",
         "value":"vs/workbench/api/node/extensionHostProcess"
      },
      {
         "name":"VSCODE_PIPE_LOGGING",
         "value":"true"
      },
      {
         "name":"VSCODE_VERBOSE_LOGGING",
         "value":"true"
      },
      {
         "name":"VSCODE_EXTHOST_WILL_SEND_SOCKET",
         "value":"true"
      },
      {
         "name":"VSCODE_HANDLES_UNCAUGHT_ERRORS",
         "value":"true"
      },
      {
         "name":"VSCODE_LOG_STACK",
         "value":"false"
      },
      {
         "name":"VSCODE_NLS_CONFIG",
         "value":"{\"locale\":\"en\",\"availableLanguages\":{}}"
      },
      {
         "name":"BROWSER",
         "value":"/home/gmhmd/.vscode-server/bin/c722ca6c7eed3d7987c0d5c3df5c45f6b15e77d1/bin/helpers/browser.sh"
      },
      {
         "name":"VSCODE_CWD",
         "value":"/home/gmhmd"
      },
      {
         "name":"VSCODE_IPC_HOOK_CLI",
         "value":"/run/user/1000/vscode-ipc-da7bbb1b-91fd-4cea-ad62-238c8a4d43a3.sock"
      },
      {
         "name":"APPLICATION_INSIGHTS_NO_DIAGNOSTIC_CHANNEL",
         "value":"1"
      }
   ]
}

[extension] [6030] cmake.debugTarget finished (returned undefined)

I see no meaningful error. This is from the debug window

ERROR: Unable to start debugging. Unexpected GDB output from command "-interpreter-exec console "set env BASH_FUNC_which%% () {  ( alias;
 eval ${which_declare} ) | /usr/bin/which --tty-only --read-alias --read-functions --show-tilde --show-dot \"$@\"
}"". Problem parsing arguments: interpreter-exec console "set env BASH_FUNC_which%% () {  ( alias;
ERROR: Undefined command: "".  Try "help".

@bobbrow
Copy link
Member

bobbrow commented Mar 23, 2022

Super helpful, thanks! The problem is with this environment variable in your shell:

      {
         "name":"BASH_FUNC_which%%",
         "value":"() {  ( alias;\n eval ${which_declare} ) | /usr/bin/which --tty-only --read-alias --read-functions --show-tilde --show-dot \"$@\"\n}"
      },

The debugger is trying to set that variable to establish the environment, but there seems to be a problem with the way it's fed in. The workaround is to remove that variable from your shell before launching VS Code. We could probably add some code to detect and remove this specific one so that you wouldn't have to do this forever.

@elahehrashedi elahehrashedi removed the regression used to work and no longer does. Regressions are typically high priority label Mar 23, 2022
@bobbrow
Copy link
Member

bobbrow commented Mar 23, 2022

Possibly related: #1841

@camelator
Copy link
Author

camelator commented Mar 23, 2022

Here is the log .
ps: I am on Ubuntu 20.04
I have conda installed and oh my bash

[variant] Loaded new set of variants
[kit] Successfully loaded 4 kits from /home/christian/.local/share/CMakeTools/cmake-tools-kits.json
[proc] Executing command: /usr/bin/gcc -v
[cmakefileapi-driver] This version of CMake does not support the "toolchains" object kind. Compiler paths will be determined by reading CMakeCache.txt.
[extension] [6181] cmake.debugTarget started
[main] Configuring folder: cmakeQuickStart
[main] Saving open files before configure/build
[driver] Start configure
[driver] Running pre-configure checks and steps
[driver] Using compilers in GCC 9.4.0 x86_64-linux-gnu for configure
[cmakefileapi-driver] Configuring using kit
[cmakefileapi-driver] Invoking CMake /usr/bin/cmake with arguments ["--no-warn-unused-cli","-DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE","-DCMAKE_BUILD_TYPE:STRING=Debug","-DCMAKE_C_COMPILER:FILEPATH=/usr/bin/gcc","-DCMAKE_CXX_COMPILER:FILEPATH=/usr/bin/g++","-S/home/christian/code/cpp/cmakeQuickStart","-B/home/christian/code/cpp/cmakeQuickStart/build","-G","Unix Makefiles"]
[proc] Executing command: /usr/bin/cmake --no-warn-unused-cli -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -DCMAKE_BUILD_TYPE:STRING=Debug -DCMAKE_C_COMPILER:FILEPATH=/usr/bin/gcc -DCMAKE_CXX_COMPILER:FILEPATH=/usr/bin/g++ -S/home/christian/code/cpp/cmakeQuickStart -B/home/christian/code/cpp/cmakeQuickStart/build -G "Unix Makefiles"
[cmake] Not searching for unused variables given on the command line.
[cmake] -- Configuring done
[cmake] -- Generating done
[cmake] -- Build files have been written to: /home/christian/code/cpp/cmakeQuickStart/build
[cmakefileapi-parser] Read reply folder: /home/christian/code/cpp/cmakeQuickStart/build/.cmake/api/v1/reply
[cmakefileapi-parser] Found index files: ["cache-v2-fbbbfe7ec7a074fbf226.json","codemodel-v2-64d45892afcd1ec06655.json","index-2022-03-23T17-05-10-0471.json","target-Continuous-Debug-ccb7ffa9978a17909427.json","target-ContinuousBuild-Debug-fbe5c6f13f9d0b0fda7f.json","target-ContinuousConfigure-Debug-e50d85f92dff45137d08.json","target-ContinuousCoverage-Debug-8e77c9844717b5d78f1d.json","target-ContinuousMemCheck-Debug-6dc397776ac62b583443.json","target-ContinuousStart-Debug-e5333a93d322bdca7e2c.json","target-ContinuousSubmit-Debug-4fa6b21fb7b292361882.json","target-ContinuousTest-Debug-568a9c9a705921553383.json","target-ContinuousUpdate-Debug-64371bec26c652a83b2a.json","target-Experimental-Debug-9dd5df03d773a90f3c92.json","target-ExperimentalBuild-Debug-73bb360ec85e77324b07.json","target-ExperimentalConfigure-Debug-16d715fabac2df4f738b.json","target-ExperimentalCoverage-Debug-84b4a72b86a74a7b0c74.json","target-ExperimentalMemCheck-Debug-e2a5c5b061800616824e.json","target-ExperimentalStart-Debug-7113052b00f034005848.json","target-ExperimentalSubmit-Debug-5845b4f637743a5446be.json","target-ExperimentalTest-Debug-46e37abeefe8d5146a50.json","target-ExperimentalUpdate-Debug-88df2b117e6a7cd48b33.json","target-Nightly-Debug-cea50abb2f464ca0229a.json","target-NightlyBuild-Debug-afccd0465e4b8c1e2d87.json","target-NightlyConfigure-Debug-7ec533b122c4c2965696.json","target-NightlyCoverage-Debug-e2b20065ab4aa5f75d86.json","target-NightlyMemCheck-Debug-8eda9eba68978ec4ed5b.json","target-NightlyMemoryCheck-Debug-784f4a2876bbb9b4bcea.json","target-NightlyStart-Debug-87062bf9eaacc239a2bf.json","target-NightlySubmit-Debug-00614dd8d283eaa542b9.json","target-NightlyTest-Debug-b8d330abdb63439bfe9e.json","target-NightlyUpdate-Debug-b681408b94dc782d2255.json","target-quickStart-Debug-05953e8c6d2963a2831f.json"]
[cache] Reading CMake cache file /home/christian/code/cpp/cmakeQuickStart/build/CMakeCache.txt
[cache] Parsing CMake cache string
[main] Building folder: cmakeQuickStart quickStart
[main] Saving open files before configure/build
[build] Starting build
[driver] Start build quickStart
[proc] Executing command: /usr/bin/cmake --build /home/christian/code/cpp/cmakeQuickStart/build --config Debug --target quickStart -j 18 --
[build] [100%] Built target quickStart
[cmakefileapi-parser] Read reply folder: /home/christian/code/cpp/cmakeQuickStart/build/.cmake/api/v1/reply
[cmakefileapi-parser] Found index files: ["cache-v2-fbbbfe7ec7a074fbf226.json","codemodel-v2-64d45892afcd1ec06655.json","index-2022-03-23T17-05-10-0471.json","target-Continuous-Debug-ccb7ffa9978a17909427.json","target-ContinuousBuild-Debug-fbe5c6f13f9d0b0fda7f.json","target-ContinuousConfigure-Debug-e50d85f92dff45137d08.json","target-ContinuousCoverage-Debug-8e77c9844717b5d78f1d.json","target-ContinuousMemCheck-Debug-6dc397776ac62b583443.json","target-ContinuousStart-Debug-e5333a93d322bdca7e2c.json","target-ContinuousSubmit-Debug-4fa6b21fb7b292361882.json","target-ContinuousTest-Debug-568a9c9a705921553383.json","target-ContinuousUpdate-Debug-64371bec26c652a83b2a.json","target-Experimental-Debug-9dd5df03d773a90f3c92.json","target-ExperimentalBuild-Debug-73bb360ec85e77324b07.json","target-ExperimentalConfigure-Debug-16d715fabac2df4f738b.json","target-ExperimentalCoverage-Debug-84b4a72b86a74a7b0c74.json","target-ExperimentalMemCheck-Debug-e2a5c5b061800616824e.json","target-ExperimentalStart-Debug-7113052b00f034005848.json","target-ExperimentalSubmit-Debug-5845b4f637743a5446be.json","target-ExperimentalTest-Debug-46e37abeefe8d5146a50.json","target-ExperimentalUpdate-Debug-88df2b117e6a7cd48b33.json","target-Nightly-Debug-cea50abb2f464ca0229a.json","target-NightlyBuild-Debug-afccd0465e4b8c1e2d87.json","target-NightlyConfigure-Debug-7ec533b122c4c2965696.json","target-NightlyCoverage-Debug-e2b20065ab4aa5f75d86.json","target-NightlyMemCheck-Debug-8eda9eba68978ec4ed5b.json","target-NightlyMemoryCheck-Debug-784f4a2876bbb9b4bcea.json","target-NightlyStart-Debug-87062bf9eaacc239a2bf.json","target-NightlySubmit-Debug-00614dd8d283eaa542b9.json","target-NightlyTest-Debug-b8d330abdb63439bfe9e.json","target-NightlyUpdate-Debug-b681408b94dc782d2255.json","target-quickStart-Debug-05953e8c6d2963a2831f.json"]
[build] Build finished with exit code 0
[cache] Reading CMake cache file /home/christian/code/cpp/cmakeQuickStart/build/CMakeCache.txt
[cache] Parsing CMake cache string
[cache] Reading CMake cache file /home/christian/code/cpp/cmakeQuickStart/build/CMakeCache.txt
[cache] Parsing CMake cache string
[proc] Executing command: /usr/bin/gdb --version
[main] Debug configuration from cache: {"type":"cppdbg","name":"Debug quickStart","request":"launch","cwd":"/home/christian/code/cpp/cmakeQuickStart/build","args":[],"MIMode":"gdb","miDebuggerPath":"/usr/bin/gdb","setupCommands":[{"description":"Enable pretty-printing for gdb","text":"-enable-pretty-printing","ignoreFailures":true}],"program":"/home/christian/code/cpp/cmakeQuickStart/build/quickStart"}
[main] Starting debugger with following configuration. {"workspace":"file:///home/christian/code/cpp/cmakeQuickStart","config":{"type":"cppdbg","name":"Debug quickStart","request":"launch","cwd":"/home/christian/code/cpp/cmakeQuickStart/build","args":[],"MIMode":"gdb","miDebuggerPath":"/usr/bin/gdb","setupCommands":[{"description":"Enable pretty-printing for gdb","text":"-enable-pretty-printing","ignoreFailures":true}],"program":"/home/christian/code/cpp/cmakeQuickStart/build/quickStart","environment":[{"name":"ELECTRON_RUN_AS_NODE","value":"1"},{"name":"GJS_DEBUG_TOPICS","value":"JS ERROR;JS LOG"},{"name":"CONDA_PROMPT_MODIFIER","value":"(base) "},{"name":"USER","value":"christian"},{"name":"SSH_AGENT_PID","value":"2504"},{"name":"XDG_SESSION_TYPE","value":"x11"},{"name":"SHLVL","value":"0"},{"name":"HOME","value":"/home/christian"},{"name":"CONDA_SHLVL","value":"1"},{"name":"DESKTOP_SESSION","value":"ubuntu"},{"name":"GIO_LAUNCHED_DESKTOP_FILE","value":"/usr/share/applications/code.desktop"},{"name":"GTK_MODULES","value":"gail:atk-bridge"},{"name":"GNOME_SHELL_SESSION_MODE","value":"ubuntu"},{"name":"MANAGERPID","value":"2281"},{"name":"DBUS_SESSION_BUS_ADDRESS","value":"unix:path=/run/user/1000/bus"},{"name":"IM_CONFIG_CHECK_ENV","value":"1"},{"name":"CE_M","value":""},{"name":"GIO_LAUNCHED_DESKTOP_FILE_PID","value":"887305"},{"name":"IM_CONFIG_PHASE","value":"1"},{"name":"LOGNAME","value":"christian"},{"name":"OSH","value":"/home/christian/.oh-my-bash"},{"name":"","value":"/usr/share/code/code"},{"name":"JOURNAL_STREAM","value":"8:1975704"},{"name":"XDG_SESSION_CLASS","value":"user"},{"name":"USERNAME","value":"christian"},{"name":"GNOME_DESKTOP_SESSION_ID","value":"this-is-deprecated"},{"name":"_CE_CONDA","value":""},{"name":"WINDOWPATH","value":"2"},{"name":"PATH","value":"/home/christian/.local/bin:/home/christian/bin:/home/christian/.local/bin:/home/christian/bin:/home/christian/miniconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/opt/toolchains/csky_toolchain/bin:/opt/toolchains/csky_toolchain/bin"},{"name":"SESSION_MANAGER","value":"local/ryzen:@/tmp/.ICE-unix/91429,unix/ryzen:/tmp/.ICE-unix/91429"},{"name":"INVOCATION_ID","value":"19133cb810aa4746835b2b91ee17eb77"},{"name":"XDG_RUNTIME_DIR","value":"/run/user/1000"},{"name":"XDG_MENU_PREFIX","value":"gnome-"},{"name":"DISPLAY","value":":0"},{"name":"LANG","value":"fr_FR.UTF-8"},{"name":"XDG_CURRENT_DESKTOP","value":"Unity"},{"name":"XAUTHORITY","value":"/run/user/1000/gdm/Xauthority"},{"name":"XDG_SESSION_DESKTOP","value":"ubuntu"},{"name":"XMODIFIERS","value":"@im=ibus"},{"name":"CONDA_PYTHON_EXE","value":"/home/christian/miniconda3/bin/python"},{"name":"SSH_AUTH_SOCK","value":"/run/user/1000/keyring/ssh"},{"name":"SHELL","value":"/bin/bash"},{"name":"QT_ACCESSIBILITY","value":"1"},{"name":"GDMSESSION","value":"ubuntu"},{"name":"CONDA_DEFAULT_ENV","value":"base"},{"name":"GPG_AGENT_INFO","value":"/run/user/1000/gnupg/S.gpg-agent:0:1"},{"name":"GJS_DEBUG_OUTPUT","value":"stderr"},{"name":"QT_IM_MODULE","value":"ibus"},{"name":"PWD","value":"/home/christian"},{"name":"XDG_DATA_DIRS","value":"/usr/share/ubuntu:/home/christian/.local/share/flatpak/exports/share:/var/lib/flatpak/exports/share:/usr/local/share/:/usr/share/:/var/lib/snapd/desktop"},{"name":"CONDA_EXE","value":"/home/christian/miniconda3/bin/conda"},{"name":"XDG_CONFIG_DIRS","value":"/etc/xdg/xdg-ubuntu:/etc/xdg"},{"name":"CONDA_PREFIX","value":"/home/christian/miniconda3"},{"name":"CHROME_DESKTOP","value":"code-url-handler.desktop"},{"name":"ORIGINAL_XDG_CURRENT_DESKTOP","value":"ubuntu:GNOME"},{"name":"VSCODE_CWD","value":"/home/christian"},{"name":"GDK_BACKEND","value":"x11"},{"name":"VSCODE_NLS_CONFIG","value":"{"locale":"fr","availableLanguages":{},"_languagePackSupport":true}"},{"name":"VSCODE_CODE_CACHE_PATH","value":"/home/christian/.config/Code/CachedData/c722ca6c7eed3d7987c0d5c3df5c45f6b15e77d1"},{"name":"VSCODE_IPC_HOOK","value":"/run/user/1000/vscode-9a47d4eb-1.65.2-main.sock"},{"name":"VSCODE_PID","value":"887305"},{"name":"LSCOLORS","value":"Gxfxcxdxdxegedabagacad"},{"name":"LESS","value":"-R"},{"name":"LS_COLORS","value":""},{"name":"COMP_WORDBREAKS","value":" \t\n"'><=;|&("},{"name":"LESSCLOSE","value":"/usr/bin/lesspipe %s %s"},{"name":"LESSOPEN","value":"| /usr/bin/lesspipe %s"},{"name":"PAGER","value":"less"},{"name":"LC_CTYPE","value":"fr_FR.UTF-8"},{"name":"HISTIGNORE","value":"&:[ ]:exit:ls:bg:fg:history:clear"},{"name":"VSCODE_AMD_ENTRYPOINT","value":"vs/workbench/api/node/extensionHostProcess"},{"name":"VSCODE_PIPE_LOGGING","value":"true"},{"name":"VSCODE_VERBOSE_LOGGING","value":"true"},{"name":"VSCODE_LOG_NATIVE","value":"false"},{"name":"VSCODE_IPC_HOOK_EXTHOST","value":"/run/user/1000/vscode-ipc-09ec4515-20f0-4044-8e37-197c4c1f637d.sock"},{"name":"VSCODE_HANDLES_UNCAUGHT_ERRORS","value":"true"},{"name":"VSCODE_LOG_STACK","value":"false"},{"name":"APPLICATION_INSIGHTS_NO_DIAGNOSTIC_CHANNEL","value":"1"},{"name":"PLATFORMIO_CALLER","value":"vscode"},{"name":"PLATFORMIO_IDE","value":"2.4.3"},{"name":"PLATFORMIO_PATH","value":"/home/christian/.platformio/penv/bin:/home/christian/.platformio/penv:/home/christian/.platformio/python3/bin:/home/christian/.local/bin:/home/christian/bin:/home/christian/.local/bin:/home/christian/bin:/home/christian/miniconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/opt/toolchains/csky_toolchain/bin:/opt/toolchains/csky_toolchain/bin"},{"name":"NO_PROXY","value":"127.0.0.1"}]},"environment":[{"name":"ELECTRON_RUN_AS_NODE","value":"1"},{"name":"GJS_DEBUG_TOPICS","value":"JS ERROR;JS LOG"},{"name":"CONDA_PROMPT_MODIFIER","value":"(base) "},{"name":"USER","value":"christian"},{"name":"SSH_AGENT_PID","value":"2504"},{"name":"XDG_SESSION_TYPE","value":"x11"},{"name":"SHLVL","value":"0"},{"name":"HOME","value":"/home/christian"},{"name":"CONDA_SHLVL","value":"1"},{"name":"DESKTOP_SESSION","value":"ubuntu"},{"name":"GIO_LAUNCHED_DESKTOP_FILE","value":"/usr/share/applications/code.desktop"},{"name":"GTK_MODULES","value":"gail:atk-bridge"},{"name":"GNOME_SHELL_SESSION_MODE","value":"ubuntu"},{"name":"MANAGERPID","value":"2281"},{"name":"DBUS_SESSION_BUS_ADDRESS","value":"unix:path=/run/user/1000/bus"},{"name":"IM_CONFIG_CHECK_ENV","value":"1"},{"name":"CE_M","value":""},{"name":"GIO_LAUNCHED_DESKTOP_FILE_PID","value":"887305"},{"name":"IM_CONFIG_PHASE","value":"1"},{"name":"LOGNAME","value":"christian"},{"name":"OSH","value":"/home/christian/.oh-my-bash"},{"name":"","value":"/usr/share/code/code"},{"name":"JOURNAL_STREAM","value":"8:1975704"},{"name":"XDG_SESSION_CLASS","value":"user"},{"name":"USERNAME","value":"christian"},{"name":"GNOME_DESKTOP_SESSION_ID","value":"this-is-deprecated"},{"name":"_CE_CONDA","value":""},{"name":"WINDOWPATH","value":"2"},{"name":"PATH","value":"/home/christian/.local/bin:/home/christian/bin:/home/christian/.local/bin:/home/christian/bin:/home/christian/miniconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/opt/toolchains/csky_toolchain/bin:/opt/toolchains/csky_toolchain/bin"},{"name":"SESSION_MANAGER","value":"local/ryzen:@/tmp/.ICE-unix/91429,unix/ryzen:/tmp/.ICE-unix/91429"},{"name":"INVOCATION_ID","value":"19133cb810aa4746835b2b91ee17eb77"},{"name":"XDG_RUNTIME_DIR","value":"/run/user/1000"},{"name":"XDG_MENU_PREFIX","value":"gnome-"},{"name":"DISPLAY","value":":0"},{"name":"LANG","value":"fr_FR.UTF-8"},{"name":"XDG_CURRENT_DESKTOP","value":"Unity"},{"name":"XAUTHORITY","value":"/run/user/1000/gdm/Xauthority"},{"name":"XDG_SESSION_DESKTOP","value":"ubuntu"},{"name":"XMODIFIERS","value":"@im=ibus"},{"name":"CONDA_PYTHON_EXE","value":"/home/christian/miniconda3/bin/python"},{"name":"SSH_AUTH_SOCK","value":"/run/user/1000/keyring/ssh"},{"name":"SHELL","value":"/bin/bash"},{"name":"QT_ACCESSIBILITY","value":"1"},{"name":"GDMSESSION","value":"ubuntu"},{"name":"CONDA_DEFAULT_ENV","value":"base"},{"name":"GPG_AGENT_INFO","value":"/run/user/1000/gnupg/S.gpg-agent:0:1"},{"name":"GJS_DEBUG_OUTPUT","value":"stderr"},{"name":"QT_IM_MODULE","value":"ibus"},{"name":"PWD","value":"/home/christian"},{"name":"XDG_DATA_DIRS","value":"/usr/share/ubuntu:/home/christian/.local/share/flatpak/exports/share:/var/lib/flatpak/exports/share:/usr/local/share/:/usr/share/:/var/lib/snapd/desktop"},{"name":"CONDA_EXE","value":"/home/christian/miniconda3/bin/conda"},{"name":"XDG_CONFIG_DIRS","value":"/etc/xdg/xdg-ubuntu:/etc/xdg"},{"name":"CONDA_PREFIX","value":"/home/christian/miniconda3"},{"name":"CHROME_DESKTOP","value":"code-url-handler.desktop"},{"name":"ORIGINAL_XDG_CURRENT_DESKTOP","value":"ubuntu:GNOME"},{"name":"VSCODE_CWD","value":"/home/christian"},{"name":"GDK_BACKEND","value":"x11"},{"name":"VSCODE_NLS_CONFIG","value":"{"locale":"fr","availableLanguages":{},"_languagePackSupport":true}"},{"name":"VSCODE_CODE_CACHE_PATH","value":"/home/christian/.config/Code/CachedData/c722ca6c7eed3d7987c0d5c3df5c45f6b15e77d1"},{"name":"VSCODE_IPC_HOOK","value":"/run/user/1000/vscode-9a47d4eb-1.65.2-main.sock"},{"name":"VSCODE_PID","value":"887305"},{"name":"LSCOLORS","value":"Gxfxcxdxdxegedabagacad"},{"name":"LESS","value":"-R"},{"name":"LS_COLORS","value":""},{"name":"COMP_WORDBREAKS","value":" \t\n"'><=;|&("},{"name":"LESSCLOSE","value":"/usr/bin/lesspipe %s %s"},{"name":"LESSOPEN","value":"| /usr/bin/lesspipe %s"},{"name":"PAGER","value":"less"},{"name":"LC_CTYPE","value":"fr_FR.UTF-8"},{"name":"HISTIGNORE","value":"&:[ ]:exit:ls:bg:fg:history:clear"},{"name":"VSCODE_AMD_ENTRYPOINT","value":"vs/workbench/api/node/extensionHostProcess"},{"name":"VSCODE_PIPE_LOGGING","value":"true"},{"name":"VSCODE_VERBOSE_LOGGING","value":"true"},{"name":"VSCODE_LOG_NATIVE","value":"false"},{"name":"VSCODE_IPC_HOOK_EXTHOST","value":"/run/user/1000/vscode-ipc-09ec4515-20f0-4044-8e37-197c4c1f637d.sock"},{"name":"VSCODE_HANDLES_UNCAUGHT_ERRORS","value":"true"},{"name":"VSCODE_LOG_STACK","value":"false"},{"name":"APPLICATION_INSIGHTS_NO_DIAGNOSTIC_CHANNEL","value":"1"},{"name":"PLATFORMIO_CALLER","value":"vscode"},{"name":"PLATFORMIO_IDE","value":"2.4.3"},{"name":"PLATFORMIO_PATH","value":"/home/christian/.platformio/penv/bin:/home/christian/.platformio/penv:/home/christian/.platformio/python3/bin:/home/christian/.local/bin:/home/christian/bin:/home/christian/.local/bin:/home/christian/bin:/home/christian/miniconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/opt/toolchains/csky_toolchain/bin:/opt/toolchains/csky_toolchain/bin"},{"name":"NO_PROXY","value":"127.0.0.1"}]}
[extension] [6181] cmake.debugTarget finished (returned undefined)

@gilanghamidy
Copy link

gilanghamidy commented Mar 23, 2022

Super helpful, thanks! The problem is with this environment variable in your shell:

      {
         "name":"BASH_FUNC_which%%",
         "value":"() {  ( alias;\n eval ${which_declare} ) | /usr/bin/which --tty-only --read-alias --read-functions --show-tilde --show-dot \"$@\"\n}"
      },

The debugger is trying to set that variable to establish the environment, but there seems to be a problem with the way it's fed in. The workaround is to remove that variable from your shell before launching VS Code. We could probably add some code to detect and remove this specific one so that you wouldn't have to do this forever.

Hehe thanks. I don't even understand what is the purpose of that shell script lol. I suppose if you create a handler to remove the specific one would be counterproductive, since it would not handle other cases, no? Why don't you just test if some environment variable is problematic and discard that when setting the environment for the debugger? Just a suggestion though. I have no idea how VSCode extension works in behind hahaha.

Oh and the thing is that in the previous version before the update few days ago, everything works fine. So perhaps you added some new code in it that makes it breaks

@bobbrow bobbrow removed the more info needed More info is needed from the community for us to properly triage and investigate. label Mar 28, 2022
@bobbrow bobbrow added this to the On Deck milestone Mar 28, 2022
@bobbrow bobbrow changed the title "Get started with CMake Tools on Linux" does not work Remove problematic environment variables from the debugger environment Mar 28, 2022
@GongT
Copy link

GongT commented Mar 31, 2022

Please fix this! It's super hard to do something before launch vscode when using remote SSH target.

but I have a small question: why environments need to restore🤔.
I'd like to see a "hide user environments during configure/build/test" feature

@bobbrow
Copy link
Member

bobbrow commented Mar 31, 2022

why environments need to restore🤔.

Good question. @WardenGnaw, can you help answer? I actually am thinking that a fix for this needs to be in the debugger, not CMake Tools. We don't do anything special besides tell the debugger to launch with a supplied configuration or some default config. We don't currently do anything to the environment beforehand.

@WardenGnaw
Copy link
Member

Who is providing this "environment" entry to the configuration? This is invalid JSON

{
   "name":"COMP_WORDBREAKS",
   "value":" \t\n"'><=;|&("
}

The debugger takes the provided configuration and tries to set the environments requested in the launch.json, but due to the request GDB returns a response that the debug adapter does not understand since the double quotes are not escaped.

@bobbrow
Copy link
Member

bobbrow commented Apr 1, 2022

That looks like a logging issue. The debugger does not read this as json. The problem is actually with values that have a ${...} in them. I found the spot in our code where we can filter them out though.

@bobbrow
Copy link
Member

bobbrow commented Apr 13, 2022

The fix for this will be available in tomorrow's pre-release: 1.11.10

@bobbrow
Copy link
Member

bobbrow commented Apr 14, 2022

The fix is available. If you go to the extensions page and right click on CMake Tools, you can select "Switch to Pre-Release Version" from the menu.
image

@pantonox
Copy link

I can install and reload but after installation of version 1.11.10 the CMake 'explorer menu' is empty. Reverting to the stable release restores the correct view.

1.11.10

image

1.10.5

image

@bobbrow
Copy link
Member

bobbrow commented Apr 19, 2022

@pantonox Is this for just a simple project? I do not reproduce the problem in 1.11.10. Have you run the configure command yet? The project outline tab does not populate until after the project has been configured. If you could please open a new issue and share the logs requested by the issue template, we can investigate further.

@OliverHaag
Copy link

Pre-Release fixes the BASH_FUNC_which%% problem, but has issues with the multiline scl command of rh/centos (aka BASH_FUNC_scl%%).

The profile.d file for it:

scl()
{
if [ "$1" = "load" -o "$1" = "unload" ]; then
# It is possible that function module is not declared in time of this
# declaration so eval is used instead of direct calling of function module
    eval "module $@"
else
   /usr/bin/scl "$@"
fi
}

shell=`/bin/basename \`/bin/ps -p $$ -ocomm=\``
[ "$shell" = "bash" ] && export -f scl # export -f works only in bash

MODULESHOME=/usr/share/Modules
export MODULESHOME

if [ "${MODULEPATH:-}" = "" ]; then
   MODULEPATH=`sed -n 's/[   #].*$//; /./H; $ { x; s/^\n//; s/\n/:/g; p; }' ${MODULESHOME}/init/.modulespath`
fi

MODULEPATH=/etc/scl/modulefiles:$MODULEPATH

export MODULEPATH

@bobbrow
Copy link
Member

bobbrow commented Apr 19, 2022

@OliverHaag is this a new problem, or just something that the fix for this issue didn't cover?

@OliverHaag
Copy link

@OliverHaag is this a new problem, or just something that the fix for this issue didn't cover?

As far as I can see it is the problem described above. Seems the fix didn't cover all cases, so the issue should be reopened.

@bobbrow
Copy link
Member

bobbrow commented Apr 19, 2022

Can you gather and share the cpptools logs as described here so we can analyze the pattern? #2442 (comment)

The profile.d contains more than what I would expect to see in the value.

@OliverHaag
Copy link

Hi Bob,

here's the log, with project-specific stuff that shouldn't matter replaced by ...:

[proc] Executing command: /opt/rh/gcc-toolset-11/root/bin/gdb --version
[main] Debug configuration from cache: {"type":"cppdbg","name":"Debug daemon","request":"launch","cwd":"...","args":[],"MIMode":"gdb","miDebuggerPath":"/opt/rh/gcc-toolset-11/root/bin/gdb","setupCommands":[{"description":"Enable pretty-printing for gdb","text":"-enable-pretty-printing","ignoreFailures":true}],"program":"..."}
[main] Starting debugger with following configuration. {"workspace":"...","config":{"type":"cppdbg","name":"Debug daemon","request":"launch","cwd":"${command:cmake.buildDirectory}","args":["-c"],"MIMode":"gdb","miDebuggerPath":"/opt/rh/gcc-toolset-11/root/bin/gdb","setupCommands":[{"description":"Enable pretty-printing for gdb","text":"-enable-pretty-printing","ignoreFailures":true}],"program":"...","environment":[{"name":"DISPLAY","value":":99"},{"name":"HTTP_PROXY","value":"..."},{"name":"HOSTNAME","value":""},{"name":"CUDAHOSTCXX","value":"/usr/local/bin/clang++-12-toolset-11"},{"name":"CUDAFLAGS","value":"-allow-unsupported-compiler"},{"name":"CFLAGS","value":"--gcc-toolchain=/opt/rh/gcc-toolset-11/root/usr -march=x86-64-v3 -maes -msse4.2"},{"name":"NVIDIA_VISIBLE_DEVICES","value":"all"},{"name":"CC","value":"/usr/bin/clang-12"},{"name":"container","value":"oci"},{"name":"CXXFLAGS","value":"--gcc-toolchain=/opt/rh/gcc-toolset-11/root/usr --stdlib=libstdc++ -march=x86-64-v3 -maes -msse4.2"},{"name":"PWD","value":"/vscode/vscode-server/bin/linux-x64/dfd34e8260c270da74b5c2d86d61aee4b6d56977"},{"name":"HOME","value":"/root"},{"name":"https_proxy","value":"..."},{"name":"http_proxy","value":"..."},{"name":"no_proxy","value":"..."},{"name":"NO_PROXY","value":"..."},{"name":"HTTPS_PROXY","value":"..."},{"name":"CXX","value":"/usr/bin/clang++-12"},{"name":"SHELL","value":"/bin/bash"},{"name":"NVIDIA_DRIVER_CAPABILITIES","value":"compute,utility"},{"name":"SHLVL","value":"2"},{"name":"NVIDIA_REQUIRE_CUDA","value":"cuda>=11.0 brand=tesla,driver>=418,driver<419 brand=tesla,driver>=440,driver<441"},{"name":"VSCODE_AGENT_FOLDER","value":"/root/.vscode-server"},{"name":"PATH","value":"/vscode/vscode-server/bin/linux-x64/dfd34e8260c270da74b5c2d86d61aee4b6d56977/bin/remote-cli:/usr/share/Modules/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/root/bin"},{"name":"_","value":"/usr/bin/cat"},{"name":"VSCODE_LOG_NATIVE","value":"false"},{"name":"VSCODE_AMD_ENTRYPOINT","value":"vs/workbench/api/node/extensionHostProcess"},{"name":"VSCODE_PIPE_LOGGING","value":"true"},{"name":"VSCODE_VERBOSE_LOGGING","value":"true"},{"name":"VSCODE_EXTHOST_WILL_SEND_SOCKET","value":"true"},{"name":"VSCODE_HANDLES_UNCAUGHT_ERRORS","value":"true"},{"name":"VSCODE_LOG_STACK","value":"false"},{"name":"VSCODE_NLS_CONFIG","value":"{\"locale\":\"en\",\"availableLanguages\":{}}"},{"name":"MODULES_RUN_QUARANTINE","value":"LD_LIBRARY_PATH LD_PRELOAD"},{"name":"LANG","value":"C.utf8"},{"name":"HISTCONTROL","value":"ignoredups"},{"name":"REMOTE_CONTAINERS_SOCKETS","value":"[\"/tmp/vscode-ssh-auth-476bf6d7fa12eb99d7ea86a76bc937b219e3d795.sock\",\"/root/.gnupg/S.gpg-agent\"]"},{"name":"which_declare","value":"declare -f"},{"name":"MODULES_CMD","value":"/usr/share/Modules/libexec/modulecmd.tcl"},{"name":"USER","value":"root"},{"name":"REMOTE_CONTAINERS_IPC","value":"/tmp/vscode-remote-containers-ipc-476bf6d7fa12eb99d7ea86a76bc937b219e3d795.sock"},{"name":"LOADEDMODULES","value":""},{"name":"MAIL","value":"/var/spool/mail/root"},{"name":"MANPATH","value":":"},{"name":"MODULEPATH","value":"/usr/share/Modules/modulefiles:/etc/modulefiles:/usr/share/modulefiles"},{"name":"LOGNAME","value":"root"},{"name":"MODULEPATH_modshare","value":"/usr/share/modulefiles:1:/usr/share/Modules/modulefiles:1:/etc/modulefiles:1"},{"name":"MODULESHOME","value":"/usr/share/Modules"},{"name":"HISTSIZE","value":"1000"},{"name":"LESSOPEN","value":"||/usr/bin/lesspipe.sh %s"},{"name":"BASH_FUNC_ml%%","value":"() {  module ml \"$@\"\n}"},{"name":"SSH_AUTH_SOCK","value":"/tmp/vscode-ssh-auth-476bf6d7fa12eb99d7ea86a76bc937b219e3d795.sock"},{"name":"REMOTE_CONTAINERS","value":"true"},{"name":"LOCAL_WORKSPACE_FOLDER","value":"..."},{"name":"BROWSER","value":"/vscode/vscode-server/bin/linux-x64/dfd34e8260c270da74b5c2d86d61aee4b6d56977/bin/helpers/browser.sh"},{"name":"VSCODE_CWD","value":"/vscode/vscode-server/bin/linux-x64/dfd34e8260c270da74b5c2d86d61aee4b6d56977"},{"name":"VSCODE_IPC_HOOK_CLI","value":"/tmp/vscode-ipc-e125d980-6acc-4c0e-9896-11e582b76d24.sock"},{"name":"APPLICATION_INSIGHTS_NO_DIAGNOSTIC_CHANNEL","value":"1"}]},"environment":[{"name":"DISPLAY","value":":99"},{"name":"HTTP_PROXY","value":"..."},{"name":"HOSTNAME","value":""},{"name":"CUDAHOSTCXX","value":"/usr/local/bin/clang++-12-toolset-11"},{"name":"CUDAFLAGS","value":"-allow-unsupported-compiler"},{"name":"CFLAGS","value":"--gcc-toolchain=/opt/rh/gcc-toolset-11/root/usr -march=x86-64-v3 -maes -msse4.2"},{"name":"NVIDIA_VISIBLE_DEVICES","value":"all"},{"name":"CC","value":"/usr/bin/clang-12"},{"name":"container","value":"oci"},{"name":"CXXFLAGS","value":"--gcc-toolchain=/opt/rh/gcc-toolset-11/root/usr --stdlib=libstdc++ -march=x86-64-v3 -maes -msse4.2"},{"name":"PWD","value":"/vscode/vscode-server/bin/linux-x64/dfd34e8260c270da74b5c2d86d61aee4b6d56977"},{"name":"HOME","value":"/root"},{"name":"https_proxy","value":"..."},{"name":"http_proxy","value":"..."},{"name":"no_proxy","value":"..."},{"name":"NO_PROXY","value":"..."},{"name":"HTTPS_PROXY","value":"..."},{"name":"CXX","value":"/usr/bin/clang++-12"},{"name":"SHELL","value":"/bin/bash"},{"name":"NVIDIA_DRIVER_CAPABILITIES","value":"compute,utility"},{"name":"SHLVL","value":"2"},{"name":"NVIDIA_REQUIRE_CUDA","value":"cuda>=11.0 brand=tesla,driver>=418,driver<419 brand=tesla,driver>=440,driver<441"},{"name":"VSCODE_AGENT_FOLDER","value":"/root/.vscode-server"},{"name":"PATH","value":"/vscode/vscode-server/bin/linux-x64/dfd34e8260c270da74b5c2d86d61aee4b6d56977/bin/remote-cli:/usr/share/Modules/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/root/bin"},{"name":"_","value":"/usr/bin/cat"},{"name":"VSCODE_LOG_NATIVE","value":"false"},{"name":"VSCODE_AMD_ENTRYPOINT","value":"vs/workbench/api/node/extensionHostProcess"},{"name":"VSCODE_PIPE_LOGGING","value":"true"},{"name":"VSCODE_VERBOSE_LOGGING","value":"true"},{"name":"VSCODE_EXTHOST_WILL_SEND_SOCKET","value":"true"},{"name":"VSCODE_HANDLES_UNCAUGHT_ERRORS","value":"true"},{"name":"VSCODE_LOG_STACK","value":"false"},{"name":"VSCODE_NLS_CONFIG","value":"{\"locale\":\"en\",\"availableLanguages\":{}}"},{"name":"MODULES_RUN_QUARANTINE","value":"LD_LIBRARY_PATH LD_PRELOAD"},{"name":"LANG","value":"C.utf8"},{"name":"HISTCONTROL","value":"ignoredups"},{"name":"REMOTE_CONTAINERS_SOCKETS","value":"[\"/tmp/vscode-ssh-auth-476bf6d7fa12eb99d7ea86a76bc937b219e3d795.sock\",\"/root/.gnupg/S.gpg-agent\"]"},{"name":"which_declare","value":"declare -f"},{"name":"MODULES_CMD","value":"/usr/share/Modules/libexec/modulecmd.tcl"},{"name":"USER","value":"root"},{"name":"REMOTE_CONTAINERS_IPC","value":"/tmp/vscode-remote-containers-ipc-476bf6d7fa12eb99d7ea86a76bc937b219e3d795.sock"},{"name":"LOADEDMODULES","value":""},{"name":"MAIL","value":"/var/spool/mail/root"},{"name":"MANPATH","value":":"},{"name":"MODULEPATH","value":"/usr/share/Modules/modulefiles:/etc/modulefiles:/usr/share/modulefiles"},{"name":"LOGNAME","value":"root"},{"name":"MODULEPATH_modshare","value":"/usr/share/modulefiles:1:/usr/share/Modules/modulefiles:1:/etc/modulefiles:1"},{"name":"MODULESHOME","value":"/usr/share/Modules"},{"name":"HISTSIZE","value":"1000"},{"name":"LESSOPEN","value":"||/usr/bin/lesspipe.sh %s"},{"name":"BASH_FUNC_ml%%","value":"() {  module ml \"$@\"\n}"},{"name":"SSH_AUTH_SOCK","value":"/tmp/vscode-ssh-auth-476bf6d7fa12eb99d7ea86a76bc937b219e3d795.sock"},{"name":"REMOTE_CONTAINERS","value":"true"},{"name":"LOCAL_WORKSPACE_FOLDER","value":"..."},{"name":"BROWSER","value":"/vscode/vscode-server/bin/linux-x64/dfd34e8260c270da74b5c2d86d61aee4b6d56977/bin/helpers/browser.sh"},{"name":"VSCODE_CWD","value":"/vscode/vscode-server/bin/linux-x64/dfd34e8260c270da74b5c2d86d61aee4b6d56977"},{"name":"VSCODE_IPC_HOOK_CLI","value":"/tmp/vscode-ipc-e125d980-6acc-4c0e-9896-11e582b76d24.sock"},{"name":"APPLICATION_INSIGHTS_NO_DIAGNOSTIC_CHANNEL","value":"1"}]}
[extension] [7888] cmake.buildDirectory started
[extension] [7888] cmake.buildDirectory finished (returned "...")
[extension] [9680] cmake.debugTarget finished (returned undefined)

Ends with:
cmake_error
Seems to me the function is cut off after $@\".

@bobbrow
Copy link
Member

bobbrow commented Apr 21, 2022

Thanks! This is perfect. We'll get a fix out soon.

@derekwisong
Copy link

derekwisong commented May 14, 2022

Debugger fails to start for me on Fedora 36.
CmakeTools v1.10.5
vscode 1.67.1

ERROR: Unable to start debugging. Unexpected GDB output from command "-interpreter-exec console "set env BASH_FUNC_which%% () {  ( alias;
 eval ${which_declare} ) | /usr/bin/which --tty-only --read-alias --read-functions --show-tilde --show-dot $@
}"". Problem parsing arguments: interpreter-exec console "set env BASH_FUNC_which%% () {  ( alias;
ERROR: Undefined command: "".  Try "help".

It works if i roll back to 1.9

Looks like this is fixed in #2518

@bobbrow
Copy link
Member

bobbrow commented May 16, 2022

@derekwisong the fix is available if you switch to the pre-release version of CMake Tools. You can do this in the Extensions panel in VS Code.

@keegandent
Copy link

keegandent commented May 17, 2022

I also seem to be encountering an issue with the debugging environment variables on RHEL 7.9, but it's complaining particularly about BASH_FUNC_module(). It is worth mentioning I am (not by personal choice) using Environment Modules to provide GCC, etc. The preview version does not appear to resolve this issue, and it seems very closely related to this.

image

Formatted:

BASH_FUNC_module() () {
    unset _mlshdbg
    if [ "${MODULES_SILENT_SHELL_DEBUG:-0}" = '1' ]; then
        case "$-" in
        *v*x*)
            set +vx
            _mlshdbg='vx'
            ;;
        *v*)
            set +v
            _mlshdbg='v'
            ;;
        *x*)
            set +x
            _mlshdbg='x'
            ;;
        *)
            _mlshdbg=''
            ;;
        esac
    fi
    unset _mlre _mlIFS
    if [ -n "${IFS+x}" ]; then
        _mlIFS=$IFS
    fi
    IFS=' '
    for _mlv in ${MODULES_RUN_QUARANTINE:-}; do
        if [ "${_mlv}" = "${_mlv##*[!A-Za-z0-9_]}" -a "${_mlv}" = "${_mlv#[0-9]}" ]; then
            if [ -n "$(eval 'echo ${'$_mlv'+x}')" ]; then
                _mlre="${_mlre:-}${_mlv}_modquar='$(eval 'echo ${'$_mlv'}')' "
            fi
            _mlrv="MODULES_RUNENV_${_mlv}"
            _mlre="${_mlre:-}${_mlv}='$(eval 'echo ${'$_mlrv':-}')' "
        fi
    done
    if [ -n "${_mlre:-}" ]; then
        eval $(eval ${_mlre}/usr/bin/tclsh /cm/local/apps/environment-modules/4.4.0/libexec/modulecmd.tcl bash '"$@"')
    else
        eval $(/usr/bin/tclsh /cm/local/apps/environment-modules/4.4.0/libexec/modulecmd.tcl bash "$@")
    fi
    _mlstatus=$?
    if [ -n "${_mlIFS+x}" ]; then
        IFS=$_mlIFS
    else
        unset IFS
    fi
    unset _mlre _mlv _mlrv _mlIFS
    if [ -n "${_mlshdbg:-}" ]; then
        set -$_mlshdbg
    fi
    unset _mlshdbg
    return $_mlstatus
}

Full Log:

[cache] Reading CMake cache file /home2/kdent/workspace/foo/build/CMakeCache.txt
[cache] Parsing CMake cache string
[proc] Executing command: /cm/local/apps/gcc/9.2.0/bin/gdb --version
[proc] Executing command: gdb --version
[main] Debug configuration from cache:
{
    "type":"cppdbg",
    "name":"Debug foo",
    "request":"launch",
    "cwd":"/home2/kdent/workspace/foo/build",
    "args":[],
    "MIMode":"gdb",
    "miDebuggerPath":"gdb",
    "setupCommands":[
        {
            "description":"Enable pretty-printing for gdb",
            "text":"-enable-pretty-printing","ignoreFailures":true
        }
    ],
    "program":"/home2/kdent/workspace/foo/build/foo"
}
[main] Starting debugger with following configuration.
{
    "workspace": "file:///home2/kdent/workspace/foo",
    "config": {
        "type": "cppdbg",
        "name": "Debug foo",
        "request": "launch",
        "cwd": "/home2/kdent/workspace/foo/build",
        "args": [],
        "MIMode": "gdb",
        "miDebuggerPath": "gdb",
        "setupCommands": [
            {
                "description": "Enable pretty-printing for gdb",
                "text": "-enable-pretty-printing",
                "ignoreFailures": true
            }
        ],
        "program": "/home2/kdent/workspace/foo/build/foo",
        "environment": [
            {
                "name": "GIT_EXEC_PATH_modshare",
                "value": "/cm/shared/apps/git/2.28.0/libexec/git-core:1"
            },
            {
                "name": "MANPATH",
                "value": "/cm/shared/apps/cmake/3.18.4/man:/cm/local/apps/environment-modules/4.4.0//share/man:/usr/local/share/man:/usr/share/man/overrides:/usr/share/man:/cm/local/apps/environment-modules/current/share/man:/cm/local/apps/environment-modules/current/share/man"
            },
            {
                "name": "XDG_SESSION_ID",
                "value": "40754"
            },
            {
                "name": "_LMFILES__modshare",
                "value": "/cm/shared/modulefiles/gdb/8.3.1:1:/cm/shared/modulefiles/cmake/3.18.4:1:/cm/shared/modulefiles/qtcreator/5.12.9:1:/cm/shared/modulefiles/anaconda/5.2.0/py3.6:1:/cm/shared/modulefiles/llvm/14:1:/cm/local/modulefiles/gcc/9.2.0:1:/cm/shared/modulefiles/git/2.28.0:1"
            },
            {
                "name": "MODULES_CMD",
                "value": "/cm/local/apps/environment-modules/4.4.0/libexec/modulecmd.tcl"
            },
            {
                "name": "SHELL",
                "value": "/bin/bash"
            },
            {
                "name": "SSH_CLIENT",
                "value": "RE.DA.CT.ED 49381 22"
            },
            {
                "name": "USER",
                "value": "kdent"
            },
            {
                "name": "LD_LIBRARY_PATH",
                "value": "/cm/shared/apps/qt/5.12.9/Tools/QtCreator/lib/qtcreator:/cm/local/apps/gcc/9.2.0/lib:/cm/local/apps/gcc/9.2.0/lib64"
            },
            {
                "name": "ENV",
                "value": "/cm/local/apps/environment-modules/4.4.0//init/profile.sh"
            },
            {
                "name": "VSCODE_AGENT_FOLDER",
                "value": "/home2/kdent/.vscode-server"
            },
            {
                "name": "MODULES_LMCONFLICT",
                "value": "anaconda/5.2.0/py3.6&anaconda"
            },
            {
                "name": "MAIL",
                "value": "/var/spool/mail/kdent"
            },
            {
                "name": "PATH",
                "value": "/home2/kdent/.vscode-server/bin/da15b6fd3ef856477bf6f4fb29ba1b7af717770d/bin/remote-cli:/cm/shared/apps/llvm/14/build/bin:/cm/shared/apps/qt/5.12.9/Tools/QtCreator/bin:/opt/anaconda/5.2.0/py3.6/bin:/cm/shared/apps/cmake/3.18.4/bin:/cm/shared/apps/git/2.28.0/bin:/cm/shared/apps/gdb/8.3.1/bin:/cm/local/apps/gcc/9.2.0/bin:/cm/local/apps/environment-modules/4.4.0//bin:/usr/local/bin:/usr/bin:/sbin:/usr/sbin:/cm/local/apps/environment-modules/4.4.0/bin:/usr/local/sbin:/home2/kdent/.local/bin:/home2/kdent/bin"
            },
            {
                "name": "PWD",
                "value": "/home2/kdent"
            },
            {
                "name": "_LMFILES_",
                "value": "/cm/local/modulefiles/gcc/9.2.0:/cm/shared/modulefiles/gdb/8.3.1:/cm/shared/modulefiles/git/2.28.0:/cm/shared/modulefiles/cmake/3.18.4:/cm/shared/modulefiles/anaconda/5.2.0/py3.6:/cm/shared/modulefiles/qtcreator/5.12.9:/cm/shared/modulefiles/llvm/14"
            },
            {
                "name": "LANG",
                "value": "en_US.UTF-8"
            },
            {
                "name": "MODULEPATH",
                "value": "/cm/local/modulefiles:/cm/shared/modulefiles"
            },
            {
                "name": "LOADEDMODULES",
                "value": "gcc/9.2.0:gdb/8.3.1:git/2.28.0:cmake/3.18.4:anaconda/5.2.0/py3.6:qtcreator/5.12.9:llvm/14"
            },
            {
                "name": "ENABLE_LMOD",
                "value": "0"
            },
            {
                "name": "MODULES_LMCONFLICT_modshare",
                "value": "anaconda/5.2.0/py3.6&anaconda:1"
            },
            {
                "name": "PATH_modshare",
                "value": "/cm/local/apps/environment-modules/4.4.0//bin:1:/usr/bin:1:/usr/local/bin:1:/opt/anaconda/5.2.0/py3.6/bin:1:/cm/local/apps/environment-modules/4.4.0/bin:1:/cm/shared/apps/git/2.28.0/bin:1:/cm/shared/apps/cmake/3.18.4/bin:1:/cm/shared/apps/gdb/8.3.1/bin:1:/sbin:1:/cm/shared/apps/qt/5.12.9/Tools/QtCreator/bin:1:/usr/sbin:1:/cm/shared/apps/llvm/14/build/bin:1:/cm/local/apps/gcc/9.2.0/bin:1"
            },
            {
                "name": "SHLVL",
                "value": "4"
            },
            {
                "name": "HOME",
                "value": "/home2/kdent"
            },
            {
                "name": "MANPATH_modshare",
                "value": "/usr/local/share/man:1:/usr/share/man/overrides:1:/cm/local/apps/environment-modules/4.4.0//share/man:1:/cm/local/apps/environment-modules/current/share/man:1:/cm/shared/apps/cmake/3.18.4/man:1:/usr/share/man:1"
            },
            {
                "name": "BASH_ENV",
                "value": "/cm/local/apps/environment-modules/4.4.0//init/bash"
            },
            {
                "name": "LOGNAME",
                "value": "kdent"
            },
            {
                "name": "LD_LIBRARY_PATH_modshare",
                "value": "/cm/local/apps/gcc/9.2.0/lib:1:/cm/shared/apps/qt/5.12.9/Tools/QtCreator/lib/qtcreator:1:/cm/local/apps/gcc/9.2.0/lib64:1"
            },
            {
                "name": "XDG_DATA_DIRS",
                "value": "/home2/kdent/.local/share/flatpak/exports/share:/var/lib/flatpak/exports/share:/usr/local/share:/usr/share"
            },
            {
                "name": "SSH_CONNECTION",
                "value": "RE.DA.CT.ED 49381 RE.DA.CT.ED 22"
            },
            {
                "name": "MODULESHOME",
                "value": "/cm/local/apps/environment-modules/4.4.0/"
            },
            {
                "name": "LESSOPEN",
                "value": "||/usr/bin/lesspipe.sh %s"
            },
            {
                "name": "LOADEDMODULES_modshare",
                "value": "gdb/8.3.1:1:cmake/3.18.4:1:qtcreator/5.12.9:1:anaconda/5.2.0/py3.6:1:llvm/14:1:gcc/9.2.0:1:git/2.28.0:1"
            },
            {
                "name": "XDG_RUNTIME_DIR",
                "value": "/run/user/1734230487"
            },
            {
                "name": "DISPLAY",
                "value": "localhost:12.0"
            },
            {
                "name": "GIT_EXEC_PATH",
                "value": "/cm/shared/apps/git/2.28.0/libexec/git-core"
            },
            {
                "name": "BASH_FUNC_module()",
                "value": "() {  unset _mlshdbg;\n if [ \"${MODULES_SILENT_SHELL_DEBUG:-0}\" = '1' ]; then\n case \"$-\" in \n *v*x*)\n set +vx;\n _mlshdbg='vx'\n ;;\n *v*)\n set +v;\n _mlshdbg='v'\n ;;\n *x*)\n set +x;\n _mlshdbg='x'\n ;;\n *)\n _mlshdbg=''\n ;;\n esac;\n fi;\n unset _mlre _mlIFS;\n if [ -n \"${IFS+x}\" ]; then\n _mlIFS=$IFS;\n fi;\n IFS=' ';\n for _mlv in ${MODULES_RUN_QUARANTINE:-};\n do\n if [ \"${_mlv}\" = \"${_mlv##*[!A-Za-z0-9_]}\" -a \"${_mlv}\" = \"${_mlv#[0-9]}\" ]; then\n if [ -n \"`eval 'echo ${'$_mlv'+x}'`\" ]; then\n _mlre=\"${_mlre:-}${_mlv}_modquar='`eval 'echo ${'$_mlv'}'`' \";\n fi;\n _mlrv=\"MODULES_RUNENV_${_mlv}\";\n _mlre=\"${_mlre:-}${_mlv}='`eval 'echo ${'$_mlrv':-}'`' \";\n fi;\n done;\n if [ -n \"${_mlre:-}\" ]; then\n eval `eval ${_mlre}/usr/bin/tclsh /cm/local/apps/environment-modules/4.4.0/libexec/modulecmd.tcl bash '\"$@\"'`;\n else\n eval `/usr/bin/tclsh /cm/local/apps/environment-modules/4.4.0/libexec/modulecmd.tcl bash \"$@\"`;\n fi;\n _mlstatus=$?;\n if [ -n \"${_mlIFS+x}\" ]; then\n IFS=$_mlIFS;\n else\n unset IFS;\n fi;\n unset _mlre _mlv _mlrv _mlIFS;\n if [ -n \"${_mlshdbg:-}\" ]; then\n set -$_mlshdbg;\n fi;\n unset _mlshdbg;\n return $_mlstatus\n}"
            },
            {
                "name": "BASH_FUNC_switchml()",
                "value": "() {  typeset swfound=1;\n if [ \"${MODULES_USE_COMPAT_VERSION:-0}\" = '1' ]; then\n typeset swname='main';\n if [ -e /cm/local/apps/environment-modules/4.4.0//libexec/modulecmd.tcl ]; then\n typeset swfound=0;\n unset MODULES_USE_COMPAT_VERSION;\n fi;\n else\n typeset swname='compatibility';\n if [ -e /cm/local/apps/environment-modules/4.4.0//libexec/modulecmd-compat ]; then\n typeset swfound=0;\n MODULES_USE_COMPAT_VERSION=1;\n export MODULES_USE_COMPAT_VERSION;\n fi;\n fi;\n if [ $swfound -eq 0 ]; then\n echo \"Switching to Modules $swname version\";\n source /cm/local/apps/environment-modules/4.4.0//init/bash;\n else\n echo \"Cannot switch to Modules $swname version, command not found\";\n return 1;\n fi\n}"
            },
            {
                "name": "_",
                "value": "/home2/kdent/.vscode-server/bin/da15b6fd3ef856477bf6f4fb29ba1b7af717770d/node"
            },
            {
                "name": "VSCODE_HANDLES_SIGPIPE",
                "value": "true"
            },
            {
                "name": "HOSTNAME",
                "value": "REDACTED"
            },
            {
                "name": "HISTSIZE",
                "value": "1000"
            },
            {
                "name": "HISTCONTROL",
                "value": "ignoredups"
            },
            {
                "name": "VSCODE_LOG_NATIVE",
                "value": "false"
            },
            {
                "name": "VSCODE_AMD_ENTRYPOINT",
                "value": "vs/workbench/api/node/extensionHostProcess"
            },
            {
                "name": "VSCODE_PIPE_LOGGING",
                "value": "true"
            },
            {
                "name": "VSCODE_VERBOSE_LOGGING",
                "value": "true"
            },
            {
                "name": "VSCODE_EXTHOST_WILL_SEND_SOCKET",
                "value": "true"
            },
            {
                "name": "VSCODE_HANDLES_UNCAUGHT_ERRORS",
                "value": "true"
            },
            {
                "name": "VSCODE_LOG_STACK",
                "value": "false"
            },
            {
                "name": "VSCODE_NLS_CONFIG",
                "value": "{\"locale\":\"en\",\"availableLanguages\":{}}"
            },
            {
                "name": "BROWSER",
                "value": "/home2/kdent/.vscode-server/bin/da15b6fd3ef856477bf6f4fb29ba1b7af717770d/bin/helpers/browser.sh"
            },
            {
                "name": "VSCODE_CWD",
                "value": "/home2/kdent"
            },
            {
                "name": "VSCODE_IPC_HOOK_CLI",
                "value": "/run/user/1734230487/vscode-ipc-206df298-1246-4c83-b6ed-66ba60a54d0d.sock"
            },
            {
                "name": "APPLICATION_INSIGHTS_NO_DIAGNOSTIC_CHANNEL",
                "value": "true"
            }
        ]
    },
    "environment": [
        {
            "name": "GIT_EXEC_PATH_modshare",
            "value": "/cm/shared/apps/git/2.28.0/libexec/git-core:1"
        },
        {
            "name": "MANPATH",
            "value": "/cm/shared/apps/cmake/3.18.4/man:/cm/local/apps/environment-modules/4.4.0//share/man:/usr/local/share/man:/usr/share/man/overrides:/usr/share/man:/cm/local/apps/environment-modules/current/share/man:/cm/local/apps/environment-modules/current/share/man"
        },
        {
            "name": "XDG_SESSION_ID",
            "value": "40754"
        },
        {
            "name": "_LMFILES__modshare",
            "value": "/cm/shared/modulefiles/gdb/8.3.1:1:/cm/shared/modulefiles/cmake/3.18.4:1:/cm/shared/modulefiles/qtcreator/5.12.9:1:/cm/shared/modulefiles/anaconda/5.2.0/py3.6:1:/cm/shared/modulefiles/llvm/14:1:/cm/local/modulefiles/gcc/9.2.0:1:/cm/shared/modulefiles/git/2.28.0:1"
        },
        {
            "name": "MODULES_CMD",
            "value": "/cm/local/apps/environment-modules/4.4.0/libexec/modulecmd.tcl"
        },
        {
            "name": "SHELL",
            "value": "/bin/bash"
        },
        {
            "name": "SSH_CLIENT",
            "value": "RE.DA.CT.ED 49381 22"
        },
        {
            "name": "USER",
            "value": "kdent"
        },
        {
            "name": "LD_LIBRARY_PATH",
            "value": "/cm/shared/apps/qt/5.12.9/Tools/QtCreator/lib/qtcreator:/cm/local/apps/gcc/9.2.0/lib:/cm/local/apps/gcc/9.2.0/lib64"
        },
        {
            "name": "ENV",
            "value": "/cm/local/apps/environment-modules/4.4.0//init/profile.sh"
        },
        {
            "name": "VSCODE_AGENT_FOLDER",
            "value": "/home2/kdent/.vscode-server"
        },
        {
            "name": "MODULES_LMCONFLICT",
            "value": "anaconda/5.2.0/py3.6&anaconda"
        },
        {
            "name": "MAIL",
            "value": "/var/spool/mail/kdent"
        },
        {
            "name": "PATH",
            "value": "/home2/kdent/.vscode-server/bin/da15b6fd3ef856477bf6f4fb29ba1b7af717770d/bin/remote-cli:/cm/shared/apps/llvm/14/build/bin:/cm/shared/apps/qt/5.12.9/Tools/QtCreator/bin:/opt/anaconda/5.2.0/py3.6/bin:/cm/shared/apps/cmake/3.18.4/bin:/cm/shared/apps/git/2.28.0/bin:/cm/shared/apps/gdb/8.3.1/bin:/cm/local/apps/gcc/9.2.0/bin:/cm/local/apps/environment-modules/4.4.0//bin:/usr/local/bin:/usr/bin:/sbin:/usr/sbin:/cm/local/apps/environment-modules/4.4.0/bin:/usr/local/sbin:/home2/kdent/.local/bin:/home2/kdent/bin"
        },
        {
            "name": "PWD",
            "value": "/home2/kdent"
        },
        {
            "name": "_LMFILES_",
            "value": "/cm/local/modulefiles/gcc/9.2.0:/cm/shared/modulefiles/gdb/8.3.1:/cm/shared/modulefiles/git/2.28.0:/cm/shared/modulefiles/cmake/3.18.4:/cm/shared/modulefiles/anaconda/5.2.0/py3.6:/cm/shared/modulefiles/qtcreator/5.12.9:/cm/shared/modulefiles/llvm/14"
        },
        {
            "name": "LANG",
            "value": "en_US.UTF-8"
        },
        {
            "name": "MODULEPATH",
            "value": "/cm/local/modulefiles:/cm/shared/modulefiles"
        },
        {
            "name": "LOADEDMODULES",
            "value": "gcc/9.2.0:gdb/8.3.1:git/2.28.0:cmake/3.18.4:anaconda/5.2.0/py3.6:qtcreator/5.12.9:llvm/14"
        },
        {
            "name": "ENABLE_LMOD",
            "value": "0"
        },
        {
            "name": "MODULES_LMCONFLICT_modshare",
            "value": "anaconda/5.2.0/py3.6&anaconda:1"
        },
        {
            "name": "PATH_modshare",
            "value": "/cm/local/apps/environment-modules/4.4.0//bin:1:/usr/bin:1:/usr/local/bin:1:/opt/anaconda/5.2.0/py3.6/bin:1:/cm/local/apps/environment-modules/4.4.0/bin:1:/cm/shared/apps/git/2.28.0/bin:1:/cm/shared/apps/cmake/3.18.4/bin:1:/cm/shared/apps/gdb/8.3.1/bin:1:/sbin:1:/cm/shared/apps/qt/5.12.9/Tools/QtCreator/bin:1:/usr/sbin:1:/cm/shared/apps/llvm/14/build/bin:1:/cm/local/apps/gcc/9.2.0/bin:1"
        },
        {
            "name": "SHLVL",
            "value": "4"
        },
        {
            "name": "HOME",
            "value": "/home2/kdent"
        },
        {
            "name": "MANPATH_modshare",
            "value": "/usr/local/share/man:1:/usr/share/man/overrides:1:/cm/local/apps/environment-modules/4.4.0//share/man:1:/cm/local/apps/environment-modules/current/share/man:1:/cm/shared/apps/cmake/3.18.4/man:1:/usr/share/man:1"
        },
        {
            "name": "BASH_ENV",
            "value": "/cm/local/apps/environment-modules/4.4.0//init/bash"
        },
        {
            "name": "LOGNAME",
            "value": "kdent"
        },
        {
            "name": "LD_LIBRARY_PATH_modshare",
            "value": "/cm/local/apps/gcc/9.2.0/lib:1:/cm/shared/apps/qt/5.12.9/Tools/QtCreator/lib/qtcreator:1:/cm/local/apps/gcc/9.2.0/lib64:1"
        },
        {
            "name": "XDG_DATA_DIRS",
            "value": "/home2/kdent/.local/share/flatpak/exports/share:/var/lib/flatpak/exports/share:/usr/local/share:/usr/share"
        },
        {
            "name": "SSH_CONNECTION",
            "value": "RE.DA.CT.ED 49381 RE.DA.CT.ED 22"
        },
        {
            "name": "MODULESHOME",
            "value": "/cm/local/apps/environment-modules/4.4.0/"
        },
        {
            "name": "LESSOPEN",
            "value": "||/usr/bin/lesspipe.sh %s"
        },
        {
            "name": "LOADEDMODULES_modshare",
            "value": "gdb/8.3.1:1:cmake/3.18.4:1:qtcreator/5.12.9:1:anaconda/5.2.0/py3.6:1:llvm/14:1:gcc/9.2.0:1:git/2.28.0:1"
        },
        {
            "name": "XDG_RUNTIME_DIR",
            "value": "/run/user/1734230487"
        },
        {
            "name": "DISPLAY",
            "value": "localhost:12.0"
        },
        {
            "name": "GIT_EXEC_PATH",
            "value": "/cm/shared/apps/git/2.28.0/libexec/git-core"
        },
        {
            "name": "BASH_FUNC_module()",
            "value": "() {  unset _mlshdbg;\n if [ \"${MODULES_SILENT_SHELL_DEBUG:-0}\" = '1' ]; then\n case \"$-\" in \n *v*x*)\n set +vx;\n _mlshdbg='vx'\n ;;\n *v*)\n set +v;\n _mlshdbg='v'\n ;;\n *x*)\n set +x;\n _mlshdbg='x'\n ;;\n *)\n _mlshdbg=''\n ;;\n esac;\n fi;\n unset _mlre _mlIFS;\n if [ -n \"${IFS+x}\" ]; then\n _mlIFS=$IFS;\n fi;\n IFS=' ';\n for _mlv in ${MODULES_RUN_QUARANTINE:-};\n do\n if [ \"${_mlv}\" = \"${_mlv##*[!A-Za-z0-9_]}\" -a \"${_mlv}\" = \"${_mlv#[0-9]}\" ]; then\n if [ -n \"`eval 'echo ${'$_mlv'+x}'`\" ]; then\n _mlre=\"${_mlre:-}${_mlv}_modquar='`eval 'echo ${'$_mlv'}'`' \";\n fi;\n _mlrv=\"MODULES_RUNENV_${_mlv}\";\n _mlre=\"${_mlre:-}${_mlv}='`eval 'echo ${'$_mlrv':-}'`' \";\n fi;\n done;\n if [ -n \"${_mlre:-}\" ]; then\n eval `eval ${_mlre}/usr/bin/tclsh /cm/local/apps/environment-modules/4.4.0/libexec/modulecmd.tcl bash '\"$@\"'`;\n else\n eval `/usr/bin/tclsh /cm/local/apps/environment-modules/4.4.0/libexec/modulecmd.tcl bash \"$@\"`;\n fi;\n _mlstatus=$?;\n if [ -n \"${_mlIFS+x}\" ]; then\n IFS=$_mlIFS;\n else\n unset IFS;\n fi;\n unset _mlre _mlv _mlrv _mlIFS;\n if [ -n \"${_mlshdbg:-}\" ]; then\n set -$_mlshdbg;\n fi;\n unset _mlshdbg;\n return $_mlstatus\n}"
        },
        {
            "name": "BASH_FUNC_switchml()",
            "value": "() {  typeset swfound=1;\n if [ \"${MODULES_USE_COMPAT_VERSION:-0}\" = '1' ]; then\n typeset swname='main';\n if [ -e /cm/local/apps/environment-modules/4.4.0//libexec/modulecmd.tcl ]; then\n typeset swfound=0;\n unset MODULES_USE_COMPAT_VERSION;\n fi;\n else\n typeset swname='compatibility';\n if [ -e /cm/local/apps/environment-modules/4.4.0//libexec/modulecmd-compat ]; then\n typeset swfound=0;\n MODULES_USE_COMPAT_VERSION=1;\n export MODULES_USE_COMPAT_VERSION;\n fi;\n fi;\n if [ $swfound -eq 0 ]; then\n echo \"Switching to Modules $swname version\";\n source /cm/local/apps/environment-modules/4.4.0//init/bash;\n else\n echo \"Cannot switch to Modules $swname version, command not found\";\n return 1;\n fi\n}"
        },
        {
            "name": "_",
            "value": "/home2/kdent/.vscode-server/bin/da15b6fd3ef856477bf6f4fb29ba1b7af717770d/node"
        },
        {
            "name": "VSCODE_HANDLES_SIGPIPE",
            "value": "true"
        },
        {
            "name": "HOSTNAME",
            "value": "REDACTED"
        },
        {
            "name": "HISTSIZE",
            "value": "1000"
        },
        {
            "name": "HISTCONTROL",
            "value": "ignoredups"
        },
        {
            "name": "VSCODE_LOG_NATIVE",
            "value": "false"
        },
        {
            "name": "VSCODE_AMD_ENTRYPOINT",
            "value": "vs/workbench/api/node/extensionHostProcess"
        },
        {
            "name": "VSCODE_PIPE_LOGGING",
            "value": "true"
        },
        {
            "name": "VSCODE_VERBOSE_LOGGING",
            "value": "true"
        },
        {
            "name": "VSCODE_EXTHOST_WILL_SEND_SOCKET",
            "value": "true"
        },
        {
            "name": "VSCODE_HANDLES_UNCAUGHT_ERRORS",
            "value": "true"
        },
        {
            "name": "VSCODE_LOG_STACK",
            "value": "false"
        },
        {
            "name": "VSCODE_NLS_CONFIG",
            "value": "{\"locale\":\"en\",\"availableLanguages\":{}}"
        },
        {
            "name": "BROWSER",
            "value": "/home2/kdent/.vscode-server/bin/da15b6fd3ef856477bf6f4fb29ba1b7af717770d/bin/helpers/browser.sh"
        },
        {
            "name": "VSCODE_CWD",
            "value": "/home2/kdent"
        },
        {
            "name": "VSCODE_IPC_HOOK_CLI",
            "value": "/run/user/1734230487/vscode-ipc-206df298-1246-4c83-b6ed-66ba60a54d0d.sock"
        },
        {
            "name": "APPLICATION_INSIGHTS_NO_DIAGNOSTIC_CHANNEL",
            "value": "true"
        }
    ]
}
[extension] [3200] cmake.debugTarget finished (returned undefined)

@bobbrow
Copy link
Member

bobbrow commented May 18, 2022

@keegandent can you run CMake: Log Diagnostics and share the output here? Based on the logs you've shared so far, I expect the pre-release should have addressed this.

@keegandent
Copy link

keegandent commented May 18, 2022

Apparently I messed up and the pre-release version only got installed on my local machine, not the one I am actually building on over SSH. However, I cannot test this because I am now getting a different error where the pre-release extension is insisting on trying to use Ninja instead of Make. Even when I manually run cmake on the CLI and get it built with make, it wants to switch to using Ninja. Did something else change with the pre-release that causes such an aggressive default to Ninja?

@bobbrow
Copy link
Member

bobbrow commented May 18, 2022

Did something else change with the pre-release that causes such an aggressive default to Ninja?

I don't remember seeing any changes like that. Can you run the Log Diagnostics command on the remote machine? Are you using CMake Presets? If not, can you also share the information about your active Kit and any settings that may affect this (such as cmake.generator or cmake.preferredGenerators)? We need to add this stuff to the Log...

@keegandent
Copy link

keegandent commented May 19, 2022

The only CMake settings I have changed from default are the Logging Level to Debug and I enabled Configure On Open.

[main] Building folder: foo 
[main] Saving open files before configure/build
[main] Configuring folder: foo 
[main] Saving open files before configure/build
[driver] Start configure 
[driver] Running pre-configure checks and steps
[driver] Using compilers in GCC 9.2.0 x86_64-pc-linux-gnu for configure
[cmakefileapi-driver] Configuring using kit
[cmakefileapi-driver] Invoking CMake /cm/shared/apps/cmake/3.18.4/bin/cmake with arguments ["--no-warn-unused-cli","-DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE","-DCMAKE_BUILD_TYPE:STRING=Debug","-DCMAKE_C_COMPILER:FILEPATH=/cm/local/apps/gcc/9.2.0/bin/gcc","-DCMAKE_CXX_COMPILER:FILEPATH=/cm/local/apps/gcc/9.2.0/bin/g++","-S/home2/kdent/workspace/foo","-B/home2/kdent/workspace/foo/build","-G","Ninja"]
[proc] Executing command: /cm/shared/apps/cmake/3.18.4/bin/cmake --no-warn-unused-cli -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -DCMAKE_BUILD_TYPE:STRING=Debug -DCMAKE_C_COMPILER:FILEPATH=/cm/local/apps/gcc/9.2.0/bin/gcc -DCMAKE_CXX_COMPILER:FILEPATH=/cm/local/apps/gcc/9.2.0/bin/g++ -S/home2/kdent/workspace/foo -B/home2/kdent/workspace/foo/build -G Ninja
[cmake] Not searching for unused variables given on the command line.
[cmake] CMake Error: CMake was unable to find a build program corresponding to "Ninja".  CMAKE_MAKE_PROGRAM is not set.  You probably need to select a different build tool.
[cmake] -- Configuring incomplete, errors occurred!
[cmake] See also "/home2/kdent/workspace/foo/build/CMakeFiles/CMakeOutput.log".
[extension] [4583] cmake.build finished (returned 1)

Not sure what is providing the -G Ninja here; there isn't Ninja anywhere on this system to my knowledge.

{
  "os": "linux",
  "vscodeVersion": "1.67.2",
  "cmtVersion": "1.11.19",
  "configurations": [
    {
      "folder": "/home2/kdent/workspace/foo",
      "cmakeVersion": "3.18.4",
      "configured": true,
      "generator": "Ninja",
      "usesPresets": false,
      "compilers": {}
    }
  ],
  "cpptoolsIntegration": {
    "isReady": true,
    "hasCodeModel": false,
    "activeBuildType": "",
    "buildTypesSeen": [],
    "requests": [
      "file:///home2/kdent/workspace/foo/main.cpp"
    ],
    "responses": [],
    "partialMatches": [],
    "targetCount": 0,
    "executablesCount": 0,
    "librariesCount": 0,
    "targets": []
  },
  "settings": [
    {
      "communicationMode": "automatic",
      "useCMakePresets": "auto",
      "configureOnOpen": true
    }
  ]
}

Again, not really sure how it arrived at Ninja.

cmake_kit

@bobbrow
Copy link
Member

bobbrow commented May 19, 2022

If you set cmake.generator to "Unix Makefiles" does it fix the problem for you?

@github-actions github-actions bot locked and limited conversation to collaborators May 29, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug a bug in the product Feature: debug/launch
Projects
None yet
Development

Successfully merging a pull request may close this issue.

10 participants