Hello,
is it passible to set a breakpoint dependent on the value of a variable?
Thanks
Breakpoint condition: variable content
-
- CodeLite Enthusiast
- Posts: 31
- Joined: Tue Feb 26, 2019 12:50 am
- Genuine User: Yes
- IDE Question: C++
- Contact:
-
- CodeLite Plugin
- Posts: 819
- Joined: Wed Sep 03, 2008 7:26 pm
- Contact:
Re: Breakpoint condition: variable content
Hi,
n>6
or
baz=="foobar"
Regards,
David
Yes, of course; that's the sort of thing that Conditional Breakpoints do. See this (rather outdated) wiki page; the bottom picture shows the 'Create a Breakpoint or Watchpoint' dialog. In its Conditional Breaks field you can set any sensible expression e.g.is it possible to set a breakpoint dependent on the value of a variable?
n>6
or
baz=="foobar"
Regards,
David
-
- CodeLite Enthusiast
- Posts: 31
- Joined: Tue Feb 26, 2019 12:50 am
- Genuine User: Yes
- IDE Question: C++
- Contact:
Re: Breakpoint condition: variable content
Hello,
yes, but it works strange:
breakpoint in line 9 with condition: x=5
start/continue Debugger
Output (Terminal Settings = CMD):
x=2
then program stops
next command of me
Output next…... next:
-------
x=6
------
x=6
.......
yes, but it works strange:
Code: Select all
#include <iostream>
// Testprogram
int main()
{
int x{ 1 };
while (x++ < 8){
std::cout << "x=" << x << std::endl;
std::cout << "------" << std::endl;
}
return 0;
}
start/continue Debugger
Output (Terminal Settings = CMD):
x=2
then program stops
next command of me
Output next…... next:
-------
x=6
------
x=6
.......
-
- CodeLite Plugin
- Posts: 819
- Joined: Wed Sep 03, 2008 7:26 pm
- Contact:
Re: Breakpoint condition: variable content
Perhaps the condition should be:breakpoint in line 9 with condition: x=5
x==5
-
- CodeLite Enthusiast
- Posts: 31
- Joined: Tue Feb 26, 2019 12:50 am
- Genuine User: Yes
- IDE Question: C++
- Contact:
Re: Breakpoint condition: variable content
Thanks, that was the solution!