Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Use of NSLog() for debugging



Many postings to this mailing list discuss using NSLog() for debugging. I'd like to encourage you to learn to use the debugger, not NSLog() because

- the debugger is the correct tool for debugging;
- it allows one to examine all sorts of things that might not have been anticipated when inserting NSLog() statements throughout one's code;
- it's much quicker because one doesn't have to add NSLog() statements, rebuild, and then remove (and possibly forget to remove) NSLog() statements afterward;
- adding NSLog() statements can affect execution, memory layout, etc. such that a bug might not occur after NSLog() statements have been added;
- <append other valid reasons here>

Learning enough of gdb to set breakpoints, examine variable values, and to control execution is sufficient for most debugging sessions (and there's PB GUI support for all of this - file:///Developer/Documentation/DeveloperTools/ProjectBuilder/ProjectBuilder.
help/Contents/Resources/English.lproj/Debugging/index.html). More sophisticated gdb commands can be entered into gdb's console in PB (file:///Developer/Documentation/DeveloperTools/gdb/gdb/gdb_toc.html).

Art Isbell
Apple iServices Technical Support
http://www.apple.com/iservices/webobjectssupport/
+1-808-591-0836


References: 
 >A bit stumped.... (From: email@hidden)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.