Is there a way how to set up more complex condition for breakpoints in QtCreator? (dbg) At least comparing the QStrings, but other complex type would be nice too. Integer comparing like in tutorials works fine.
Asked
Active
Viewed 4,001 times
2 Answers
2
Right click the breakpoint (red ball in the left hand side of the text editor) and select something like "Edit breakpoint". A dialog then let you put conditions on the breakpoint.

jpo38
- 20,821
- 10
- 70
- 151
-
Nice, but how are you using this for comparing for example strings? Let's say I have function `void foo(QString bar){...}` and would like to pause when bar == "BAR"? – Libor Tomsik Nov 16 '15 at 13:27
-
HAve you tried to put `bar == "BAR"` in the condition field? – jpo38 Nov 16 '15 at 13:40
-
Thanks, it's working. Sometimes. Probably some bug somewhere. Like the breakpoint sometimes duplicates. – Libor Tomsik Nov 16 '15 at 15:02
-
@LiborTomsik: Conditions are limited to function without any side-effects (from debugger point of view). You may have to use internal data instead of getter/methods. – Jarod42 Nov 16 '15 at 16:35
0
ctrl+click or right click a breakpoint and choose Edit Breakpoint.
A window comes up where you can set "Condition" and how many times it should be ignored before the debugger stops the execution.
The condition can be whatever you would write in a conditional c++ clause.
There are other options as well such as which thread are you targeting.

Ashkan
- 1,050
- 15
- 32
-
1condition should not have side effect, whereas `if (side_effect())` is legal. – Jarod42 Nov 16 '15 at 16:37