Setting breakpoint on method

Hi,

I have TestViewController, subclass of UIViewController. I’m trying to set breakpoint on [TestViewController viewDidAppear:] but I can’t get it to break. Setting breakpoint on [UIViewController viewDidAppear:] work fine with command “b -[UIViewController viewDidAppear:]”.

I can break if I use its memory location, but is there a better way?

Output:

Breakpoint 15: no locations (pending).
WARNING: Unable to resolve breakpoint to any actual locations.

Jason

There must be a actual function named "-[TestViewController viewDidAppear:]" or "+[TestViewController viewDidAppear:]" if you ask to set a breakpoint by name using "[TestViewController viewDidAppear:]". So your TestViewController doesn't have a "viewDidAppear:", but one of its superclasses does. We currently don't try to look for superclass breakpoints by name because they could end up getting hit way too much for all other classes. If we did try to search for the superclass we would need the breakpoint to add a condition to test if the class was "TestViewController" and continue if it wasn't. This can cause the breakpoint to really slow down your program execution though.

You can also set a breakpoint using a selector only:

(lldb) breakpoint set --selector viewDidAppear:
Breakpoint 1: 14 locations.
(lldb) b
Current breakpoints:
1: name = 'viewDidAppear:', locations = 14
  1.1: where = UIKit`-[UIViewController viewDidAppear:], address = UIKit[0x0000000000027e40], unresolved, hit count = 0
  1.2: where = UIKit`-[UINavigationController viewDidAppear:], address = UIKit[0x00000000000ddc2c], unresolved, hit count = 0
  1.3: where = UIKit`-[UITableViewController viewDidAppear:], address = UIKit[0x00000000001312b4], unresolved, hit count = 0
  1.4: where = UIKit`-[UITabBarController viewDidAppear:], address = UIKit[0x0000000000149024], unresolved, hit count = 0
  1.5: where = UIKit`-[UIPageController viewDidAppear:], address = UIKit[0x00000000001abb8c], unresolved, hit count = 0
  1.6: where = UIKit`-[UIActivityViewController viewDidAppear:], address = UIKit[0x0000000000205c68], unresolved, hit count = 0
  1.7: where = UIKit`-[UISplitViewController viewDidAppear:], address = UIKit[0x000000000050ccd4], unresolved, hit count = 0
  1.8: where = UIKit`-[_UIDocumentPickerOverviewViewController viewDidAppear:], address = UIKit[0x00000000005f607c], unresolved, hit count = 0
  1.9: where = UIKit`-[UIPageViewController viewDidAppear:], address = UIKit[0x0000000000601608], unresolved, hit count = 0
  1.10: where = UIKit`-[_UIRemoteViewController viewDidAppear:], address = UIKit[0x00000000006685ac], unresolved, hit count = 0
  1.11: where = UIKit`-[_UIDocumentPickerDocumentTableViewController viewDidAppear:], address = UIKit[0x00000000006a1f04], unresolved, hit count = 0
  1.12: where = UIKit`-[_UIWebViewController viewDidAppear:], address = UIKit[0x00000000006b5248], unresolved, hit count = 0
  1.13: where = UIKit`-[UIPrinterSetupPINViewController viewDidAppear:], address = UIKit[0x000000000075b828], unresolved, hit count = 0
  1.14: where = UIKit`-[UIPrinterSetupDisplayPINViewController viewDidAppear:], address = UIKit[0x0000000000762e30], unresolved, hit count = 0

You can then disable any locations you don't want to be set:

(lldb) breakpoint disable 1.2-1.14
13 breakpoints disabled.