12

what's the correct way to call a method from the Xcode debugger command line ?

For example if I'm inside the sort: method of my class A (using the debugger), how can I call debugSort: method that belongs to class A too ?

( My code is Objective-C btw )

Goles
  • 11,599
  • 22
  • 79
  • 140

1 Answers1

24

To call an Objective-C method in the gdb console, you have to cast the return type (since gdb doesn't really know what the return value is):

(gdb) call (void)[textField setStringValue: @"Bork"]

Quickies for gdb
Vincent Gable
  • 3,455
  • 23
  • 26
  • 1
    You can also use `print` or `po`. The latter will send the return value (which must be an object) a `debugDescription` message and print the string that that message returns. In practice, this means `po` prints the object—which is what its name means. – Peter Hosey Dec 16 '09 at 16:56