Page 1 of 1
Debugging code
Posted: Tue Jun 16, 2009 6:01 am
by Tigers!
I am trying to debug my code and am finding it difficult.
I put in 4 watches but when I build the project the watches disappear. How do I get them to remain and see what their values are?
Can we single step through the code i.e. one line at a time and see haow the watches change?
Re: Debugging code
Posted: Tue Jun 16, 2009 10:55 pm
by DavidGH
Hi,
I put in 4 watches
Do you mean watchpoints or breakpoints?
but when I build the project the watches disappear.
Do you mean 'build' or 'run'?
Watchpoints are automatically deleted by gdb as soon as they lose scope. That's often far sooner than I want, as most things I've been interested in have been local to a function. There's no good answer to this afaik (and if anyone
does know of one, please tell me); but a kludge I've occasionally used is temporarily to change the code, making the variable a global, so that it retains scope while the app is running.
If you meant breakpoints, CodeLite should remember each breakpoint position between runs, and reinsert them when the app restarts. Is this not happening for you? Of course, if you rewrite that bit of code, the breakpoint may end up in the wrong place (though CodeLite does try to avoid this).
Regards,
David