Skip to content

Instantly share code, notes, and snippets.

@mingsai
Forked from krzysztofzablocki/gist:4396302
Created August 26, 2013 12:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mingsai/6340865 to your computer and use it in GitHub Desktop.
Save mingsai/6340865 to your computer and use it in GitHub Desktop.
expr -- (void)printf("[%s, %s]\n",(char *) object_getClassName(*(long*)($esp+4)), (char *) *(long *)($esp+8) )
@mingsai
Copy link
Author

mingsai commented Aug 26, 2013

This produces a list of method names when used with a symbolic breakpoint in Xcode targeting objc_msgSend. I also spotted this on stack overflow and in Apple's iOS debugging magic (TN2239). One should be aware of the need to use other function calls to further refine output.

For example:

objc_msgSend_stret - structs
objc_msgSend_fpret - floating points
objc_msgSendSuper - super

For more on interpreting crash log output see the article by Parker (n.d.) which can assist in analyzing the register's used on different platforms. If you need help translating gdb to lldb check out the GDB to LLDB Command Map.

References

Anonymous. (n.d.). GDB to LLDB Command Map. Retrieved from http://lldb.llvm.org/lldb-gdb.html

Apple. (n.d.). TN2239 - iOS Debugging Magic. Retrieved from https://developer.apple.com/library/ios/technotes/tn2239/_index.html#//apple_ref/doc/uid/DTS40010638-CH1-SUBSECTION11

Parker, G. (n.d.). Hamster Emporium Archive. Retrieved from http://sealiesoftware.com/blog/archive/2008/09/22/objc_explain_So_you_crashed_in_objc_msgSend.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment