Xcode 6.3.2(6D2105) debugging code

Greetings,


I am not having a problem compiling or locating an error. I am wondering if there is a way to actually look deeper into what is happening behind the scenes. For example I am presently reading a book on Mathematics to Genereric programming. I have found this book to be very enlighting so far but I am trying to under what is happening to the code behind the scenes. I know in Visual studios the IDE will show you the binary while debugging. Is there a way I can see it with xcode as well? I will show you an example of the I am break pointing to so that I what's happening.


// Helper methods

bool odd(int n) { return n & 0x1; }

int half(int n) { return n >> 1; }


I want to see what is happening with the return n & 0x1 values. I was also trying to debug the bit shifting method as well to see the values and what is going on.


Here is the code I am running it against with some random values.


Again, the program works. I am trying to see what is happening with bit shift and the n & 0x1 code.


// Method

int multiply1(int n, int a)

{

if(n == 1) return a;

int result = multiply1(half(n), a + a);

if(odd(n)) result = result + a;

return result;

}


P.S.

I do realize the code is not optimized. I am just trying to get more details out of my debugging.

Can you be a bit more explicit about what you expect to see? For example, in the 'n & 0x1' case, aside from the function entry and exit sequence, the method is basically going to compile to a single instruction that and's together two values that you already know.


If you just want to be able to see the return value explicitly, then I'd suggest you rewrite 'multiply1' like this:


int multiply1(int n, int a)
{
     if(n == 1)
          return a;
     int h = half (n);
     int result = multiply1(h, a + a);
     int o = odd (n)
     if(o)
          result = result + a;
     return result;
}


That would allow you to see the intermediate results as you step through your method in the debugger.

You can do this in Xcode:

(An embedded screen shot should appear here)

The embedded graphic doesn't seem to appear when the post is saved.


In Xcode:

Debug/Debug Workflow/Always Show Disassembly

Hi.


I am developing an App which uses Mathematic and i need the codes to put together in Xcode. if you can advice me with a book or something else I can get some codes for Mathematic codes for Xcode.


Kind Regards

Xcode 6.3.2(6D2105) debugging code
 
 
Q