r183329 - PR14763: Debug info for non-trivial record parameters

David Blaikie dblaikie at gmail.com
Fri Jun 7 11:46:28 PDT 2013


On Fri, Jun 7, 2013 at 11:10 AM, David Dean <david_dean at apple.com> wrote:
> David,
>         It looks like this broke the debug-info tests here:
>
> http://lab.llvm.org:8013/builders/clang-x86_64-darwin11-nobootstrap-RAincremental/builds/2596
>
> Can you update the tests?

Turns out these tests explain why this change was made in the first place...

Location information. While we now get the type of the function
correct, we don't emit the location information correctly describing
that the parameter is an indirect reference to the object. So GDB will
currently treat the pointer as the struct value & get very confused.

I'll work on fixing the backend & updating the test cases once I've
done that (or I can update them now with the expected output, but
they'll still be failing either way). Or I can backout this patch
temporarily if you prefer. (or mark the test as XFAIL temporarily)

- David

>
> On 5 Jun 2013, at 11:30 AM, David Blaikie <dblaikie at gmail.com> wrote:
>
>> Author: dblaikie
>> Date: Wed Jun  5 13:30:31 2013
>> New Revision: 183329
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=183329&view=rev
>> Log:
>> PR14763: Debug info for non-trivial record parameters
>>
>> There seems to have been some erroneous code attempting to describe the
>> ABI of parameters (non-trivial record parameters are passed by
>> reference). This would break the type of the function (especially when
>> it caused a mismatch between the type of a declaration & a definition)
>> causing PR14763 and PR14645.
>>
>> Modified:
>>    cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
>>    cfe/trunk/test/CodeGenCXX/debug-info.cpp
>>
>> Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=183329&r1=183328&r2=183329&view=diff
>> ==============================================================================
>> --- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
>> +++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Wed Jun  5 13:30:31 2013
>> @@ -2570,22 +2570,6 @@ void CGDebugInfo::EmitDeclare(const VarD
>>   if (!Ty)
>>     return;
>>
>> -  if (llvm::Argument *Arg = dyn_cast<llvm::Argument>(Storage)) {
>> -    // If Storage is an aggregate returned as 'sret' then let debugger know
>> -    // about this.
>> -    if (Arg->hasStructRetAttr())
>> -      Ty = DBuilder.createReferenceType(llvm::dwarf::DW_TAG_reference_type, Ty);
>> -    else if (CXXRecordDecl *Record = VD->getType()->getAsCXXRecordDecl()) {
>> -      // If an aggregate variable has non trivial destructor or non trivial copy
>> -      // constructor than it is pass indirectly. Let debug info know about this
>> -      // by using reference of the aggregate type as a argument type.
>> -      if (Record->hasNonTrivialCopyConstructor() ||
>> -          !Record->hasTrivialDestructor())
>> -        Ty = DBuilder.createReferenceType(llvm::dwarf::DW_TAG_reference_type,
>> -                                          Ty);
>> -    }
>> -  }
>> -
>>   // Get location information.
>>   unsigned Line = getLineNumber(VD->getLocation());
>>   unsigned Column = getColumnNumber(VD->getLocation());
>>
>> Modified: cfe/trunk/test/CodeGenCXX/debug-info.cpp
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/debug-info.cpp?rev=183329&r1=183328&r2=183329&view=diff
>> ==============================================================================
>> --- cfe/trunk/test/CodeGenCXX/debug-info.cpp (original)
>> +++ cfe/trunk/test/CodeGenCXX/debug-info.cpp Wed Jun  5 13:30:31 2013
>> @@ -68,6 +68,20 @@ class Cls {
>> Cls obj;
>> }
>>
>> +namespace pr14763 {
>> +struct foo {
>> +  foo(const foo&);
>> +};
>> +
>> +foo func(foo f) {
>> +  return f; // reference 'f' for now because otherwise we hit another bug
>> +}
>> +
>> +// CHECK: [[FUNC:![0-9]*]] = {{.*}} metadata !"_ZN7pr147634funcENS_3fooE", i32 {{[0-9]*}}, metadata [[FUNC_TYPE:![0-9]*]], {{.*}} ; [ DW_TAG_subprogram ] {{.*}} [def] [func]
>> +// CHECK: [[PR14763:![0-9]*]] = {{.*}} ; [ DW_TAG_namespace ] [pr14763]
>> +// CHECK: [[FOO:![0-9]*]] = metadata !{i32 {{[0-9]*}}, metadata !{{[0-9]*}}, metadata [[PR14763]], {{.*}} ; [ DW_TAG_structure_type ] [foo]
>> +}
>> +
>> namespace pr9608 { // also pr9600
>> struct incomplete;
>> incomplete (*x)[3];
>> @@ -77,6 +91,9 @@ incomplete (*x)[3];
>> // CHECK: [[INCTYPE]] = {{.*}} ; [ DW_TAG_structure_type ] [incomplete]{{.*}} [fwd]
>> }
>>
>> +// For some reason the argument for PR14763 ended up all the way down here
>> +// CHECK: = metadata !{i32 {{[0-9]*}}, metadata [[FUNC]], {{.*}}, metadata [[FOO]], i32 0, i32 0} ; [ DW_TAG_arg_variable ] [f]
>> +
>> namespace pr16214 {
>> struct a {
>>   int i;
>>
>>
>> _______________________________________________
>> cfe-commits mailing list
>> cfe-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>



More information about the cfe-commits mailing list