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

Greg Clayton gclayton at apple.com
Mon Mar 4 09:06:03 PST 2013


The best work around is to use the "--func-regex" option to setting breakpoints:

% xcrun lldb /Applications/Calculator.app
(lldb) breakpoint set --func-regex 'alloc]'
Breakpoint 2: 1781 locations.

Please file a bug against the "lldb" component as this should be fixed. If I set a breakpoint by selector in this same debug session:

(lldb) breakpoint set -S alloc
Breakpoint 1: 24 locations.

This should be the same number of locations as "breakpoint set --func-regex 'alloc]'", but obviously it isn't.

"--func-regex" will allow you to use a regular expression to catch the things you are interested in without error. You can also limit breakpoints to certain shared libraries to limit the number of "alloc" breakpoints you get:

(lldb) breakpoint set --func-regex 'alloc]' --shlib AppKit --shlib Calendar
Breakpoint 3: 680 locations.




On Mar 2, 2013, at 10:38 AM, Aurelien Hugele <altimac at carrafix.com> wrote:

> I'm in fact not interested in NSObject alloc, but other instance method ;) and it does not work either.
> Anyway "breakpoint set -S alloc"   should work for class and instance methods.
> 
> Remember the problem is not in *my* app, but Apple apps...
> 
> On 2 mars 2013, at 19:33, Jean-Daniel Dupas <devlists at shadowlab.org> wrote:
> 
>> Le 2 mars 2013 à 18:43, Aurelien Hugele <altimac at carrafix.com> a écrit :
>> 
>>> 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]
>> 
>> This is a class method, so should be '+' not '-'
>> 
>> (lldb) b +[NSObject alloc]
>> Breakpoint 3: where = libobjc.A.dylib`+[NSObject alloc], address = 0x00007fff86c3676e
>> 
>> -- Jean-Daniel
>> 
>> 
>> 
>> 
> 
> 
> _______________________________________________
> lldb-dev mailing list
> lldb-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev





More information about the lldb-dev mailing list