2

Microsoft visual studio 2010 allows to set up a conditional breakpoint. Language used to define breakpoint condition is not really explained, but seems to follow C++ syntax.

For complicated objects, such as std::string or QString, it simply doesn't work.

You cannot obviously call member methods such as .c_str on those objects, but it seems that you can call C functions such as strcmp. This brings me to the question:

Can I define my own C-like functions for comparing custom objects that will be accessible with conditional breakpoints. Example:

// Function to compare QString with const char*
bool q_string_equals(const QString& qstr, const char* str) {
    // some code, probably pretty complicated if we really wanna avoid calling member fns
}

Then use it like:

image description

The need to recompile whole project to add if based "breakpoint" is really annoying.

Community
  • 1
  • 1
Tomáš Zato
  • 50,171
  • 52
  • 268
  • 778

0 Answers0