Watchpoint conditions in eclipse - c++

sorry, I was looking for information about this topic but I did not find anything useful so I post here the probably trivial question.
I use eclipse galileo cdt in mac os x. I create watchpoints, and for some of them I am able to specify that the debug run stops when the variable takes some value, for instance aaa==10. But I want now what the debug run stops when aaa less than -50. So I tried aaa<-50 but nothing. Am I doing something wrong here?
Thanks in advance

Someone seems to have had exactly the same probl... oh wait, it is you;)
Could this be a side-effect of bug 213076?
In short, modifying an existing breakpoint could lead to some extra quotes around the new condition, making it not running properly.
Do you have the same symptom with a new breakpoint?

Related

how to stop exection in eclipse when a condition is met

I have a global counter variable in c projet.
It increase out of desired bounds,
but i cannot find the line of the increase.
Is there any way to hold execution on the line where this variable is above X ?
I can get the variable memory address.
A few minutes of googling confirmed what I suggested in my comment:
GDB, which is the debugger for GCC, supports so-called watchpoints.
You can find a description here, how to set them in GDB's command line. You can toggle those watchpoints in Eclipse as well (supposedly depends on the Eclipse version you are using). This blog post tells you how to do it.
If you haven't installed GDB (I wonder what your debugger would be then), there is a SO post covering the installation.
If it is global and you do not have any idea how it is increasing, hit ctrl + h, search for the variable name and see where it is being f-ed up. Probably something else somewhere modifies it and you don't have any clue about it. Overall using globals is a very bad idea. The best way to monitor it is to use some procedure which is the only one who can access your counter and then in that function compare it with X.

Eclipse stops running reason = "breakpoint"

I am working with eclipse using C++. It was working fine till yesterday. Now when I use break points and debug I get a stopped,reason="breakpoint-hit" error and then eclipse stops. Has anyone seen this error and anyone know how to fix it?
I have used breakpoints before to help me debug. Instead of the step into, step over, and step out options, Eclipse stops running. I am not doing anything out of the usual with breakpoints, I tried them at several different points and got the same problem.
Eclipse obviously has problems with debugging while you use the console for typing in input. Is that your case? I had that problem and while googling for a solution, I finally came upon a recommendation that while debugging, you should pass input to your program from a file rather than typing it to the console.
The recommendation can be found here:
http://webcourse.cs.technion.ac.il/234122/Spring2011/en/faq_Working%20with%20Eclipse%20CDT.html
(It's the question that starts with "I have a problem with debugging in Eclipse.".)
Hope this helps.

gdb pause under NetBeans -- how?

I'm having problems getting gdb to pause execution flow under NetBeans. The pause button doesn't appear to work at all. From this answer, I suspect it may be a problem with what text gdb is actually receiving as input (I'm under Windows/Mingw32 using IIRC msys bash). But this is just a guess.
I don't know where to view what is happening with gdb (input or output). I see a few mentions of it in the debugger console but not sure if that counts for anything. I'd post that log here but it is rather large.
This is apparently a general problem with Windows/Netbeans, for which detail can be found on one of the NetBeans site pages (can't remember which).

Saving debugging state and backwards debugging with Xcode or friends

I am using Xcode in order to debug C++ programs. The main problem for me is that it takes around 10 munutes till the program gets to the point of the program that I need to debug. Then I realize about something inspecting the variables and some other stuff, and modify the code. Then 15 minutes again and so ...
I wonder if there is possible in some way in Xcode or in another IDE or compiler/debugger for C++, to "save" in some way a desired debugging state of the program. So if my compouter crashes or I modify the code and make some mistakes, one can open this saved state instantly and get fast to the point where one left before.
I also wonder if at this moment Xcode can "backwards debugging". GDB can for sure, as for september 2009. Or what do you think is the best IDE to do this.
Thanks a lot
GDB has "backwards debugging" (or more correctly "Reverse Debugging") for a limited number of platforms (list of native supported ones):
i386-linux
amd64-linux
moxie-elf ( http://moxielogic.org/blog/ )
So it is impossible for now to use this functionality on Mac OS X, with Xcode or without it.
Saving of program state in offline is very hard task. It is almost impossible to restore state of file descriptors, network connections, memory state (randomization of layout), even pid.
Such task is related to "Live migration" problem in openvz.
"Edit and Continue" feature from MSVS allow you to continue running after breakpoint with new version of code. It is supported for C#, C++ and Basic.
http://msdn.microsoft.com/en-us/library/esaeyddf(VS.80).aspx

How can I debug a program when debugger fails

I am debugging an Iphone program with the simulator in xCode and I have one last issue to resolve but I need help resolving it for the following reason: when it happens the program goes into debugging mode but no errors appear (no BAD ACCESS appears) and it does not show where the code fails. Putting some variables as global helps me to see their values to start pin pointing where the bug is but before I go into this fully I would like to know what techniques/tools you guys use to debug these situations.
If it helps Im debugging the following: I merged some code into the SpeakHere demo. The code was added in the C++ modules of the program (AQRecorder.h and .mm). I seem to have pinpointed the problem code in a function I wrote.
My favourite is always to add debugging code and log it to a file. This allows me so report any and all information I need to resolve the issue if the debugger is not working properly.
I normally control the debugging code by use of a flag which I can manipulate at run time or by the command line.
If the error is (and it probably is) a memory management issue, printing log entries is really not going to help.
I would reccomend learning how to use Instruments, and use its tools to track down the memory leak when it occurs rather than waiting until the application crashes later on.