53

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!

pkamb
  • 33,281
  • 23
  • 160
  • 191
Breton
  • 15,401
  • 3
  • 59
  • 76

3 Answers3

147

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).

Mike Fahy
  • 5,487
  • 4
  • 24
  • 28
  • 1
    How would this setting look like in Xcode 4.4? I have unchecked the option "Show Disassembly When Debugging", but still get the assembler window. – AlexR Aug 22 '12 at 12:39
  • Should be the same, but note that the conditions @PeterHosey mentions above remain true, too. Make sure you're viewing your source code, and that debug symbols are not stripped. – Mike Fahy Sep 04 '12 at 22:07
  • 4
    what about XCode6? it is now "Always show Disassembly", it's unchecked on my end and it's going too deep. – Andrei G. Oct 01 '14 at 03:28
  • @AndreiG. What do you mean by "going too deep?" Does the setting not seem to work the same as in the past? – Mike Fahy Oct 07 '14 at 18:33
  • 11
    @VeryVito Unchecking "Always Show Disassembly" does not prevent the debugger from showing the disassembly in Xcode 6.1. I have to assume this is a bug. – woz Oct 22 '14 at 20:38
  • 2
    Has anyone been able to find a way to prevent the debugger from showing disassembly in Xcode 6.1? When I run my code and I step into or step over at the end of a block of code it always takes me to the assembly even when I don't have Always Show Disassembly unmarked. Is there an explicit mark to Never Show Disassembly? – MichaelGofron Dec 01 '14 at 19:26
  • @jacks4jokers and woz: I'm not seeing the same behavior (to be fair, I'm using 6.1.1 now). Without being able to replicate, I can only suggest reviewing the symbol-stripping settings within a given target's Build Settings. Sounds like debug symbols are being stripped somewhere along the way. – Mike Fahy Dec 02 '14 at 20:43
  • @VeryVito Thank you! You saved me some hair – Brad Pitcher Aug 07 '15 at 20:55
  • "Hundred years old". Got it! – Jamil Jun 01 '16 at 12:23
  • This helped Debug Workflow -> Alway Show Disassembly – Surendra Kumar Jun 29 '22 at 16:54
11

There are two other things to make sure of:

  1. 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.
  2. 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.
Peter Hosey
  • 95,783
  • 15
  • 211
  • 370
2

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"

Breton
  • 15,401
  • 3
  • 59
  • 76