XCode automatically deactivating breakpoints - c++

I'm using xcode in C++. I'm trying to debug my project, but at random intervals, it seems to ignore my breakpoints. There are three things that it does:
1) Sometimes, when I run, it automatically switches to "de-activate break points" mode. (the relevant button goes light and says "Activate")
2) Sometimes when I run, ALL of my breakpoints go "can't find" mode, with the yellow insides. I need to click twice on them to get them back dark blue (once to light blue = inactive, once to dark blue = active)
3) Sometimes, when I run, my breakpoint is dark blue, the button says "deactivate" and it still just ignores my breakpoint, running straight past it.
This makes it very difficult to debug my program...
I should add that I'm using XCode 3.1 beta on OSX 10.5.6, in case that matters.
thanks.

Try unchecking the Load symbols lazy in the Debugging panel in Preferences
alt text http://img.skitch.com/20090209-gj947qk7dxdyms1wij4q5em2f2.jpg

Had the same problem but only restarting the iPhone Simulator seemed to fix it.

I faced the same issue right now.
I tried all the options : enabling the GCC, active, base targets and restarting and closing xcode, nothing solved.
I finally restarted the simulator and things have started working.

I have more or less the same set of issues, and this suggestion of loading symbols lazily unfortunately does not resolve it for me. Moreover, I am not developing for the iphone, just a regular application.
To be specific, sometimes I can't disable or enable breakpoints on the fly - sometimes my code doesn't stop in breakpoints which I later prove are being executed (with print statements) and nothing I can do will make it stop there - I see that very annoying debug symbol with an orange center, even though I only have one project active.
Quitting and restarting XCode occasionally has an effect - and annoyingly, there have been a very small number of cases where quitting and restarting or rebuilding from clean fixed hard-to-diagnose compilation/linking errors. Unfortunately, I just tried all of these with no effect.
(Unrelated, my keyboard shortcuts are also unreliable. My shortcut of F2 for continue worked for weeks for me, stopped working for a long time, was working this morning and now doesn't work at exactly the same breakpoint it worked before - yet my F1, step over, key has been completely reliable...)
I'm a little disappointed to have to do so much debugging with print statements!

Related

Edit and Continue in VS2019

I've just updated a major C++ project from VS2010 to VS2019, and I'm having problems getting Edit and Continue to work like it used to, specifically in relation to the 'Require source files to exactly match the original version' setting (which I will refer to as the 'require match' setting, because it's shorter).
I'm used to running my program, making changes to the source code while it's running, then setting a breakpoint to catch the running application just before the changed code. When the breakpoint is hit, I could hit F5 to rebuild and continue.
In VS2019, it seems that Edit and Continue will not work without the 'require match' setting, but setting breakpoints in existing code cannot be done with 'require match' once any changes are made.
There's a couple of workarounds, but none are ideal. It's possible to turn on "require match" to build and run the program, then after some code changes are made, turn it off to set the breakpoint, then turn it back on again for the rebuild and continue. That's a huge pain. It's possible to use pause and continue to force a rebuild of any edits, but this only works if the code change is complete enough to build. If I want to break to inspect a variable, this doesn't work. Once or twice I did manage to set a breakpoint on changed code, and it automatically went to the stale code, which is acceptable, but I can't get this to happen now. Also, now I have breakpoints that are showing as valid on edited code that has been rebuilt and I know is running, but the breakpoints are not being hit.
Any solutions here, or does Edit and Continue simply not work as well as it used to?
Here's some pictures...
Firstly, while my program is running, I made some change to surfdraw_panels.cpp, then went to add a breakpoint. It shows the following message...
Then loads up a [stale] version of the code, with the breakpoint set in the stale code...
Other times, when I make a change, I get a different result, and it won't allow me to set a breakpoint at all... In VS2010, it was possible to turn off the 'require match' setting and still use 'Edit and continue', but VS2019 will not allow this, even though it is still the recommended 'solution' in the message!
Github project that shows the issue is below. It's a simple MFC app, dialog based, created by the new project wizard in VS2019. There is a single button on the dialog, and some simple code to do something in the button. To recreate the problem, start the app in the debugger, then make a change to OnBnClickedButton1(), and then try to set a breakpoint.
https://github.com/surfdabbler/MFCApplication1
Not quite understand your specific situation and operation, because there are not some pictures and code to explain the issue in detail.
But this function which I used could break into the changed code during debugging with require match option. You should move your cursor back to the changed code and then Debug the below code step by step. And when you move the cursor back to the changed code, vc++ project will rebuild the changed code automatically and you do not have to stop debugging and restart build.
Update 1
I also faced the same behavior in my side. And since we could not handle the issue here any more, I reported the issue on our DC Forum.
You can vote it and add any comments if I did not describe the issue in detail so that it will get more Microsoft's attention. And I hope the Team will give you a satisfactory reply.

Breakpoints work differently than in examples

I'm coding in C++ with Visual Studio. As I'm following along in a YouTube tutorial by The Cherno, he suggests placing breakpoints in certain places. He places them there and they work. When I place them in the same places in my copy of his code, the debugger doesn't run them (the red circle which marks breakpoints turns black upon debugging). The particular place I'm trying to break at is the initialization of a variable as an integer.
I notice that every place I try to put a breakpoint besides the first bracket of my main() turns black and doesn't run.
This is what The Cherno's code looks like with one working breakpoint.
This is what my code looks like. If I move the first breakpoint down to where his is, it doesn't run. Also note no other breakpoint runs.
I have made sure I'm running in debug mode.This is my screen before I press F5 to run, note "debug" selected in dropdown menu.
I have also made sure optimizations are disabled in the C++ section of the properties menu of my project.
You're building in Release mode. Change your build to Debug mode. Release builds are hard to debug, because many lines of code are compiled together, and thus cannot be individually broken upon. If your breakpoints don't get set or hit properly, it's because you're in Release mode.
I suggest you could check whether the Solution Configuration and Properties settings are consistent.
Moreover, it is not recommended that you set breakpoints on the { and } of the if, which will cause conditional compilation. Also, compResult is false, which means that the program cannot enter if (compResult){}.
Besides, I suggest that you could clean and rebuild the program. You could try to lear the Require source files that exactly match the original version option in Debug->Options->Debugging->General.

Debugger popup message "Getting DataTip text"

This Debugger message pops up randomly while i am attempting to examine a variable while a breakpoint has hit in Visual Studio 2017.
Shortly thereafter, a larger message box appears that shows the following: "Evaluating the function 'System.Reflection.Assembly.LoadForm' timed out."
After enabling option Tools / Options / Debugging / General / Only managed code, the second message box have disappeared. But first message is still showing.
The problem is that first popup window appears for a relatively long time, that makes debugging process very noncomfortable. What else Visual Studio debugger options could I set to disable this popup?
(1)Tools->Options, uncheck the setting Debugging / General / Enable property evaluation and other implicit function call, and enable the Use Managed Compatibility Mode.
(2)Deleted all the .suo/obj/Bin/.user files in your project, and then re-open your project, clean and build your solution, debug it again.
This solution works fine for me:
Uncheck the new langage JavasScript Language Service in Options -> Editor -> JavaScript -> Language Service.
Option capture
I'm having this same issue and there doesn't appear to be a solution. It's extremely frustrating because when the "Getting DataTip text..." does popup and eventually goes away, my breakpoints no longer work.
The solutions listed here have not solved the problem, I've tried them ALL ... even a wipe and re-install of OS and VS 2015.
Debugging without ability to do property evaluation and other implicit function calls is basically NOT debugging and defeats the purpose.
Microsoft seem to be aware of the problem but keep closing the tickets as "unable to replicate" ... yet, a simple Google Search will show many many thousands of hits of developers running into this problem. I keep opening tickets with Microsoft, but they just keep getting closed or merged with no solution.
Cheers, Rob.
The ONLY solution that worked for me:
CMD window (Run As Admin)
type SFC /SCANNOW and wait for it to complete and hopefully fix any errors
Reboot
Bring up VS 2015 or 2017 without loading any project
In VS select Tools | Import and Export Settings | Reset all Setting ... now pick the template you use (i.e. VB, C, Web)
Exit VS
Load VS project and debug
Cheers, Rob.
Old post, but maybe it will help someone anyway ;)
In my case I got this every time I examined the first variable while debugging.
Annoying as hell as I due to the nature of the work restart the debugger often.
This was cause by that the location where my Visual Studio 2017 files were saved, was a cloud drive and it actually had to sync the files before showing the data.
The solution was to mark that whole folder "Always keep on this device".
Cheers,
​Here is one possible solution:
I had this error never seen - then my graphics card (Nvidia) was gone and I removed the graphics card and worked with the integrated Intel. Then I got this error in after 3-4 steps. I installed a Nvidia again and now the "getting data" text message was never shown again.
Btw: this was the fix for the error
"64 bit debugging operation is taking longer than expected"
I had the same issue when I wanted to evaluate variables while debugging in my Unit tests and couldn't find any solution.
This is the solution that helped me: Tools -> Options / Debugging / General. Uncheck "Call string-conversion function on objects in variables windows".
This might only work for some people.

Xcode cannot stop a running task

There is a problem when I run a C++ program in Xcode. There is always a session saying Debug xxx, but this cannot be stopped. There is no problem with the code.
Some screenshots here:
I have also experienced this issue, and I have a couple things that may work. Note these are not bug fixes, but workarounds - they may not work in your case. However, I hope they do...
Try in sequential order...
Click (upper bar) -> Product -> Stop, though you may have tried this.
Click (upper bar)-> Product -> Clean. This may stop the errant task.
Quit Xcode and reopen. In my experience, this almost always stops the "running" task.
Though I haven't needed to get this far, it may help to force quit XCode (command+option+escape) or restart the computer.
To prevent it from happening in the future, be sure to always stop the run before you unplug the phone you are running it on (at least, that's what caused it for me). Stop it by going to (upper bar) -> Product -> Stop.

Eclipse for C++ - debugger not stopping at breakpoints

So I've seen some similar threads, but none had a fix for me.
My debugger is not stopping at breakpoints for some reason. I can set the breakpoint, and it shows as a breakpoint in the debugging perspective, but the debugger doesn't stop when I hit 'resume'. It means I need to manually step into where I need to go. Very inconvenient.
Also: Ignore all breakpoints is NOT set.
Solved this. It was a matter of setting Eclipse to run "as Administrator". Damn windows.
Running under Ubuntu 18.04LTS in a VirtualBox VM.
This answer pertains to Eclipse PTP.
By default, double clicking on the left margin was adding PTP Breakpoints (I am not familiar with PTP debugging).
Those apparently do not make debugging stop.
I right-clicked on a breakpoint -> Breakpoint Types -> C/C++ Breakpoints, and it started inserting this other "usual" type of breakpoints.
You can tell one from the other, as they are indicated with large green vs. small purple circles.