I knew about po, but sometimes it says the thing is nil, but then I'll go back to my code and write NSLog() statements, and it prints something out, so I felt like po wasn't reliable. Also, when accessing collections, it was easier to write loops in ObjC.

But I'll give this a shot, thanks!

On Oct 14, 2009, at 10:38:47, Kyle Sluder wrote:

On Wed, Oct 14, 2009 at 10:30 AM, Rick Mann <rm...@latencyzero.com> wrote:
Is there a way I can get at that programmatically, rather than via gdb? I'm
very clumsy in gdb.

Your time will be better spent learning how to use the debugger.

Quick crash course:

1. Use `po` to print objects. Example:
po theError
<NSError 0x12345678>

2. Use regular ObjC syntax to call methods on objects.  Sometimes you
need to provide type information, because gdb doesn't have as much
information available to it as the compiler does.  Example:
po (id)[theError description]
"The document could not be opened."

3. Use the `call` command to call arbitrary functions, methods, etc.
Again, casting might be necessary.
call (void)NSLog(@"The error says: %@", (id)[theError description])
debugged-process[2134] 00:00:00 The error says: The document could not
be opened.

Of course, use the Debugger panel to select different stack frames,
which in turn affects what variables are in scope.

--Kyle Sluder

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to