Conditional breakpoint?
-
Is it possible to create a conditional breakpoint, I have an object that contains a member children, I want to see create a breakpoint to see when this is being modified.
I am adding calling addWidget on a QFormLayout, however at some point the children is being modified and I have no idea why or where, all I can say is the a widget is added to the layout then the next time I go to add another widget, the previous widget has gone.
-
you can add Conditional breakpoints by right clicking your breakpoint red circle->Edit Breakpoint->Advanced->condition
or add something like
if ( *** ) { int n = 0; }
in your code and set a break point inside if
-
@JoeCFD, the point is I don't know where or what is making the change, thats why I want to use a conditional breakpoint to halt execution as soon as the condition is true.
-
@JoeCFD , thank you, so I did this right clicking the member variable with a breakpoint set on a line, however I'm not sure this is what I want as the breakpoint will stop on the line where the breakpoint was created. I want a breakpoint that will halt at the location where the condition is true.
-
@JoeCFD , thank you, so I did this right clicking the member variable with a breakpoint set on a line, however I'm not sure this is what I want as the breakpoint will stop on the line where the breakpoint was created. I want a breakpoint that will halt at the location where the condition is true.
-
@SPlatten add as many as you want with the same condition and you will catch it somewhere. As soon as you reach the breakpoint which meets the condition, you can trace back.
@JoeCFD , the problem is I don't know what is making the change or where, all I can say is I have one instance of an object which has a QFormLayout when I add a widget to it, its there and at some point between the next call to add the next widget, the previous widget is no longer there. I really don't know why.
-
@JoeCFD , the problem is I don't know what is making the change or where, all I can say is I have one instance of an object which has a QFormLayout when I add a widget to it, its there and at some point between the next call to add the next widget, the previous widget is no longer there. I really don't know why.
-
@SPlatten
You cannot set a breakpoint in the way you would like. That would require the list to be monitored as every instruction is executed. I don't think gdb or even MSVC offers this. -
@JonB , thank you, ok, I'm open to suggestions on how I might track down why the behaviour I'm seeing is occurring.
-
@JoeCFD , the problem is I don't know what is making the change or where, all I can say is I have one instance of an object which has a QFormLayout when I add a widget to it, its there and at some point between the next call to add the next widget, the previous widget is no longer there. I really don't know why.
-
@SPlatten if you know which widget disappears(you should know by setting object name or id), create a shared point of it. Check if the shared pointer becomes nullptr at the steps where it may disapppear.
-
@SPlatten if you know which widget disappears(you should know by setting object name or id), create a shared point of it. Check if the shared pointer becomes nullptr at the steps where it may disapppear.
-
@JoeCFD , I've called setObjectName on all the widgets I'm using, not sure how this helps tho.
-
@JoeCFD , I've called setObjectName on all the widgets I'm using, not sure how this helps tho.
-