Created
January 13, 2016 13:40
-
-
Save MattyAyOh/0207084340841f5e4369 to your computer and use it in GitHub Desktop.
How to set symbolic breakpoints to identify when an object is registered/unregistered to NSNotificationCenter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-[NSNotificationCenter addObserver:selector:name:object:] | |
and | |
-[NSNotificationCenter addObserverForName:object:queue:usingBlock:] | |
With the condition: | |
(BOOL)[@"fractionCompleted" isEqualToString:(id)$r8] | |
and | |
(BOOL)[@"fractionCompleted" isEqualToString:(id)$rdx] | |
Then set an action as a Debugger Command: | |
po $rdx | |
and | |
po $rcx | |
If you're curious about why the registers change, that is because OS X follows the System V ABI for register calling conventions. Arguments for a method go into: | |
rdi, rsi, rdx, rcx, r8, r9 | |
In that argument order. Because Objective-C messages get compiled into objc_msgsend(receiver, selectorname, argument1, argument2, argument3, argument4) |
Checking type of class of a pointer in register:
(BOOL)[(id)$rdi isKindOfClass:(Class)[EditorImageView class]]
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Informal Protocol KVO symbols: