[lldb-dev] Mac OS X Apple applications debugging. Switching from GDB to LLDB ?

Aurelien Hugele altimac at carrafix.com
Sat Mar 2 09:43:21 PST 2013


Hi list!

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
> [0] cancel
> [1] all
> 
> Non-debugging symbols:
> [2]    +[ABDeprecatedObject alloc]
> [3]    +[CALDate(Private) alloc]
> [4]    +[CalAutoCompleteOperation alloc]
> [5]    +[NSHashTable alloc]
> [6]    +[NSKnownKeysDictionary alloc]
> [7]    +[NSKnownKeysDictionary1 alloc]
> [8]    +[NSKnownKeysMappingStrategy alloc]
> [9]    +[NSKnownKeysMappingStrategy1 alloc]
> [10]    +[NSLeafProxy alloc]
> [11]    +[NSManagedObject alloc]
> [12]    +[NSMapTable alloc]
> [13]    +[NSObject alloc]
> [14]    +[NSPasteboard alloc]
> [15]    +[NSProxy alloc]
> [16]    +[NSTemporaryObjectID alloc]
> [17]    +[NSUserNotification alloc]
> [18]    +[_CDSnapshot alloc]
> [19]    +[_NSCoreManagedObjectID alloc]
> [20]    +[_NSFaultingMutableArray alloc]
> [21]    +[_NSFaultingMutableOrderedSet alloc]
> [22]    +[_NSFaultingMutableSet alloc]
> [23]    +[_PFBatchFaultingArray alloc]
> [24]    +[_PFCachedNumber alloc]
> [25]    +[_PFFetchedResultOrderedSetWrapper alloc]
> [26]    +[_PFString alloc]
> [27]    +[__CFHashTable alloc]
> [28]    +[__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 mailing list