Breakpoints in XCode debugger - xcode

I don't understand what's going on with the XCode debugger. I am using Xcode 3.1.2 and GCC 4.0 on 10.5. Sometimes, Occasionally, I test a C++ program, all active breakpoints become disabled. No breakpoints are taken - the program runs to completion. The dark blue breakpoint icons change to light blue or yellow with a blue border. Looking at the breakpoints list (CMD-Opt-B ) after the change, the breakpoints that were tagged with a checkmark are now tagged with a hyphen. (how do I get a "checkmark" icon with markdown?)
This is after they have been functioning normally. Sometime later, they will usually begin functioning normally again. I don't know what is responsible for either change. I have closed/reopened the debugger, files, and the full project. Most often, the proper beakpoint status is restored when I trivially change a source file and do a "Build & Debug" (Cmd-Y), but that doesn't always fix things
I have seen the reports of problems about "GLIBCXX_DEBUG_" here and elsewhere. That isn't my problem because I am using GCC 4.0, and don't use those flags. I have also seen reports of a similar problem with a really old XCode. Again, I don't believe that applies to me. Any ideas?

When the breakpoint markers turn yellow it means that you have more than one program being actively debugged by GDB. Try exiting all the programs except for the one you are currently debugging.

A yellow breakpoint symbol indicates the breakpoint is not loaded into the debugger. This can happen if you have more than one project running is what the previous answer was implying. Can also go yellow if you Run with breakpoints off instead of on.

Related

Visual Micro automatically inserts a breakpoint when no breakpoints are present

I am using the Visual Micro extension for Microsoft Visual Studio, which allows me to debug my Arduino project (in opposed to the Sketch IDE).
For some strange reason, when no breakpoints are present, it automatically adds a breakpoint at the beginning of the loop function.
When running via the debugger, I can simply remove it and continue running.
However, I cannot do the same when running without a debugger (i.e., upon power-up), since breakpoints seem to be "embedded" into the code as additional code segments (though I'm not really sure how explain the fact that the debugger allows me to remove a breakpoint).
Here is an illustration of the problem:
Now, I've been able to work-around it by adding a piece of "dead code" with a breakpoint:
if (0)
{
// insert a breakpoint here
}
But this feels kinda "clumsy".
I suppose that if there is a solution to this problem, then it lies somewhere in here:
But I have not able to find it, so any help will be highly appreciated.
Found the answer!
It turns out that all I needed was to hover on top of the breakpoint and read the tooltip carefully:
As you can read on the bottom line of this tooltip, in order to switch off that automatically-generated breakpoint, we only need to disable the Visual Micro's Tutorial Mode:
And voilĂ  - we're all done!

How do I disable line centering in Intellij Idea Debugger?

When debugging program in Idea (I'm using 14.1.5 Community Edition), it attempts to put the line I'm currently on close to the center of the screen. And it does so every single step. However, I find this default behavior very annoying, it looks like the code is jumping around.
I wonder if there a way to customize the debugger view in a way that the code would be fixed (as long as I'm not leaving one screen of code) and the current line highlighting would be moving around? (I didn't find it in the Debugger section of the settings.)
Many thanks.
You want to disable "Focus application on breakpoint" which is in the settings under Build,Execution, Deployment > Debugger - it's the first checkbox. It's help documentation reads:
If this check box is selected, on hitting a breakpoint, IntelliJ IDEA will show the location of this breakpoint in the editor and will attempt to bring its frame to the front.
This should do the trick.

Breakpoints dont work

When I set break point at some line and press Build&Go my breakpoints become yellow and my program continues. Nothing happens. I`ve unchecked Object Lazy ..., optimization levels, active target is Debug, load debugging symbols is checked. I also want to mention that my debugger never worked before.
Try "Build and Debug" instead.
Try to refresh the files you are working on, make sure you have build automatically set, clear all breakpoints, restart eclipse this might help.

Xcode breakpoints shifted at runtime

I have been searching for an hour or so here and on Google and cant find the answer as to how correct breakpoints being shifted during run. I have reinstalled Xcode(3.2.2), insured load lazily is off, no optimization in target settings, and every other target setting that might cause the problem. I have also destroyed all of the user project files (except for the main .pro file) and nothing seems to correct this. Yes, I am running with breakpoints on. Yes, I have done clean builds.
When I set a breakpoint, in the debugger the break stops two or 3 (or more lines) down in the source code, single stepping continues to show the wrong line. Also, in the debugger window the dark blue breakpoint symbol is gone, it does appear in an editor window.
This is driving me batty.
I had a similar problem (weirdly shifted breakpoints) but my issue turned out to be that I had the wrong target set, so the code I was modifying and setting breakpoints on wasn't even being rebuilt! But the executable would still run, using the old code, leading to what appeared to be oddly shifted breakpoints.
Sometimes Xcode gets confused about line numbering when your source files have inconsistent line endings, e.g. because you've been using different editors and may have a mixture of different line endings in your source file. You can use a tool like BBEdit or its free sibling TextWrangler to fix this problem.
With-in "Build Settings" under the project target change the "Optimization Level" for "Debug" to "None".
I found that this fixed the issue for me.

Xcode Debugger: Why is it only showing me assembler?

I'm just starting out with Cocoa development in Xcode, doing the hello world example. I'm up to step 6 of the section "runtime debugging", which is
Using the Step Over button in the debugger toolbar, begin stepping through the code. As each line of code executes, you can examine the program’s state. The value of a variable is sometimes drawn in red to indicate that the value was modified in the last step.
Notice that the debugger pauses before executing the indicated line. After each pause, you can add additional breakpoints or choose Debug > Restart to terminate the application and start a new debugging session.
now what I've been pulling my hair out for over the last hour is the fact that this debugger will only show me assembly code. I can manually select my source code file, but as soon as I click "Step over" I'm right back in assembler view. I can't for the life of me figure out how to turn the assembler off, and make it show me my source code!
I know this article is a hundred years old, but in case anyone is wondering how to address this issue in more recent Xcode versions (as opposed to Xcode 3), you'll find the appropriate setting labeled Always Show Disassembly under Debug>Debug Workflow in Xcode 6 and up. Ensure the option is NOT checked.
In Xcode 5, the option was labeled Show Disassembly When Debugging under Debug>Debug Workflow. Ensure that "Show Disassembly When Debugging" is unchecked.
Back in Xcode 4, the Show Disassembly When Debugging setting was found under Product>Debug Workflow. Again, ensure that the option remains unchecked.
This was driving me crazy, too.
NOTE: The information above is still valid for Xcode 14+. I've applied updates to this answer as new versions of Xcode have been released. Fortunately, the option has remained unchanged since Xcode 6 (so far).
There are two other things to make sure of:
That you're looking at one of your own functions/methods. If the stack frame you're looking at is a function or method from one of the frameworks, you're going to see assembly no matter how you have Xcode configured.
That you are running a Debug build. Strip debug symbols (as in a Release build), and you'll be looking at assembly even for your own code, no matter what.
I actually figured this out before I posted, but I wanted to save others potential future headaches, (and also in case I forget later) as I could not find the answer to this by searching stack overflow, but I did find that I'm not alone.
From the run menu, select "Debugger Display" > "Source Only", or "Debugger Display" > "Source and Disassembly"

Resources