[lldb-dev] Fridays llvm/clang/lldb & ObjectDescription

Greg Clayton gclayton at apple.com
Mon Jan 19 16:30:03 PST 2015


I debugged the lldb/test/lang/objc/foundation binary:

% cd lldb/test/lang/objc/foundation
% make
% lldb a.out
(lldb) b main.m:70
(lldb) r
   69  	    NSString *str = [NSString stringWithFormat:@"Hello from '%s'", program];
-> 70  	    NSLog(@"NSString instance: %@", str);
   71  	    printf("str = '%s'\n", [str cStringUsingEncoding: [NSString defaultCStringEncoding]]);
   72  	    printf("[str length] = %zu\n", (size_t)[str length]);
   73  	    printf("[str description] = %s\n", [[str description] UTF8String]);
(lldb) script v = lldb.frame.FindVariable("str")
(lldb) script print v
(NSString *) str = 0x0000000100200380 @"Hello from '/Volumes/work/gclayton/Documents/src/lldb/trunk/test/lang/objc/foundation/a.out'"
(lldb) script print v.GetType().GetTypeClass()
2048
(lldb) p/x 2048
(int) $2 = 0x00000800

This is eTypeClassObjCObjectPointer as expected. If you dereference the item:

(lldb) script vd = v.Dereference()
(lldb) script print vd.GetType().GetTypeClass()
1024
(lldb) p/x 1024 
(int) $4 = 0x00000400

This is eTypeClassObjCInterface as expected.




> On Jan 19, 2015, at 6:58 AM, Carlo Kok <ck at remobjects.com> wrote:
> 
> After updating lldb (and clang/llvm) to latest I noticed that I get back a different value for an NSString* than I used to, I used to get:
> 
> 
> eTypeClassObjCObjectPointer
> now I get :
> eTypeClassObjCInterface
> 
> 
> Also the object description property returns null because it doesn't consider eTypeClassObjCInterface to be a pointer. I looked at the generated debug info which looks fine (and the system lldb on osx works fine too):
> 
> 
> 0x00000159:             TAG_variable [7]
>                         AT_location( fbreg +120 )
>                         AT_name( "qwert" )
>                         AT_decl_file( "c:\projects\oxygene\testcases\work/issuedebugsilver_1.pas" )
>                         AT_decl_line( 8 )
>                         AT_type( {0x00000298} ( NSString* ) )
> 
> 
> 0x00000298:     TAG_pointer_type [9]
>                 AT_type( {0x0000029d} ( NSString ) )
> 
> 0x0000029d:     TAG_structure_type [10] *
>                 AT_name( "NSString" )
>                 AT_byte_size( 0x08 )
>                 AT_APPLE_runtime_class( 0x10 )
> 
> 0x000002a4:         TAG_inheritance [11]
>                     AT_type( {0x000002ab} ( NSObject ) )
>                     AT_data_member_location( 0x00 )
> 
> 0x000002aa:         NULL
> 
> Am i missing something obvious, or is there something broken in lldb?
> 
> -- 
> Carlo Kok
> <dwarf.txt>_______________________________________________
> 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