microsoft / vscode-cpptools

Official repository for the Microsoft C/C++ extension for VS Code.
Other
5.53k stars 1.56k forks source link

Unable to set conditional breakpoint containing double-quotes: "Problem parsing arguments: break-insert -f -c" #4562

Open rkubik opened 5 years ago

rkubik commented 5 years ago

Type: Debugger

Problem: Unable to set conditional breakpoints (expressions) that contain double-quotes. I can side step the issue by escaping all of the double-quotes in the expression but that is not intuitive for those who use the UI for debugging and are unfamiliar with GDB/MI. I'd argue that vscode should escape all user-provided expressions (conditional breakpoints, watches, etc.) that are provided to GDB/MI.

To Reproduce

  1. Create a conditional breakpoint (expression) with the following value:
$_streq(some_string,"/tmp/foobar")
  1. Start debugging (F5). Break point turns gray and hovering over the breakpoint displays:
Problem parsing arguments: break-insert -f -c "$_streq(some_string,"/tmp/foobar")" at file.c:23
hliu202 commented 4 years ago

Hi, I met the same problem. The root cause is

break-insert -f -c "$_streq(some_string,"/tmp/foobar")"

VSCode did not handle ", the work around is to simply add \ before ". Anyway, just insert a conditional breakpoint as following:

$_streq(some_string,\"foobar\")