On May 5, 2014, at 12:15 PM, Ed Maste <[email protected]> wrote:

> On 8 April 2014 17:49, Greg Clayton <[email protected]> wrote:
>> 
>> The whole premise of the GCC changes were that the definition would be 
>> available elsewhere, but in this case that isn't the case.
> 
> I've run into the same issue on FreeBSD, while trying to debug a clang
> built with the system clang-3.4.
> 
> * thread #1: tid = 104525, 0x000000081191ff6e
> libclangCodeGen.so`clang::CodeGen::CGDebugInfo::CreateType(this=0x0000000815c0a000,
> BT=0x0000000815c3d400) + 30 at CGDebugInfo.cpp:391, stop reason =
> breakpoint 1.1
>    frame #0: 0x000000081191ff6e
> libclangCodeGen.so`clang::CodeGen::CGDebugInfo::CreateType(this=0x0000000815c0a000,
> BT=0x0000000815c3d400) + 30 at CGDebugInfo.cpp:391
>   388  /// CreateType - Get the Basic type from the cache or create a new
>   389  /// one if necessary.
>   390  llvm::DIType CGDebugInfo::CreateType(const BuiltinType *BT) {
> -> 391    unsigned Encoding = 0;
>   392    StringRef BTName;
>   393    switch (BT->getKind()) {
>   394  #define BUILTIN_TYPE(Id, SingletonId)
> (lldb) p BT
> Assertion failed: (D && "Cannot get layout of forward declarations!"),
> function getASTRecordLayout, file
> ../tools/clang/lib/AST/RecordLayoutBuilder.cpp, line 2783.
> 
> 
> In my case the there is a definition available elsewhere:
> 
> (lldb) image lookup --type BuiltinType
> Best match found in /tank/emaste/ctsrd/llvm/Build/lib/libclangCodeGen.so:
> id = {0x0088df97}, name = "BuiltinType", qualified =
> "clang::BuiltinType", byte-size = 24, decl = Type.h:1842, clang_type =
> "class BuiltinType : public clang::Type {
> ...
> 
>> Yes, by default on darwin clang doesn't use this debug info minimizing 
>> trick. On linux you will need to disable it if you have a clang that 
>> supports this optimization.
> 
> Do you know off-hand how it's disabled on Darwin?  It seems like we
> probably want FreeBSD's clang to behave the same way, by default.

>From the clang man page:

 -fstandalone-debug, -fno-standalone-debug
     Clang supports a number of optimizations to reduce the size of debug 
information in the binary. They work based on the assumption that the debug 
type information can be spread out over multiple compilation units.  For 
instance, Clang will not emit type definitions for types that are not needed by 
a module and could be replaced with a forward declaration.  Further, Clang will 
only emit type info for a dynamic C++ class in the module that contains the 
vtable for the class.

The -fstandalone-debug option turns off these optimizations.  This is useful 
when working with 3rd-party libraries that don't come with debug information.  
Note that Clang will never emit type information for types that are not 
referenced at all by the program.

cheers,
adrian
_______________________________________________
lldb-dev mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev

Reply via email to