jdl
jdl

Reputation: 6333

How to view Objective-c( assembly code equivalent) at the break point?

How to view XCode( assembly code equivalent) at the break point?

I have gone to Thread1 and it shows objective-c for the [ViewController viewDidLoad] and then assembly for [UIViewController view] and [UIWindow makeKeyAndVisible]. I want to be able to see the assembly for [ViewController viewDidLoad] with the marker at the break pt?

(Product->GenerateOutput->Generate Assembly File: doesn't show the break pts.)

thx

void addme(int *a)
{
    *a += 0xFF;// <-- I want to see the assembly for this:  should see an instruction "ADD" in the assembly break down
    *a += 1;
    *a += 2;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    int a = 12;
    addme(&a);
}    

Upvotes: 3

Views: 553

Answers (3)

user529758
user529758

Reputation:

And it's also likely that you won't see an assembly ADD instruction at all, since compile time constants are calculated and thus optimized away by the compiler at compile time.

Upvotes: 1

loler
loler

Reputation: 2587

@jdl At the matter of fact i don't know Objective-C and @Dustin doesn't know asm... As i understood viewDidLoad function will execute a code in it when some object is loaded. In my opinion you can compile only that part of code which you included in your question and look into assembly code via IDA pro for Mac OS or some other debugger.

Upvotes: 0

Dustin
Dustin

Reputation: 6803

Steps:

  1. Put breakpoint where you want to see the assembly code
  2. Run program
  3. Once program pauses hit the button that looks like ->| (but pointing down)
  4. Repeat step 3 a lot
  5. Dance
  6. See the world
  7. Wonder at the joys of life
  8. Pop bottles
  9. Grow old
  10. Die

I'm not quite sure this is what you're asking for, but I just did it (well, steps 1-5 & 8) and it worked for me.

enter image description here

It's at the bottom of the screen, above the console.

Upvotes: 2

Related Questions