microsoft / MIEngine

The Visual Studio MI Debug Engine ("MIEngine") provides an open-source Visual Studio Debugger extension that works with MI-enabled debuggers such as gdb and lldb.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`set env` commands with newlines trigger GDB problems

bspeice opened this issue · comments

Related: matepek/vscode-catch2-test-adapter#364, microsoft/vscode-cmake-tools#2442

Environment variables that contain newline characters cause problems when attempting to run set env commands (gdb.cs and Debugger.cs), I believe because newlines aren't escaped properly (Debugger.cs). Downstream VS Code plugins have so far worked around this by removing environment variables containing newlines.

I'm currently working to set up a local copy of OpenDebugAD7 to test whether variable escaping is enough to fix the problem, but wanted to raise the issue here in case one of the maintainers had a better solution in mind.

Was able to compile OpenDebugAD7, run the cpptools extension with it loaded, and recreate the problem by adding an "environment": [{"name": "MY_VAR", "value": "Hello\nWorld"}] block to the launch.json. The debugger crashes out prior to #1365, and is able to properly debug when #1365 is applied.