-
Notifications
You must be signed in to change notification settings - Fork 449
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
Comments
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 -_- |
I see no meaningful error. This is from the debug window
|
Super helpful, thanks! The problem is with this environment variable in your shell:
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. |
Possibly related: #1841 |
Here is the log . [variant] Loaded new set of variants |
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 |
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🤔. |
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. |
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 |
That looks like a logging issue. The debugger does not read this as json. The problem is actually with values that have a |
The fix for this will be available in tomorrow's pre-release: 1.11.10 |
@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. |
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:
|
@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. |
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. |
Hi Bob, here's the log, with project-specific stuff that shouldn't matter replaced by ...:
|
Thanks! This is perfect. We'll get a fix out soon. |
Debugger fails to start for me on Fedora 36.
It works if i roll back to 1.9 Looks like this is fixed in #2518 |
@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. |
I also seem to be encountering an issue with the debugging environment variables on RHEL 7.9, but it's complaining particularly about Formatted:
Full Log:
|
@keegandent can you run |
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? |
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 |
The only CMake settings I have changed from default are the Logging Level to Debug and I enabled Configure On Open.
Not sure what is providing the
Again, not really sure how it arrived at Ninja. |
If you set |
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-1ubuntu1
20.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-gnu20.04)Thread model: posix
gcc version 9.4.0 (Ubuntu 9.4.0-1ubuntu1
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?
The text was updated successfully, but these errors were encountered: