vscode-cpptools icon indicating copy to clipboard operation
vscode-cpptools copied to clipboard

[cppvsdbg] The condition for a breakpoint failed to execute if expression is a string

Open carrigiljavia opened this issue 5 years ago • 6 comments

Type: Debugger

Setup a valid conditional breakpoint and got an exception or debugger stops every time in the breakpoint set. The expected result is to stop just once. Condition is valid, evaluated in debug console.

#include <iostream>
#include <vector>
#include <string>

using namespace std;

int main()
{
    vector<string> msg {"Hello", "C++", "World", "from", "VS Code", "and the C++ extension!"};
    string text ;
    for (const string& word : msg)
    {
        cout << word << " ";
        text = word; //breakpoint here expression: text=="from"
        if (word=="from")
        {
            cout << " -> ";
        }
    }
    cout << endl;
}

Version: 1.46.1 (system setup) Electron: 7.3.1 Chrome: 78.0.3904.130 Node.js: 12.8.1 V8: 7.8.279.23-electron.0 OS: Windows_NT x64 10.0.18363

  • C/C++ Extension Version: 0.28.3

carrigiljavia avatar Jun 22 '20 21:06 carrigiljavia

Duplicate of https://github.com/microsoft/vscode-cpptools/issues/2297

WardenGnaw avatar Jun 23 '20 20:06 WardenGnaw

Retested with version https://github.com/microsoft/vscode-cpptools/releases/tag/0.29.0-insiders and this does not fix the error. Modifying conditional breakpoints while debugging does not work due to VSCode change #2297 2020-07-05_11-36-07

carrigiljavia avatar Jul 05 '20 16:07 carrigiljavia

Observed too in "Version: 1.54.3 Commit: 2b9aebd5354a3629c3aba0a5f5df49f43d6689f8 Date: 2021-03-15T10:55:45.459Z Electron: 11.3.0 Chrome: 87.0.4280.141 Node.js: 12.18.3 V8: 8.7.220.31-electron.0 OS: Windows_NT x64 10.0.19041"

drtingli avatar Apr 01 '21 19:04 drtingli

Observed in

Version: 1.74.2 (user setup)
Commit: e8a3071ea4344d9d48ef8a4df2c097372b0c5161
Date: 2022-12-20T10:29:14.590Z
Electron: 19.1.8
Chromium: 102.0.5005.167
Node.js: 16.14.2
V8: 10.2.154.15-electron.0
OS: Windows_NT x64 10.0.19044
Sandboxed: No

Conditional breakpoint using a comparison without a string, but with a number works. (Example variableInt > 15 works)

edit: Doesn't work means, the conditional breakpoint is hit every time. Even if the string in the condition is different from the string value of the variable.

ToBoMi avatar Jan 11 '23 14:01 ToBoMi

Observed in August 2023 (version 1.82) Windows 10, WSL2 Ubuntu20.04

LongyuanCode avatar Sep 14 '23 07:09 LongyuanCode

Obversed in February 2024 Windows 11, WSL2 Ubuntu 20.04

chanmaoganda avatar Feb 14 '24 06:02 chanmaoganda

found a resolution that using cmake and codelldb helps cmake 3.16, gcc 9.4.0-x86-64 gnu using tasks.json and launch.json to debug in lldb

chanmaoganda avatar Feb 28 '24 03:02 chanmaoganda