79570187

Date: 2025-04-12 08:06:51
Score: 3.5
Natty:
Report link

I have the same problem when using the -x parameter of GDB in VS Code. If I use the below config in lanuch.json

"miDebuggerArgs": "-x ${workspaceRoot}/.vscode/gdb.conf",

I will get error

Unhandled Exception: System.ArgumentException: Invalid escape sequence: \U
   at WindowsDebugLauncher.Program.ParseDebugExeArgs(String line)
   at WindowsDebugLauncher.Program.Main(String[] argv)

Due to ${workspaceRoot} was expand to c:\\Users\\username\\Apps\\Msys64\\home\\username\\project/.vscode/gdb.conf

There are many discussions https://github.com/microsoft/vscode-cpptools/issues/908 and https://github.com/microsoft/vscode-cpptools/issues/9785 but without any solution. The work solution is from here.The solution is to use the Command Variable VSCode extension

"miDebuggerArgs": "-x ${command:extension.commandvariable.workspace.folderPosix}/.vscode/gdb.conf",

Will be expanded to /c/Users/username/Apps/Msys64/home/username/project/.vscode/gdb.conf and the problem is solved.

Reasons:
  • Blacklisted phrase (1): I have the same problem
  • Blacklisted phrase (1.5): any solution
  • Whitelisted phrase (-1): solution is
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Me too answer (2.5): I have the same problem
  • Low reputation (0.5):
Posted by: Cong Yang