[lldb-dev] Mac OS X Apple applications debugging. Switching from GDB to LLDB ?
altimac at carrafix.com
Sat Mar 2 09:43:21 PST 2013
I'm a GDB user that want to switch to LLDB, but something is preventing me to switch for the moment: I can't find how to debug (analyze) Apple applications such as Calendars.app or Contacts.app on Mac OS X.
Using GDB, i'm used to do something like this :
> $ gdb /Applications/Calendar.app
> (gdb) run
> Starting program: /Applications/Calendar.app/Contents/MacOS/Calendar
> Reading symbols for shared libraries ++++++++ ............
> (gdb) fb alloc
>  cancel
>  all
> Non-debugging symbols:
>  +[ABDeprecatedObject alloc]
>  +[CALDate(Private) alloc]
>  +[CalAutoCompleteOperation alloc]
>  +[NSHashTable alloc]
>  +[NSKnownKeysDictionary alloc]
>  +[NSKnownKeysDictionary1 alloc]
>  +[NSKnownKeysMappingStrategy alloc]
>  +[NSKnownKeysMappingStrategy1 alloc]
>  +[NSLeafProxy alloc]
>  +[NSManagedObject alloc]
>  +[NSMapTable alloc]
>  +[NSObject alloc]
>  +[NSPasteboard alloc]
>  +[NSProxy alloc]
>  +[NSTemporaryObjectID alloc]
>  +[NSUserNotification alloc]
>  +[_CDSnapshot alloc]
>  +[_NSCoreManagedObjectID alloc]
>  +[_NSFaultingMutableArray alloc]
>  +[_NSFaultingMutableOrderedSet alloc]
>  +[_NSFaultingMutableSet alloc]
>  +[_PFBatchFaultingArray alloc]
>  +[_PFCachedNumber alloc]
>  +[_PFFetchedResultOrderedSetWrapper alloc]
>  +[_PFString alloc]
>  +[__CFHashTable alloc]
>  +[__CFMapTable alloc]
I can then make GDB break on the method i'm interested in.
Using LLDB, i've not been able to do the same :
> $ lldb /Applications/Calendar.app
> (lldb) Current executable set to '/Applications/Calendar.app' (x86_64).
> (lldb) run
> Process 54986 launched: '/Applications/Calendar.app/Contents/MacOS/Calendar' (x86_64)
> (lldb) breakpoint set -S alloc // i've also tried -n "-[NSObject alloc]
> Breakpoint 1: no locations (pending).
> WARNING: Unable to resolve breakpoint to any actual locations.
And then run the app. Unfortunately LLDB does not break, when OF COURSE, -[NSObject alloc] is called very often in a Cocoa application...
After reading http://lldb.llvm.org/symbols.html, I realize that I don't have any dSYM file to provide to LLDB since I'm not the author of the app :) but how does GDB without dSYM file ? is the dSYM file embedded in the binary ?
So, shortly, how can I make LLDB make an *Apple* Cocoa app break on simple ObjC method calls like I did with GDB ?
Thanks for your help
More information about the lldb-dev