[cfe-commits] r141261 - in /cfe/trunk: lib/CodeGen/CGDebugInfo.cpp test/CodeGenObjC/debug-info-crash-2.m

Fariborz Jahanian fjahanian at apple.com
Wed Oct 5 17:49:46 PDT 2011


On Oct 5, 2011, at 5:31 PM, Eric Christopher wrote:

> Author: echristo
> Date: Wed Oct  5 19:31:18 2011
> New Revision: 141261
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=141261&view=rev
> Log:
> When constructing debug information for synthesized variables for the
> non-fragile ABI we may not be able to lay out the type and the debugger
> would ignore us even if we did put in the offset. Go ahead and just
> put any value there and don't look up the offset since it may not exist.

Ivar will be synthesize as an ordinary ivar and added to the list of ivars for the class.
It has both a type and an offset then. Why does debgger ignore it?
Also, in your test, why do you declare subclass
Foo_ and its implementation? Does it play a role here?

- Fariborz

> 
> rdar://10210157
> 
> Added:
>    cfe/trunk/test/CodeGenObjC/debug-info-crash-2.m
> Modified:
>    cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
> 
> Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=141261&r1=141260&r2=141261&view=diff
> ==============================================================================
> --- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
> +++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Wed Oct  5 19:31:18 2011
> @@ -1148,8 +1148,8 @@
>   unsigned Line = getLineNumber(ID->getLocation());
>   unsigned RuntimeLang = TheCU.getLanguage();
> 
> -  // If this is just a forward declaration, return a special forward-declaration
> -  // debug type.
> +  // If this is just a forward declaration return a special forward-declaration
> +  // debug type since we won't be able to lay out the entire type.
>   if (ID->isForwardDecl()) {
>     llvm::DIType FwdDecl =
>       DBuilder.createStructType(Unit, ID->getName(),
> @@ -1223,7 +1223,12 @@
>       FieldAlign =  CGM.getContext().getTypeAlign(FType);
>     }
> 
> -    uint64_t FieldOffset = RL.getFieldOffset(FieldNo);
> +    // We can't know the offset of our ivar in the structure if we're using
> +    // the non-fragile abi and the debugger should ignore the value anyways.
> +    // Call it the FieldNo+1 due to how debuggers use the information,
> +    // e.g. negating the value when it needs a lookup in the dynamic table.
> +    uint64_t FieldOffset = CGM.getLangOptions().ObjCNonFragileABI ? FieldNo+1
> +      : RL.getFieldOffset(FieldNo);
> 
>     unsigned Flags = 0;
>     if (Field->getAccessControl() == ObjCIvarDecl::Protected)
> 
> Added: cfe/trunk/test/CodeGenObjC/debug-info-crash-2.m
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjC/debug-info-crash-2.m?rev=141261&view=auto
> ==============================================================================
> --- cfe/trunk/test/CodeGenObjC/debug-info-crash-2.m (added)
> +++ cfe/trunk/test/CodeGenObjC/debug-info-crash-2.m Wed Oct  5 19:31:18 2011
> @@ -0,0 +1,15 @@
> +// RUN: %clang_cc1 -triple x86_64-apple-darwin11 -g -S %s -o -
> + at class Bar;
> + at interface Foo
> + at property (strong, nonatomic) Bar *window;
> + at end
> +
> + at interface Foo__ : Foo
> + at end
> + at implementation Foo__
> + at end
> +
> + at implementation Foo
> + at synthesize window = _window;
> + at end
> +
> 
> 
> _______________________________________________
> 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