I remember using turbo c++ compiler where I could do line by line code debugging technique, and was a great tool for both learning and debugging. Is there the similar way to do in Xcode. Are there any other way rather that putting break points??
From Product->Debug menu (Xcode 4.+), try the following options (they provide quite a similar functionality ):
Step Over (F6)
Step Into (F7)
Step Out (F8)
Manual : Debugging with Xcode
Related
Aside from the generator for a struct's memberwise initilizer, does Xcode have a "Generate Initializer" command similar to IntelliJ's "Generate Constructor"? If not, is there a way to make one? I'm looking to speed up my dev process a bit.
I'm not sure if this works in objective-c, but this works in Xcode with swift. If you right-click on the class name in its declaration, you can select refactor->generate memberwise initializer.
For Objective-C, just type init on a blank line somewhere at file scope within the #implementation and the autocomplete menu will offer some ready-made init method snippets. (This is just Xcode's general code snippets functionality. You can create your own snippets to work just like that.)
I'm following this tutorial about Instruments. The tutorial provides a sample project to test the steps described on it.
The problem is that, when I check "Show Obj-c Only" and "Hide System Libraries" flags, all the lines in call tree list is hidden, but the code in the project is written in Obj-C. Is there something I have to change in the configuration to see the project lines as in the tutorial?
Call tree list image taken from the tutorial showing how it must to be:
Screenshot of my instruments execution:
Ok, I don`t really know what happens here, but now it works. How?
What I did:
Erase the app in the device
Kill xCode ( using activity monitor )
Restart the computer ( Only restarting xcode didn't work )
Restart the device.
Clean the project
Try again.
May be is not the best answer, but it worked for me.
[UPDATE] The issue is there again, so I try this: Xcode 4 Instruments doesn't show source lines
And it works!
When I'm debugging my application something is not right, and I can't continue.
So is it possible to see the output code of my app while I'm testing it to see what is wrong?
I open the output window but nothing happens in there it's just stay blank.
In two words: I want to see what my app is actually doing while I'm testing it.
I'm using Visual Studio 2010.
So is it possible to see the output code of my app while im testing it to see what is wrong?
Yes, but you actually have to output something, otherwise nothing will show up. In VB.NET (which is the language you're using if you have Visual Studio 2010), this is accomplished with the following code:
Debug.Print("Here is some text that will be output.")
The documentation for the Debug.Print method is here. In order to call it like that, you will also have to have imported the System.Diagnostics namespace. You do so by placing the following line at the top of your code file (with all the other statements that look like it):
Imports System.Diagnostics
The output will automatically appear in the Output Window. If you still don't see anything, ensure that output is not being redirected to the Immediate Window instead: Tools -> Options -> Debugging -> General -> uncheck the option "Redirect all Output Window text to the Immediate Window".
Confusingly, you use the word "code" in your question, saying that you wish to "see the output code of [your] app while testing it". I'm not sure if by "code" you actually mean "output", in which case the solution above will work for you.
If you actually mean code, as in your program's source code, then you can use the Break toolbar button (or press Ctrl+Break) in the IDE to pause the execution of your program. This will automatically dump you back into the code editor with the currently-executing line of code highlighted.
Visual Studio has some very powerful debugging tools. If you don't already have a general idea of how to use them, I strongly recommend picking up a book on either it or VB 2010 that will teach these things to you. They can be very confusing to learn by trial and error, but are not all that difficult if you have a good guide. Spend that time debugging your code, not figuring out how to use the IDE.
I'm using Xcode4 and the debugger keeps jumping into .asm code when I select jump over. I don't know .asm and just want the next line of ObjC code. Is there some setting to have it not show the .asm code?
Thanks!
Which debugger you are using? LLVM or GDB. (You can find out at the menu product->edit scheme as shown figure below).
If the debugger is LLDB, try to switch it back to GDB and see that fix your problem.
First off, it is nice that they are trying to get code completion on the gdb command prompt in Xcode 4. But in its current state, it makes using the command prompt to investigate objective c objects nearly impossible - when I'm typing, it autocompletes the word to something I didn't want, and there is no way to undo this without manually selecting the text and removing it, then starting over.
I should probably file a bug with apple for this, but in the meantime, does anyone have a work around for this (like say, turning off auto-completion for the debugger without turning it off for code editing - I like auto-completion in obj-c because method names are so long :).
The closest I've come to solving this incredibly annoying problem is to turn off automatic code completion in general (Preferences > Text Editing > Suggest Completions While Typing) and then hit esc whenever I actually do want code completion.