[lldb-dev] lldb crash

Andrey Zaytsev andrey.zaytsev at jetbrains.com
Thu Jul 14 10:30:25 PDT 2011


On 14.07.2011, at 20:09, Enrico Granata wrote:

> Andrey,
> You might be pleased to know that this bug is fixed in the latest LLDB.
> 
> What follows is an LLDB session printout, with the interesting lines bolded
> 
> da0603a-dhcp151:Debug egranata$ ./lldb andrey
> Current executable set to 'andrey' (x86_64).
> (lldb) b main
> runbreakpoint set --name 'main'
> Breakpoint created: 1: name = 'main', locations = 1
> (lldb) run
> Process 71825 launched: '/Volumes/work/egranata/lldb/build/Debug/andrey' (x86_64)
> Process 71825 stopped
> * thread #1: tid = 0x2e03, 0x0000000100000d94 andrey`main + 4 at andrey.m:18, stop reason = breakpoint 1.1
>   frame #0: 0x0000000100000d94 andrey`main + 4 at andrey.m:18
>    15  	
>    16  	int main()
>    17  	{
> -> 18  	    Item *itm = [[Item alloc] init];
>    19  	    
>    20  	    itm.title = @"Hello world";
>    21  	    
> (lldb) n
> Process 71825 stopped
> * thread #1: tid = 0x2e03, 0x0000000100000ddb andrey`main + 75 at andrey.m:20, stop reason = step over
>   frame #0: 0x0000000100000ddb andrey`main + 75 at andrey.m:20
>    17  	{
>    18  	    Item *itm = [[Item alloc] init];
>    19  	    
> -> 20  	    itm.title = @"Hello world";
>    21  	    
>    22  	    itm.title = @"Try again";
>    23  	    
> (lldb) n
> Process 71825 stopped
> * thread #1: tid = 0x2e03, 0x0000000100000e00 andrey`main + 112 at andrey.m:22, stop reason = step over
>   frame #0: 0x0000000100000e00 andrey`main + 112 at andrey.m:22
>    19  	    
>    20  	    itm.title = @"Hello world";
>    21  	    
> -> 22  	    itm.title = @"Try again";
>    23  	    
>    24  	    return 0;
>    25
> (lldb) expr (char*)[[itm title] UTF8String]
> (char *) $0 = 0x000000010010cdc0 "Hello world"
> 
> You can get the latest LLDB source from the project website and build it yourself. This should be enough to solve your crash
> 
> Thanks for your interest in LLDB :-)
> 
> On Jul 14, 2011, at 5:32 AM, Andrey Zaytsev wrote:
> 
>> I've got crash when was trying to call GetNumChildren of value which I got from EvaluateExpression method.
>> 
>> We have class:
>> 
>> @interface Item : NSObject {
>> @private
>>    NSString *title;
>>    NSString *type;
>> }
>> 
>> @property(retain)NSString* title;
>> //... and some other stupid stuff
>> @end
>> 
>> I'm trying to evaluate expression "[item title]"
>> Value is ok. But when GetNumChildren is invoked i've got crash: 
>> ClangASTContext.cpp:
>> 
>> static bool
>> GetCompleteQualType (clang::ASTContext *ast, clang::QualType qual_type) {
>> //......
>> 
>> case clang::Type::ObjCInterface:
>>        {
>>            const clang::ObjCObjectType *objc_class_type = dyn_cast<clang::ObjCObjectType>(qual_type);
>>            if (objc_class_type)
>>            {
>>                clang::ObjCInterfaceDecl *class_interface_decl = objc_class_type->getInterface();
>>                // We currently can't complete objective C types through the newly added ASTContext
>>                // because it only supports TagDecl objects right now...
>>                bool is_forward_decl = class_interface_decl->isForwardDecl();  // !! <----- crashed here. class_interface_decl == NULL
>> 
>> Sorry for screenshot instead of normal crash dump. =( I just was not able to get it.
>> 
>> <Screen shot 2011-07-14 at 15.55.09.png>
>> 
>> CFBundleVersion of LLDB is 63.
>> 
>> I couldn't reproduce it with Xcode (just because of "Evaluate expression" doesn't work at all with message "Invalid expression")
>> 
>> Please please please fix it! 
>> Thank you._______________________________________________
>> lldb-dev mailing list
>> lldb-dev at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev
> 

Hi, Enrico!
Thank you for consideration of my problem. 
But your listing doesn't show described problem because "expr (char*)[[itm title] UTF8String]" doesn't invoke GetNumChildren method of SBValue. But if you do it (e.g. from python script) you'll get the crash.
It's reproduced with latest sources. (tried right now)

Fixing this problem will make this feature work:



Xcode have the similar one in the variables view. But it doesn't work. And if Xcode team will fix that issue with "Invalid expression" they will face the described one =(
Thank you for consideration.



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-dev/attachments/20110714/5b011f77/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Screen shot 2011-07-14 at 21.27.13.png
Type: image/png
Size: 80948 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-dev/attachments/20110714/5b011f77/attachment.png>


More information about the lldb-dev mailing list