-
-
Notifications
You must be signed in to change notification settings - Fork 52
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
Debugger fails to start when environment variables contain newlines #364
Comments
Hello, It sounds like a "Microsoft GDB adapter" issue. |
Btw you can check the documentation of debugConfigTemplate And I added a new paragraph which might be helpful for this case to here |
Because other official C++ plugins have fixed the issue without touching the cpptools extension (microsoft/vscode-cmake-tools#2518). I agree that it's an issue with the cppdbg adapter (the lldb extension adapter doesn't suffer the same problem), but I'm hoping to merge this fix as a way to improve the default user experience. I'm currently trying to investigate how VS Code launches GDB (I think the cpptools extension is responsible for actually spawning the executable), I'll add another comment once I have more details on whether this can be solved upstream. My concern is that GDB commands in general don't support newline characters (microsoft/vscode-cpptools#3666) so there might not be a general solution.
That works if users are aware of all environment variables that contain newlines ahead of time. As is the case with the My specific concern is that error messages are extremely difficult to understand and it's not clear how to fix the problems. If you're not comfortable filtering out environment variables, would it be beneficial to have some form of warning (popup notification that can be ignored in the future?) so users are aware of the potential problems? |
I was wrong about the extension; the specific problem comes from the debug engine that cpptools relies on not escaping commands properly: I think the fix might be to add Going to open an issue there to see what they think. |
If it were "fixed" in this extension then maybe one day another user came and say "my multiline env variables are not working, the extension is buggy". Should I say: "It's not a bug, it's a feature"? |
Checklist
I understand that you have privacy concerns and I expect you to understand that this extension is developed for free.
Thanks.
Describe the bug
Please see also microsoft/vscode-cmake-tools#2686
Environment variables with newlines in them cause problems for the Microsoft GDB adapter (screenshot attached, please also see microsoft/vscode-cmake-tools#2442 and microsoft/vscode-cmake-tools#2515).
To Reproduce
Attempt to debug a test using the gutter "play" button in an environment where environment variables contain newlines. In my project fork, I've included a devcontainer setup that can be used to reliably reproduce the problem (specifically, the
environment-modules
package sets up some functions that get exported with newlines).Screenshots (optional)
Desktop
Log (optional but recommended)
Log not included, will file a pull request momentarily.
The text was updated successfully, but these errors were encountered: