Author Topic: can coldblocks break program automaticly in debug when variable is changed  (Read 5690 times)

Offline fei123

  • Single posting newcomer
  • *
  • Posts: 6
using gdb ,we can break program when variable is changed .
we just use the cmd “watch  a” .
a =0 firstly,then when a is changed into 1,the program will be break running   automaticly.

how can i do this in codeblocks??
codeblocks can watch the change of  variable .the colour will be changed when the variable is changed . but the programme will not be break automaticly !!

thank u for your help .

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 6079
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
using gdb ,we can break program when variable is changed .
we just use the cmd “watch  a” .

Have you see the "command input control" at the bottom of the  debug panel. You can enter (do) anything as you did in GDB.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4315
    • Code::Blocks IDE
Memory may be failing me but isn't there a "Debug->Debugging windows->Watches" window for this kind of thing?
Be patient!
This bug will be fixed soon...

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13406
    • Travis build status
There is something called Data breakpoints.
I think, that in order to use them you need to stop on a breakpoint first.
Then right click your variable in the editor and "Add data breakpoint for 'myvar'" or something like that.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline fei123

  • Single posting newcomer
  • *
  • Posts: 6


Have you see the "command input control" at the bottom of the  debug panel. You can enter (do) anything as you did in GDB.
[/quote]

yes。it is right。
in my example just input  “watch a ”  in the debug---send user command to debug ,and  select view--Logs .
i can see the informations like "info breakpoint " in gdb