GNAT GPS Debugger - Could not initialize the debugger - debugging

I am attempting to debug my project in GNAT's GPS IDE. Every time I chose Debug->Initialize->"program name" the gui of GPS switches to that of the debug GUI, and then an error pops up with "could not initialize the debugger".
The two possible solutions I have found are that gdb.exe may be out of date and it suggests running it outside of GPS, which it does run fine. The other possible solution is to make sure the -g tags are applied when building the project, as those are necessary for gnatlink and gcc for debugging. It also states that the -g tag is applied to a new project by default, unless you have specifically removed it. I doubt I have, but I am not sure where I would check that to make sure it is still included.
The other odd thing is that the tutorial that comes with GPS that runs through how to build and debug your code works perfectly fine when I initialize debugging on it. That tutorial I am referring to can be accessed through Help->GPS->GNAT Programming Studio Tutorial. It references the program 'sdc' which comes in the GNAT/2012/share/examples/gps/tutorial directory.
Any ideas on what I am doing incorrectly, since the error isnt very helpful?
Thanks!

At first it sorta sounds like a path problem, but if you're able to run a debugger tutorial that's probably not the case.
The behavior you're seeing if the program isn't compiled with the debug (-g) flag doesn't quite match my experience, but let's go ahead and check/set the debug flag anyway.
Select Project/Edit Project_Properties
Click the Switches tab.
Click the Gnatmake tab.
Check "Debug information". Note that a -g now shows up in the text box at the bottom of the tab page. Click OK on the dialog.
Recompile your code so that it uses the changed option. Select Build/Clean/Clean All, and OK any dialog that pops up.
Then do your build (you can just press F4).

Related

Debuggin in Xcode

I'm toying with iPhone app development. Often times I would run into runtime error and I would have no idea where the error occurs (e.g. the exact line). In console app with GCC I could at least compile with the -g flag. dump a core file and read that core file in to get to the last line that got into trouble. But how would I do that in Xcode? Build and Debug doesn't seem to have the debugging symbol loaded.
Take a look at this link and see if it helps you.
http://developer.apple.com/iphone/library/documentation/DeveloperTools/Conceptual/XcodeDebugging/010-Debugging_Essentials/debugging_essentials.html
Cheers,
Kevin
You can just add a breakpoint by clicking the line numbers on the left-hand side of the code pane. Then the "Build and Run" button becomes "Build and Debug," and when your program reaches that point, it will stop.
From there you can click "step over," "continue," etc. to execute code one line at a time to find your errors and variable values. Hover the mouse over a variable name to find its value.

Xcode Build Options, etc. Tutorial

I've worked on a few projects now, and I've had to change the framework search paths, set the bundle loader, etc.
But I've never felt totally comfortable with that Project (or Target) "Get Info" window. I still don't know what half the stuff in there is, and whenever I change anything, there's always a bit of finger-crossing when I click Build. Building and linking all feels a little "magical" to me right now.
I assume this feeling isn't normal. Does anyone know of any good tutorials for these non-code-related parts of building an app?
When you select a build setting, Xcode 4 will show a short description in its Quick Help, which is in one of the Inspectors you can show on the right side of the window.
In Xcode 3, the description will appear at the bottom of the Info window that tells you what the setting does. In even older versions, click on the stack of books with the pair of spectacles on top.
If you're still stumped and the setting in question corresponds to a GCC option, you can look it up in the GCC manual. If it doesn't correspond to a GCC option, Google it.
All (as far as I can tell) of the build settings are documented in the Xcode Build Setting Reference, although some of these are more useful as output (e.g., environment to a shell script phase) than as input (actual settings). Indeed, a few of them, such as ACTION, only appear as output; you can't set them in the Info window, and wouldn't want to.

breakpoint will not currently be hit, why not?

Sometimes I get the message that the breakpoint will not be hit, and no symbols will be loaded.
The red icon in vs.net changes color, and the debug mode just doesn't work.
what is the reason for this?
You may be running your project in Release mode. If so, then switch to Debug mode
From Visual studio debugging issue with files of the same name by Philip Carney
Do each bullet in the link below ONE AT A TIME, but repeat my steps below with each one you try.
Stop debugging (press red square icon) in Visual Studio
Clean Solution
Build Solution
Tools > Attach to Process (or start with debugging)
Start the program that you're attaching to, and run it such that your code will get hit
If attaching to nunit.exe, then open NUnit and run a test so your breakpoint will be hit
If attaching to w3wp.exe (IIS site), then open your site in the browser and go to the page that will hit your breakpoint
for manage code only - theres a good answer for this problem on the following site:
http://geekswithblogs.net/dbutscher/archive/2007/06/26/113472.aspx
for native + managed code - in the startup solution properties-> Debug tab
make sure that "enable unmanaged code debugging" check box is checked
After trying several suggested fixes for this I did the following to get it working.
Right Clicked my Project in the Solution Explorer and selected "Properties".
Went to the "Web" section and made sure "Start Action" was set to "Current Page".
Spent 3 1/2 hours on that... I'm going to go get a drink now.
I resolved this problem by selecting Automatic:Native Code for the "Attach to" field in "Attach To Process" form
Next to the "Debug/Release" dropdown list, there is another one with "Any CPU/Configuration Manager...". Click "Configuration Manager...", and you will see some of your projects might be in Release mode. Change all of them to Debug.
This can happen if the symbol fiels are different from the assembly (remote debugging), or when there is no "direct path", so the assembly hasent been load, but might be loaded using reflection and loading of the required assembly at run time.
This can also happen if the debugger is not attached to the process for whatever reason. If it's the case, you can always go to Debug - Attach to Process... and choose the right process. Your breakpoints should return to normal once VS determines it can hit them.
What does it say when you hover the mouse over the disabled breakpoint? It will usually tell you the problem. My favorite is the old 'source code is out of date', especially when I'm debugging a DLL. Another favorite is when the file you're looking at isn't the one you're debugging (a copy in another folder?). If it's a case where you can breakpoint a caller routine, but not the callee, stepping into the callee will force VS to open the 'proper' source file and you'll be able to set breakpoints. Confusing, I usually swear at VS at this point, it seems to help.
I had the same problem. Which I know is normally if the build versions are different, and something isn't matching up. I cleaned my project, rebuilt it, and then deployed and that got everything back in-sync.
I do not like to play with knives but the only thing that worked for me involved editing the .csproj file itself. So, unload the project file, edit it by cutting and pasting the three asp.net files so that they are together in the ItemGroup. However, sometimes it is necessary to go further as explained here: http://carnotaurus.tumblr.com/post/4130422114/visual-studio-debugging-issue-with-files-of-the-same - Also, I give a list of other proposed solutions that did not work for me. I hope it helps.
I have tested with both deployed application and service, what I have found out that If the deployed code is different than a code in visual studio then breakpoint will not hit. Even small changes will affect and the breakpoint will not hit. So, It is better to debug the same version which is there on vs code and also in deploy application or service.
To fix this I had to re-create the virtual directory. I'm using Asp.Net 4.7 Framework and IIS Express. Went to Web project > property page > Web tab > clicked the "Create Virtual Directory" button next to Project Url textbox.
I forgot I had clicked this button in my "Main" branch, but then had switched to my "Sprint" branch. It kept running the "Main" code until I clicked "Create Virtual Directory" on my "Sprint" branch.
For me it was giving this because I haven't started the relevant project at start of application , it worked after I added project run on start

Edit and Continue: "Changes are not allowed when..."

Even if I create a clean WinForms project, Edit and Continue doesn't work and gives me the error:
Changes are not allowed when the debugger has been attached to an already running process or the code being debugged was optimized at build or run time.
Edit and Continue option is checked in Tools → Options → Debugging.
Optimization is not enabled.
Seems like there is no any managed profiler set up.
I am running in Debug mode
I am running on x64 CPU and Windows XP 32-bit, but setting platform target to x86 rather than AnyCpu doesn't help.
Repairing Visual Studio installation doesn't help.
I also found this article on MSDN website:
Unsupported Scenarios
Edit and Continue is not available in the following debugging scenarios:
Debugging on Windows 98.
Mixed-mode (native/managed) debugging.
SQL debugging.
Debugging a Dr. Watson dump.
Editing code after an unhandled exception, when the "Unwind the call stack on unhandled exceptions" option is not selected.
Debugging an embedded runtime application.
Debugging an application with Attach to rather than running the application with Start from the Debug menu.
Debugging optimized code.
Debugging managed code when the target is a 64-bit application. If you want to use Edit and Continue, you must set the target to x86. (Project Properties, Compile tab, Advanced Compiler setting.).
Debugging an old version of your code after a new version failed to build due to build errors.
But I can answer "No" to every item in this list.
It worked before, but several days ago it stopped working, and I don't know what could be the reason.
Other Applicable Solutions:
Below is an incomplete, unordered list of possible solutions to try if you* are trying to fix Edit & Continue quickly.
Make sure you are in Debug Mode
Make sure you're not launching a mixed mode process
Try to set the CPU target to x86 rather than AnyCPU (on x64 machines)
Uncheck the Optimize Code checkbox for Debug Mode in Project Properties->Debug
Uncheck the Optimize Code checkbox in Project Properties->Build
Uncheck Enable Optimizations in Advanced Compiler Settings
(ASP.NET) Check nightcoder's answer if it is the case
(ASP.NET) Check this answer (by matrixugly) if it is the case
(ASP.NET) Ensure you have Edit and Continue enabled on the Web tab (vs2010)
(ASP.NET) Go to Properties > Web > Servers, and make sure that Enable and continue is checked under Use Visual Studio Development Server.
(ASP.NET WebAPI) Make sure you've stopped in the Controller's method using a breakpoint, before trying to edit it.
(vs2017) Go to Tools > Options > Debugging and uncheck (deselect) 'Edit and Continue'. This is actually the opposite of the 'conventional' advice (see some other points in this post). It does not allow you to actually make changes in your running program (i.e. it does not hot-swap the code changes that you make) - it simply allows you to edit your code (i.e. it prevents that annoying message and "locking" your editor).
Go to Tools > Options > Debugging > General and make sure Require source files to exactly match the original version is unchecked.
Check Enable Windows debug heap allocator (Native only) [VS Community 2017]
Are you using Microsoft Fakes? It inhibits Edit & Continue.
Kill all the *.vshost.exe instances by selecting End Process Tree in the Task Manager. VS will regenerate a correct instance.
Remove all the breakpoints with Debug->Delete All Breakpoints
Enable and Continue exists in both the Tools > Options > Debugging menu and also in the Project Settings. Be sure to check both places. edit & Continue is not supported with the extended Intellitrace setting.
Be sure Debug Info in Project Properties > Build > Advanced > Output > Debug Info is set to Full
Some plugin may be interfering. Check by disabling/uninstalling and then trying again the other solutions.
If you're not paying enough attention, the error you get while trying to fix this may change to something else that is easier to diagnose. E.g. A method containing a lambda expression cannot support edit and continue.
Make sure the System variable COR_ENABLE_PROFILING is not set to 1. Some profilers set this when installing and leave it like that after uninstalling. Open a command prompt and type set to quickly check it your system is affected, if so remove the variable or set it to 0:
In Windows 8 and above, search for System (Control Panel).
Click the Advanced system settings link.
Click Environment Variables.
Remove COR_ENABLE_PROFILING
Be aware of unsupported scenarios (as reported in the question) and that unsupported edits.
* by 'you', I mean the visitor of the page who is hammering his head on a keyboard to find The solution.
Feel free to edit this answer to add your workaround if not listed here!
If you're debugging an ASP.NET application, go to properties > web > Servers, and make sure that "enable and continue" is checked under Use Visual Studio Development Server.
I finally got to solve the problem: UNINSTALL Gallio
Gallio seems to have quite some many rough edges and it's better to not use MbUnit 3.0 but use the MbUnit 2.0 framework but use the gallio runner, that you are running without installing from the installer (which also installed a visual studio plugin).
Incidentally, I had the issue even after "disabling" he Gallio plugin. Only the uninstall solved the problem.
PS. Edited by nightcoder:
In my case disabling TypeMock Isolator (mocking framework) finally helped! Edit & Continue now works!!!
Here is the answer from TypeMock support:
After looking further into the edit
and continue issue, and conversing
about it with Microsoft, we reached
the conclusion it cannot be resolved
for Isolator. Isolator implements a
CLR profiler, and according to our
research, once a CLR profiler is
enabled and attached, edit and
continue is automatically disabled.
I'm sorry to say this is no longer
considered a bug, but rather a
limitation of Isolator.
I had the same problem. I even re-installed VS 2008 but the problem did not go away. However, when I deleted all the break points then it started to work.
Debug->Delete All Breakpoints
I think it was happening because I had deleted an aspx page that had break points in its code, and then I created another page with the same name. This probably confused the VS 2008.
"Edit and Continue", when enabled, will only allow you to edit code when it is in break-mode: e.g. by having the execution paused by an exception or by hitting a breakpoint.
This implies you can't edit the code when the execution isn't paused! When it comes to debugging (ASP.NET) web projects, this is very unintuitive, as you would often want to make changes between requests. At this time, the code your (probably) debugging isn't running, but it isn't paused either!
To solve this, you can click "Break all" (or press Ctrl+Alt+Break). Alternatively, set a breakpoint somewhere (e.g. in your Page_Load event), then reload the page so the execution pauses when it hits the breakpoint, and now you can edit code. Even code in .cs files.
Couple of things to check
Make sure your compile is set to Debug vs. Release
Make sure you're not launching a mixed mode process
If on a 64 bit machine Make sure to set the CPU target to x86 rather than AnyCPU
EDIT
I don't believe this should matter but make sure that the hosting process is enabled for the target platform. Probably won't help.
If it repros for new projects then it might be something even more subtle. I would try the following.
Backup HKCU:\Software\Wow6432Node\VisualStudio\9.0 (maybe just rename it)
Delete the same key
Try the repro again
None of the above solutions worked for me(running on a 64x machine).
Finally I clicked on 'advanced compiler settings' and UNCHECKED 'enable optimizations' and I can now step through code and edit while debugging.
For me, for a reason that I don't understand, the setting "Generate debug info" in the "Advanced Compiler Settings" was set to "pdb-only" instead of "Full".
By default, this parameter is always set to "Full" but a mysterious poltergeist has changed this parameter on last night. :)
P.S. I'm in Visual Basic .Net with Visual Studio 2010
If your concern is with an ASP.NET app, ensure you have edit and continue enabled on the web tab (vs2010). There was also a separate setting for ASP.NET debugging in earlier versions.
Regards,
Adam.
I found that even though under project properties build & debug tab are set to Debug and all the other setting are correct I still get the message, however after digging some more
under the Build menu select Configurations Manager... and make sure Debug is selected in two places there as well. go figure...how many different places do they need to set debug?????? even though you set Project - Configuration to Debug then under Build - Manager it is not changed so you have change the same setting there as well Project Configuration - seems like a microsoft issue again.......
This problem is due to Intellitrace setting
If Intellitrace is enabled make sure Intellitrace event only is checked
Otherwise this will not allow edit and continue..
If you will click on Intellitrace options you will see the warnings.
Following shooting helped me using VS2010:
go to Tools, Options, Debugging, General and make sure "Require source files to exactly match the original version" is unchecked.
That happens when the debugger hasn't hit a breakpoint or you haven't hit Break All (pause). It couldn't be that simple could it?
The error says a possible cause is: "the code being debugged was optimized at build or run time". Go to Project Properties->Debug and uncheck the Optimize Code box for Debug mode.
I had this problem in Microsoft Visual Studio 2008 and the solution is easy. when you run your project please set in "Debug" mode not "Release". The another people solution can be useful.
If I create a new project, edits while debugging do not work. If I create a new website, edits while debugging work as expected.
I ran into this today - turns out that having Debug Info set to pdb-only (or none, I'd imagine) will prevent Edit and Continue from working.
Make sure your Debug Info is set to "full" first!
Project Properties > Build > Advanced > Output > Debug Info
In my case just reseting to default debugger settings and setting IntelliTrace-> only intellytrace events helps
Some things that seemed to help using VS2010:
go to Tools, Options, Debugging, General and make sure "Require source files to exactly match the original version" is unchecked.
multiple .vshost.exe instances can be left over from e.g. detaching the VS debugger from a stopped process. This will interfere with breakpoints and compiles as well. Use Task Manager, Processes tab to kill all instances of .vshost.exe by right-clicking each instance and selecting End Process Tree. VS will create a new instance.
I removed a dataset from my project because I didn't use it. After that I could modify the program when debugging.
I did all the changes mentioned in every other answer and none worked. What did I learn? Enable and Continue exists in both the Tools > Options > Debugging menu and also in the Project settings. After I checked both, Enable and Continue worked for me.
Seems illogic, but only way was disabling edit and continue from VS 2017 options... Then AspNet edit and continue began to work...
what worked for me was unchecking "Use Managed Compatibility Mode" under
Tools -> Options -> Debugging
TBN: checking or unchecking "Require source file to exactly match the original version" seems not influences the E&C
Hope this can help.
Enable edit and Continue only work run IIS Express.
Don't work in Local ISS or External Host.
I'm adding my answer because the thing that solved it for me isn't clearly mentioned yet. Actually what helped me was this article:
http://www.rubencanton.com/blog/2012/02/how-to-fix-error-changes-are-not-allowed-while-code-is-running-in-net.html
and here is a short description of the solution:
Stop running your app.
Go to Tools > Options > Debugging > Edit and Continue
Disable “Enable Edit and Continue”
Note how counter-intuitive this is: I had to disable (uncheck) "Enable Edit and Continue".
This will then allow you to change code in your editor without getting that message "Changes are not allowed while code is running".
Note however that the code changes you make will NOT be reflected in your running program - for that you need to stop and restart your program (off the top of my head I think that template/ASPX changes do get reflected, but not VB/C# changes, i.e. "code behind" code).
I install the stackify, when i enable this on icon tray, it stop my debugging with edit, so i found
Close the visual studio , in my case its vs2017
Go to icon tray and right click on stackify icon and disable .NET Profiler
Open Visual studio run application again in debug mode with debugger and it allow me edit while debugging
I had this annoying issue since I upgraded my VS 2019 to 16.4.3 and caused me a lot of headache.
Finally I solved the problem this way:
1. Stop Debugging
2. Select the solution from "Solution Explorer"
3. In the Properties window change the "Active config" Property From "Release|Any CPU" To "Debug|Any CPU"
4. In Debug > Options > General Check the Edit and Continue checkbox
That worked for me, and hope it works for you too.
embed interop types visual studio should be set to false
I had this happen in a linked class file. The rest of the project allowed E&C, but I got the same error editing the linked file. Solution was to break linked file into it's own project and reference the project.
I faced the same problem. My problem was that I could modify a file, but not another (both are in same project). Later I found that the file I couldn't modify was also part of another project. That another project (Unit Test) wasn't loaded, and intelligent VS debugger shows the error that assembly for this given file was not loaded, and changes aren't allowed. How weird!
Hence, I had to unload the unit-test project and continue the EnC debugging.

Why aren't Xcode breakpoints functioning?

I have breakpoints set but Xcode appears to ignore them.
First of all, I agree 100% with the earlier folks that said turn OFF Load Symbols Lazily.
I have two more things to add.
(My first suggestion sounds obvious, but the first time someone suggested it to me, my reaction went along these lines: "come on, please, you really think I wouldn't know better...... oh.")
Make sure you haven't accidentally set "Active Build Configuration" to "Release."
Under "Targets" in the graphical tree display of your project, right click on your Target and do "Get Info." Look for a property named "Generate Debug Symbols" (or similar) and make sure this is CHECKED (aka ON). Also, you might try finding (also in Target >> Get Info) a property called "Debug Information Format" and setting it to "Dwarf with dsym file."
There are a number of other properties under Target >> Get Info that might affect you. Look for things like optimizing or compressing code and turn that stuff OFF (I assume you are working in a debug mode, so that this is not bad advice). Also, look for things like stripping symbols and make sure that is also OFF. For example, "Strip Linked Product" should be set to "No" for the Debug target.
In Xcode 7, what worked for me was:
Make sure that the Target > Scheme > Run - is in Debug mode (was Release)
Make sure to check the option "Debug executable":
Go to the Xcode Debugging preferences.
Make sure that "Load Symbols lazily" is NOT selected.
I was just having this same issue (again). After triple-checking "Load symbols lazily" and stripping and debug info generation flags, I did the following:
quit Xcode
open a terminal window and cd to the project directory
cd into the .xcodeproj directory
delete everything except the .pbxproj file (I had frank.mode1v3 and frank.pbxuser)
You can accomplish the same task in finder by right/option-clicking on the .xcodeproj bundle and picking "Show Package Contents".
When I restarted Xcode, all of my windows had reset to default positions, etc, but breakpoints worked!
One of the possible solutions for this could be ....go to Product>Scheme>Edit scheme>..Under Run>info>Executable
check "Debug executable".
For Xcode 4.x:
Goto Product>Debug Workflow and uncheck "Show Disassembly When Debugging".
For Xcode 5.x
Goto Debug>Debug Workflow and uncheck "Show Disassembly When Debugging".
Another reason
Set DeploymentPostprocessing to NO in BuildSettings - details here
In short -
Activating this setting indicates that binaries should be stripped and
file mode, owner, and group information should be set to standard
values. [DEPLOYMENT_POSTPROCESSING]
See this post: Breakpoints not working in Xcode?. You might be pushing "Run" instead of "Debug" in which case your program is not running with the help of gdb, in which case you cannot expect breakpoints to work!
Issue
Background
Xcode: 13.0
code: Objective-C
Issue: added breakpoint, but not work
(possible) Reason and Solution
Reason: Xcode bug
Solution: Product ->Clean Build Folder, then retry debug (multiple time)
Reason: disabled Debug
Solution: enable it: Product->Scheme->Edit Scheme->Run->Info
Build Configuration set to Debug
choose/select/enable: Debug executable
Reason: disabled all breakpoint
Solution: enable it: Debug panel -> click breakpoint icon
Reason: debug info be optimized
Solution: not optimize
click Project -> Build Settings -> Apple Clang - Code Generation -> Optimization Level -> Debug make sure is None[-O0]
Related
XCode's Symbolic breakpoint not work
Background
XCode crash log
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSCFConstantString stringByAppendingString:]: nil argument'
add XCode symbolic breakpoint
-[__NSCFConstantString stringByAppendingString:]:
but breakpoint not working
Solution
change to:
-[NSString stringByAppendingString:]
related doc: stringByAppendingString:
Solution for me with XCode 9.4.1 (did not stop at any breakpoint):
Under build Target -> Build Settings -> Optimization Level:
Switched from "Optimize for speed" -> "No optimization" (now it's slower but works)
What solved it in my case was quite simple, in Xcode - Product - Clean Build Folder followed by Product - Run (not the Play Xcode button).
(Had the issue on Xcode 11 -beta 4 after switching to unit testing with Xcode play button long press)
This had me in Xcode 9 for half a frustrating day. It ended up been a simple debug setting.
Go Debug > Debug Workflow and make sure 'Always Show Disassembly' is turned off. Simple as that. :(
Came to this page with the same problem (C code in Xcode 6 not stopping at breakpoints) and none of the solutions above worked (the project was practically out of the box, settings-wise, so little chance for any of the debugger settings to be set to the wrong value)...
After wasting quite some time reducing the problem, I finally figured out the culprit (for my code):
Xcode (/LLVM) does not like Bison-style #line preprocessor commands.
Removing them fixed the problem (debugger stopped at my breakpoints).
For Xcode 4:
go Product -> Debug -> Activate Breakpoints
This is applicable for all Xcode version. Shortcut key is: command key + Y. Press this key combination to activate/deactivate breakpoints.
I have a lot of problems with breakpoints in Xcode (2.4.1). I use a project that just contains other projects (like a Solution in Visual Studio). I find sometimes that breakpoints don't work at all unless there is at least one breakpoint set in the starting project (i.e. the one containing the entry point for my code). If the only breakpoints are in "lower level" projects, they just get ignored.
It also seems as if Xcode only handles breakpoint operations correctly if you act on the breakpoint when you're in the project that contains the source line the breakpoint's on.
If I try deleting or disabling breakpoints via another project, the action sometimes doesn't take effect, even though the debugger indicates that it has. So I will find myself breaking on disabled breakpoints, or on a (now invisible) breakpoint that I removed earlier.
I've had my breakpoints not work and then done Build / Clean All Targets to get them working again.
I think the problem could be incompatibility between device versions and Xcode. I have this problem when attempting to debug on my iPhone 4S running iOS 5.0.1. I am still using Xcode 3.2.5. I got the symbols from the handset by selecting "use this device for development" in the Organiser window. This phone refuses to breakpoint however. My old 3GS will breakpoint, same Xcode project, same settings... just different device and it's running iOS 4.0. I guess this is an Xcode bug in 3.2.5, since I have the symbols. Having tried all the solutions posted here so far, I have decided the solution to my problem is to go ahead and upgrade to XCode 4. Perhaps you cannot debug effectively unless your base SDK is at least as high as the system on which to debug. Maybe that's obvious - can anyone confirm?
Edit: I will update when I can confirm this is true.
Deleting my Build folder solved the problem for me.
If all else fails, instead of a breakpoint, you can call the following function:
void BreakPoint(void) {
int i=1;
#if !__OPTIMIZE__
printf("Code is waiting; hit pause to see.\n");
while(i);
#endif
}
To resume, manually set i to zero, then hit the resume button.
It has happened the same thing to me in XCode 6.3.1.
I managed to fix it by:
Going to View->Navigators->Show Debug Navigators
Right click in the project root -> Move Breakpoints (If selected the User option)
(I also Selected the option share breakpoints, even though I'm not sure if that necessary).
After doing that change I set the Move breakpoints options back to the project, and unselecting the Share breakpoints option, and still works.
I don't exactly know why but this get my breakpoints back.
For this, and also for Xcode 6 and above make sure that the breakpoint state button is activated (the blue arrow-like button):
In Xcode 4
- Product menu > Manage Schemes
- Select the scheme thats having debugging problems (if only one choose that)
- Click Edit button at bottom
- Edit Scheme dialog appears
- in left panel click on Run APPNAME.app
- on Right hand panel make sure youre on INFO tab
- look for drop down DEBUGGER:
- someone had set this to None
- set to LLDB if this is your preferred debugger
- can also change BUILD CONFIGURATION drop down to Debug
- but I have other targets set to AdHoc which debug fine once Debugger is set
I found the problem. Somehow the "Show Disassembly when debugging" was enabled in my XCode which creates that problem. When I disabled it, all my debugger stopped in my source code.
You can find it under: Product->Debug Workflow->Show Disassembly when debugging.
You can Activate / Disactivate Breakpoints in dropdown menu
I tried all the above things but for me only deactivating the debugging breakpoints once and then activating them worked.
When setting your break point, right click and you should get several options about how the break point is handled (log vars and continue, pause execution, etc)
Also make sure the "Load Symbols lazily" is not selected in the debug preferences.
(Applies to Xcode 3.1, not sure about past/future versions)
Also make sure that the AppStore distribution of the app is not also installed on the device.
Another thing to check is that if you have an "Entitlements" plist file for your debug mode (possibly because you're doing stuff with the Keychain), make sure that plist file has the "get-task-allow" = YES row. Without it, debugging and logging will be broken.
There appears to be 3 states for the breakpoints in Xcode. If you click on them they'll go through the different settings. Dark blue is enabled, grayed out is disabled and I've seen a pale blue sometimes that required me to click on the breakpoint again to get it to go to the dark blue color.
Other than this make sure that you're launching it with the debug command not the run command. You can do that by either hitting option + command + return, or the Go (debug) option from the run menu.
I have Xcode 3.2.3 SDK 4.1 Breakpoints will fail at random. I have found if you clean the build and use the touch command under build they work again.

Resources