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?
Debugging code
-
- CodeLite Enthusiast
- Posts: 13
- Joined: Mon Feb 23, 2009 10:05 am
- Location: Australia
- Contact:
-
- CodeLite Plugin
- Posts: 819
- Joined: Wed Sep 03, 2008 7:26 pm
- Contact:
Re: Debugging code
Hi,
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
Do you mean watchpoints or breakpoints?I put in 4 watches
Do you mean 'build' or 'run'?but when I build the project the watches disappear.
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