[Lldb-commits] [lldb] r367441 - Don't crash when pass by value struct has no definition.

Jim Ingham via lldb-commits lldb-commits at lists.llvm.org
Wed Jul 31 15:14:43 PDT 2019



> On Jul 31, 2019, at 12:50 PM, via lldb-commits <lldb-commits at lists.llvm.org> wrote:
> 
> 
> 
>> -----Original Message-----
>> From: lldb-commits [mailto:lldb-commits-bounces at lists.llvm.org] On Behalf
>> Of Greg Clayton via lldb-commits
>> Sent: Wednesday, July 31, 2019 2:29 PM
>> To: Raphael Isemann
>> Cc: lldb-commits
>> Subject: Re: [Lldb-commits] [lldb] r367441 - Don't crash when pass by
>> value struct has no definition.
>> 
>> 
>> 
>>> On Jul 31, 2019, at 10:57 AM, Raphael Isemann <teemperor at gmail.com>
>> wrote:
>>> 
>>> It seems that patch is lacking a test (which doesn't seem too hard to
>> provide).
>> 
>> I am not the original author of this patch that was causing the crash,
>> just fixing a crash that was introduced by the patch.
>> 
>> I am all ears for anyone that can provide me with DWARF to help reproduce
>> this scenario where we have a DW_CC_pass_by_value struct with no
>> definition. Not sure how you would have a compiler that is passing a
>> struct to a function as a parameter and yet does not emit debug info for
>> that struct it is clearly using in the debug info.
> 
> One wonders how you discovered the crash.

Presumably a crash report of some kind?  This is the sort of crash that wouldn't be hard to diagnose from a crash report even if there was no way to know how you got there...

That happens pretty frequently over here.  We get lots of crash reports delivered automatically if users opt into that feature of macOS - which many users do.  But sometimes it's hard to track back to the originator or ofttimes the report comes from someone who is unable to give us their sources and can't or isn't motivated to make a small reproducer.

So you are left with an obvious crash, and in this case a simple way to avoid the crash and straightforwardly get out of the situation.  But you have no idea how you could have gotten into that state, and no way to get help figuring it out.  At some point you have to cut your losses trying to find a reproducer, but it seems a shame to drop an obvious fix because of that...

Jim


> 
> I know that Clang will skip the content of a type if it determines that
> the definition is certain to be found elsewhere.  For example, if it has 
> virtual methods and the key function is not defined in the current CU.  
> Whether it will still add a CC attribute, I don't know.
> --paulr
> 
>> 
>>> 
>>> Am Mi., 31. Juli 2019 um 18:24 Uhr schrieb Greg Clayton via
>>> lldb-commits <lldb-commits at lists.llvm.org>:
>>>> 
>>>> Author: gclayton
>>>> Date: Wed Jul 31 09:24:55 2019
>>>> New Revision: 367441
>>>> 
>>>> URL: http://llvm.org/viewvc/llvm-project?rev=367441&view=rev
>>>> Log:
>>>> Don't crash when pass by value struct has no definition.
>>>> 
>>>> 
>>>> Modified:
>>>>   lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
>>>> 
>>>> Modified:
>> lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
>>>> URL: http://llvm.org/viewvc/llvm-
>> project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
>> ?rev=367441&r1=367440&r2=367441&view=diff
>>>> 
>> ==========================================================================
>> ====
>>>> --- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
>> (original)
>>>> +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
>> Wed Jul 31 09:24:55 2019
>>>> @@ -1010,7 +1010,7 @@ TypeSP DWARFASTParserClang::ParseTypeFro
>>>>    if (attrs.calling_convention == llvm::dwarf::DW_CC_pass_by_value) {
>>>>      clang::CXXRecordDecl *record_decl =
>>>>          m_ast.GetAsCXXRecordDecl(clang_type.GetOpaqueQualType());
>>>> -      if (record_decl) {
>>>> +      if (record_decl && record_decl->getDefinition()) {
>>>>        record_decl->setHasTrivialSpecialMemberForCall();
>>>>      }
>>>>    }
>>>> 
>>>> 
>>>> _______________________________________________
>>>> lldb-commits mailing list
>>>> lldb-commits at lists.llvm.org
>>>> https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
>> 
>> _______________________________________________
>> lldb-commits mailing list
>> lldb-commits at lists.llvm.org
>> https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
> _______________________________________________
> lldb-commits mailing list
> lldb-commits at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits



More information about the lldb-commits mailing list