[BUG?] Confusion between translation units?

Not really. If you can send me a concrete example of something that isn't working, it might help. When static linking occurs now we should have liba.dylib with llvm::foo::bar<int> defined on bar.h line 12 in the DWARF with:

~/src/llvm/include/llvm/foo/bar.h:12

and another whose decl file and line is:

/usr/local/include/llvm/include/llvm/foo/bar.h:12

The name that was being store was "bar<int>" with the byte size and one of the two decl file and lines from above. Is this the static linking case you meant above when you stated "but not when the conflicting symbols are statically linked"? If so, our current fix would enter the type in with the name "llvm::foo::bar<int>" and with an empty decl file and line. Then both cases from the above previously failing static linking case would work because they would avoid using the decl file + line to differentiate the two types. Does this make sense?

Greg Clayton wrote:

Not really. If you can send me a concrete example of something that isn't working, it might help.

Reporting progress.

1. `im loo -t` only ever finds one "best match", and the plist seems
to have no effect on it.

2. The plist parsing code does get executed. I checked with the
debugger. I also checked symlink versus non-symlinked paths in the
plist, which I'd missed last time. dwarfdump does not seem to read it,
and `im loo` says nothing different, so I have no idea if anything
really got remapped.

3. I managed to catch this "unstable" case: you try something, it
prints a huge error, you try something else in a different frame with
the same type, it prints fine, you come back to the original thing and
there's a smaller error.

    frame #0: 0x0000000101c3ce8c libmwcgir_vm_rt.dylib`(anonymous
namespace)::CgJITMemManager::endFunctionBody(this=0x000000010e8637b0,
F=0x000000010a62ccc0, FunctionStart="�?^\n\x01",
FunctionEnd="����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������...")
+ 28 at CgJITMemoryManager.cpp:437
   434 (void)FunctionStart;
   435 (void)FunctionEnd;
   436
-> 437 assert(FunctionEnd > FunctionStart);
   438 assert(FunctionStart == (uint8_T *)(CurBlock+1) &&
   439 "Mismatched function start/end!");
   440
(lldb) p F
error: field 'BasicBlocks' declared with incompatible types in
different translation units ('BasicBlockListType' (aka
'llvm::iplist<llvm::BasicBlock, llvm::ilist_traits<llvm::BasicBlock>

') vs. 'BasicBlockListType' (aka 'llvm::iplist<llvm::BasicBlock,

llvm::ilist_traits<llvm::BasicBlock> >'))
error: field 'ArgumentList' declared with incompatible types in
different translation units ('ArgumentListType' (aka
'llvm::iplist<llvm::Argument, llvm::ilist_traits<llvm::Argument> >')
vs. 'ArgumentListType' (aka 'llvm::iplist<llvm::Argument,
llvm::ilist_traits<llvm::Argument> >'))
error: field 'BasicBlocks' declared with incompatible types in
different translation units ('BasicBlockListType' (aka
'llvm::iplist<llvm::BasicBlock, llvm::ilist_traits<llvm::BasicBlock>

') vs. 'BasicBlockListType' (aka 'llvm::iplist<llvm::BasicBlock,

llvm::ilist_traits<llvm::BasicBlock> >'))
error: field 'Context' declared with incompatible types in different
translation units ('llvm::LLVMContext &' vs. 'llvm::LLVMContext &')
error: field 'GlobalList' declared with incompatible types in
different translation units ('GlobalListType' (aka
'llvm::iplist<llvm::GlobalVariable,
llvm::ilist_traits<llvm::GlobalVariable> >') vs. 'GlobalListType' (aka
'llvm::iplist<llvm::GlobalVariable,
llvm::ilist_traits<llvm::GlobalVariable> >'))
error: field 'FunctionList' declared with incompatible types in
different translation units ('FunctionListType' (aka
'llvm::iplist<llvm::Function, llvm::ilist_traits<llvm::Function> >')
vs. 'FunctionListType' (aka 'llvm::iplist<llvm::Function,
llvm::ilist_traits<llvm::Function> >'))
error: field 'AliasList' declared with incompatible types in different
translation units ('AliasListType' (aka
'llvm::iplist<llvm::GlobalAlias, llvm::ilist_traits<llvm::GlobalAlias>

') vs. 'AliasListType' (aka 'llvm::iplist<llvm::GlobalAlias,

llvm::ilist_traits<llvm::GlobalAlias> >'))
error: field 'NamedMDList' declared with incompatible types in
different translation units ('NamedMDListType' (aka
'llvm::ilist<llvm::NamedMDNode>') vs. 'NamedMDListType' (aka
'llvm::ilist<llvm::NamedMDNode>'))
error: field 'GlobalScopeAsm' declared with incompatible types in
different translation units ('string' (aka
'std::__1::basic_string<char, std::__1::char_traits<char>,
std::__1::allocator<char> >') vs. 'string' (aka
'std::__1::basic_string<char, std::__1::char_traits<char>,
std::__1::allocator<char> >'))
error: field 'ComdatSymTab' declared with incompatible types in
different translation units ('ComdatSymTabType' (aka
'llvm::StringMap<llvm::Comdat, llvm::MallocAllocator>') vs.
'ComdatSymTabType' (aka 'llvm::StringMap<llvm::Comdat,
llvm::MallocAllocator>'))
error: field 'ModuleID' declared with incompatible types in different
translation units ('string' (aka 'std::__1::basic_string<char,
std::__1::char_traits<char>, std::__1::allocator<char> >') vs.
'string' (aka 'std::__1::basic_string<char,
std::__1::char_traits<char>, std::__1::allocator<char> >'))
error: field 'TargetTriple' declared with incompatible types in
different translation units ('string' (aka
'std::__1::basic_string<char, std::__1::char_traits<char>,
std::__1::allocator<char> >') vs. 'string' (aka
'std::__1::basic_string<char, std::__1::char_traits<char>,
std::__1::allocator<char> >'))
error: field 'DataLayoutStr' declared with incompatible types in
different translation units ('string' (aka
'std::__1::basic_string<char, std::__1::char_traits<char>,
std::__1::allocator<char> >') vs. 'string' (aka
'std::__1::basic_string<char, std::__1::char_traits<char>,
std::__1::allocator<char> >'))
error: field 'Parent' declared with incompatible types in different
translation units ('llvm::Module *' vs. 'llvm::Module *')
error: field 'Parent' declared with incompatible types in different
translation units ('llvm::Module *' vs. 'llvm::Module *')
error: field 'Context' declared with incompatible types in different
translation units ('llvm::LLVMContext &' vs. 'llvm::LLVMContext &')
note: declared here with type 'BasicBlockListType' (aka
'llvm::iplist<llvm::BasicBlock, llvm::ilist_traits<llvm::BasicBlock>

')

note: declared here with type 'ArgumentListType' (aka
'llvm::iplist<llvm::Argument, llvm::ilist_traits<llvm::Argument> >')
note: declared here with type 'BasicBlockListType' (aka
'llvm::iplist<llvm::BasicBlock, llvm::ilist_traits<llvm::BasicBlock>

')

note: declared here with type 'llvm::LLVMContext &'
note: declared here with type 'GlobalListType' (aka
'llvm::iplist<llvm::GlobalVariable,
llvm::ilist_traits<llvm::GlobalVariable> >')
note: declared here with type 'FunctionListType' (aka
'llvm::iplist<llvm::Function, llvm::ilist_traits<llvm::Function> >')
note: declared here with type 'AliasListType' (aka
'llvm::iplist<llvm::GlobalAlias, llvm::ilist_traits<llvm::GlobalAlias>

')

note: declared here with type 'NamedMDListType' (aka
'llvm::ilist<llvm::NamedMDNode>')
note: declared here with type 'string' (aka
'std::__1::basic_string<char, std::__1::char_traits<char>,
std::__1::allocator<char> >')
note: declared here with type 'ComdatSymTabType' (aka
'llvm::StringMap<llvm::Comdat, llvm::MallocAllocator>')
note: declared here with type 'string' (aka
'std::__1::basic_string<char, std::__1::char_traits<char>,
std::__1::allocator<char> >')
note: declared here with type 'string' (aka
'std::__1::basic_string<char, std::__1::char_traits<char>,
std::__1::allocator<char> >')
note: declared here with type 'string' (aka
'std::__1::basic_string<char, std::__1::char_traits<char>,
std::__1::allocator<char> >')
note: declared here with type 'llvm::Module *'
note: declared here with type 'llvm::Module *'
note: declared here with type 'llvm::LLVMContext &'
error: 16 errors parsing expression
(lldb) f 4
frame #4: 0x0000000102ea820f
libmwcgir_vm_rt.dylib`llvm::FPPassManager::runOnFunction(this=0x000000010e864360,
F=0x000000010a62ccc0) + 431 at LegacyPassManager.cpp:1545
   1542 PassManagerPrettyStackEntry X(FP, F);
   1543 TimeRegion PassTimer(getPassTimer(FP));
   1544
-> 1545 LocalChanged |= FP->runOnFunction(F);
   1546 }
   1547
   1548 Changed |= LocalChanged;
(lldb) p F
(llvm::Function) $0 = {
  llvm::GlobalObject = {
    llvm::GlobalValue = {
      llvm::Constant = {
        llvm::User = {
          llvm::Value = {
            VTy = 0x000000010d8038e0
            UseList = 0x000000010b805f50
            Name = 0x000000010a62cd60
            SubclassID = '\x02'
            HasValueHandle = '\x01'
            SubclassOptionalData = '\0'
            SubclassData = 0
          }
          NumOperands = 0
          OperandList = 0x0000000000000000
        }
      }
      Linkage = ExternalLinkage
      Visibility = 0
      UnnamedAddr = 0
      DllStorageClass = 0
      ThreadLocal = 0
      SubClassData = 0
      Parent = 0x000000010b901250
    }
    Section = ""
    ObjComdat = 0x0000000000000000
  }
  llvm::ilist_node<llvm::Function> = {
    llvm::ilist_half_node<llvm::Function> = {
      Prev = 0x000000010a62cb50
    }
    Next = 0x000000010a6375d0
  }
  BasicBlocks = {
    llvm::ilist_traits<llvm::BasicBlock> = {
      Sentinel = {
        Prev = 0x000000010a634b70
      }
    }
    Head = 0x000000010a62cfd0
  }
  ArgumentList = {
    llvm::ilist_traits<llvm::Argument> = {
      Sentinel = {
        Prev = 0x000000010a62ce40
      }
    }
    Head = 0x000000010a62ce00
  }
  SymTab = 0x000000010a62cd90
  AttributeSets = {
    pImpl = 0x0000000000000000
  }
}
(lldb) f 0
frame #0: 0x0000000101c3ce8c libmwcgir_vm_rt.dylib`(anonymous
namespace)::CgJITMemManager::endFunctionBody(this=0x000000010e8637b0,
F=0x000000010a62ccc0, FunctionStart="�?^\n\x01",
FunctionEnd="����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������...")
+ 28 at CgJITMemoryManager.cpp:437
   434 (void)FunctionStart;
   435 (void)FunctionEnd;
   436
-> 437 assert(FunctionEnd > FunctionStart);
   438 assert(FunctionStart == (uint8_T *)(CurBlock+1) &&
   439 "Mismatched function start/end!");
   440
(lldb) p F
error: field '__r_' declared with incompatible types in different
translation units
('std::__1::__compressed_pair<std::__1::basic_string<char,
std::__1::char_traits<char>, std::__1::allocator<char> >::__rep,
std::__1::allocator<char> >' vs.
'std::__1::__compressed_pair<std::__1::basic_string<char,
std::__1::char_traits<char>, std::__1::allocator<char> >::__rep,
std::__1::allocator<char> >')
note: declared here with type
'std::__1::__compressed_pair<std::__1::basic_string<char,
std::__1::char_traits<char>, std::__1::allocator<char> >::__rep,
std::__1::allocator<char> >'
error: 1 errors parsing expression
(lldb) im loo -t
"std::__1::__compressed_pair<std::__1::basic_string<char,
std::__1::char_traits<char>, std::__1::allocator<char> >::__rep,
std::__1::allocator<char> >"
         Best match found in
/mathworks/devel/sbs/34/rramacha.idivide-final-lap/matlab/bin/maci64/libmwcgir_vm_rt.dylib:
id = {0x000457b5}, name =
"__compressed_pair<std::__1::basic_string<char,
std::__1::char_traits<char>, std::__1::allocator<char> >::__rep,
std::__1::allocator<char> >", qualified =
"std::__1::__compressed_pair<std::__1::basic_string<char,
std::__1::char_traits<char>, std::__1::allocator<char> >::__rep,
std::__1::allocator<char> >", byte-size = 24, decl = memory:2297,
compiler_type = "class __compressed_pair : private
std::__1::__libcpp_compressed_pair_imp<std::__1::basic_string<char,
std::__1::char_traits<char>, std::__1::allocator<char> >::__rep,
std::__1::allocator<char>, 2> {
    __compressed_pair();
    explicit __compressed_pair(_T1_param);
    explicit __compressed_pair(_T2_param);
    __compressed_pair(_T1_param, _T2_param);
    _T1_reference first();
    _T1_const_reference first() const;
    _T2_reference second();
    _T2_const_reference second() const;
    void swap(std::__1::__compressed_pair<std::__1::basic_string<char,
std::__1::char_traits<char>, std::__1::allocator<char> >::__rep,
std::__1::allocator<char> > &);
}"

Before the recent patch you developed, the variable on f 4 also failed to print.

More insights into what might be going on?

Greg Clayton wrote:

Not really. If you can send me a concrete example of something that isn't working, it might help.

Reporting progress.

1. `im loo -t` only ever finds one "best match", and the plist seems
to have no effect on it.

Use the --all option and it should print all matches.

2. The plist parsing code does get executed. I checked with the
debugger. I also checked symlink versus non-symlinked paths in the
plist, which I'd missed last time. dwarfdump does not seem to read it,
and `im loo` says nothing different, so I have no idea if anything
really got remapped.

3. I managed to catch this "unstable" case: you try something, it
prints a huge error, you try something else in a different frame with
the same type, it prints fine, you come back to the original thing and
there's a smaller error.

So one thing know in LLDB: don't use the expression parser if you don't have to when you run into problems. "frame variable" will show you what you want to see if you are just inspecting a variable or members of a variable:

(lldb) frame variable F
(lldb) frame variable F.Linkage
(lldb) frame variable a->b.c->e[12]

"frame variable" knows how to use ".", "->", "" for array access or using a pointer as an array. It also knows how to prefix the string with "*" or "&":

(lldb) frame variable &F
(lldb) frame variable *a->b.my_ptr

So you should really use frame variable for your viewing needs. It doesn't do any expressions, but it will allow you to view your variable. You should use the expression parser when you need to call a function, do match, flow control or anything that isn't viewing variables.

   frame #0: 0x0000000101c3ce8c libmwcgir_vm_rt.dylib`(anonymous
namespace)::CgJITMemManager::endFunctionBody(this=0x000000010e8637b0,
F=0x000000010a62ccc0, FunctionStart="�?^\n\x01",
FunctionEnd="����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������...")
+ 28 at CgJITMemoryManager.cpp:437
  434 (void)FunctionStart;
  435 (void)FunctionEnd;
  436
-> 437 assert(FunctionEnd > FunctionStart);
  438 assert(FunctionStart == (uint8_T *)(CurBlock+1) &&
  439 "Mismatched function start/end!");
  440
(lldb) p F
error: field 'BasicBlocks' declared with incompatible types in
different translation units ('BasicBlockListType' (aka
'llvm::iplist<llvm::BasicBlock, llvm::ilist_traits<llvm::BasicBlock>

') vs. 'BasicBlockListType' (aka 'llvm::iplist<llvm::BasicBlock,

llvm::ilist_traits<llvm::BasicBlock> >'))
error: field 'ArgumentList' declared with incompatible types in
different translation units ('ArgumentListType' (aka
'llvm::iplist<llvm::Argument, llvm::ilist_traits<llvm::Argument> >')
vs. 'ArgumentListType' (aka 'llvm::iplist<llvm::Argument,
llvm::ilist_traits<llvm::Argument> >'))
error: field 'BasicBlocks' declared with incompatible types in
different translation units ('BasicBlockListType' (aka
'llvm::iplist<llvm::BasicBlock, llvm::ilist_traits<llvm::BasicBlock>

') vs. 'BasicBlockListType' (aka 'llvm::iplist<llvm::BasicBlock,

llvm::ilist_traits<llvm::BasicBlock> >'))
error: field 'Context' declared with incompatible types in different
translation units ('llvm::LLVMContext &' vs. 'llvm::LLVMContext &')
error: field 'GlobalList' declared with incompatible types in
different translation units ('GlobalListType' (aka
'llvm::iplist<llvm::GlobalVariable,
llvm::ilist_traits<llvm::GlobalVariable> >') vs. 'GlobalListType' (aka
'llvm::iplist<llvm::GlobalVariable,
llvm::ilist_traits<llvm::GlobalVariable> >'))
error: field 'FunctionList' declared with incompatible types in
different translation units ('FunctionListType' (aka
'llvm::iplist<llvm::Function, llvm::ilist_traits<llvm::Function> >')
vs. 'FunctionListType' (aka 'llvm::iplist<llvm::Function,
llvm::ilist_traits<llvm::Function> >'))
error: field 'AliasList' declared with incompatible types in different
translation units ('AliasListType' (aka
'llvm::iplist<llvm::GlobalAlias, llvm::ilist_traits<llvm::GlobalAlias>

') vs. 'AliasListType' (aka 'llvm::iplist<llvm::GlobalAlias,

llvm::ilist_traits<llvm::GlobalAlias> >'))
error: field 'NamedMDList' declared with incompatible types in
different translation units ('NamedMDListType' (aka
'llvm::ilist<llvm::NamedMDNode>') vs. 'NamedMDListType' (aka
'llvm::ilist<llvm::NamedMDNode>'))
error: field 'GlobalScopeAsm' declared with incompatible types in
different translation units ('string' (aka
'std::__1::basic_string<char, std::__1::char_traits<char>,
std::__1::allocator<char> >') vs. 'string' (aka
'std::__1::basic_string<char, std::__1::char_traits<char>,
std::__1::allocator<char> >'))
error: field 'ComdatSymTab' declared with incompatible types in
different translation units ('ComdatSymTabType' (aka
'llvm::StringMap<llvm::Comdat, llvm::MallocAllocator>') vs.
'ComdatSymTabType' (aka 'llvm::StringMap<llvm::Comdat,
llvm::MallocAllocator>'))
error: field 'ModuleID' declared with incompatible types in different
translation units ('string' (aka 'std::__1::basic_string<char,
std::__1::char_traits<char>, std::__1::allocator<char> >') vs.
'string' (aka 'std::__1::basic_string<char,
std::__1::char_traits<char>, std::__1::allocator<char> >'))
error: field 'TargetTriple' declared with incompatible types in
different translation units ('string' (aka
'std::__1::basic_string<char, std::__1::char_traits<char>,
std::__1::allocator<char> >') vs. 'string' (aka
'std::__1::basic_string<char, std::__1::char_traits<char>,
std::__1::allocator<char> >'))
error: field 'DataLayoutStr' declared with incompatible types in
different translation units ('string' (aka
'std::__1::basic_string<char, std::__1::char_traits<char>,
std::__1::allocator<char> >') vs. 'string' (aka
'std::__1::basic_string<char, std::__1::char_traits<char>,
std::__1::allocator<char> >'))
error: field 'Parent' declared with incompatible types in different
translation units ('llvm::Module *' vs. 'llvm::Module *')
error: field 'Parent' declared with incompatible types in different
translation units ('llvm::Module *' vs. 'llvm::Module *')
error: field 'Context' declared with incompatible types in different
translation units ('llvm::LLVMContext &' vs. 'llvm::LLVMContext &')
note: declared here with type 'BasicBlockListType' (aka
'llvm::iplist<llvm::BasicBlock, llvm::ilist_traits<llvm::BasicBlock>

')

note: declared here with type 'ArgumentListType' (aka
'llvm::iplist<llvm::Argument, llvm::ilist_traits<llvm::Argument> >')
note: declared here with type 'BasicBlockListType' (aka
'llvm::iplist<llvm::BasicBlock, llvm::ilist_traits<llvm::BasicBlock>

')

note: declared here with type 'llvm::LLVMContext &'
note: declared here with type 'GlobalListType' (aka
'llvm::iplist<llvm::GlobalVariable,
llvm::ilist_traits<llvm::GlobalVariable> >')
note: declared here with type 'FunctionListType' (aka
'llvm::iplist<llvm::Function, llvm::ilist_traits<llvm::Function> >')
note: declared here with type 'AliasListType' (aka
'llvm::iplist<llvm::GlobalAlias, llvm::ilist_traits<llvm::GlobalAlias>

')

note: declared here with type 'NamedMDListType' (aka
'llvm::ilist<llvm::NamedMDNode>')
note: declared here with type 'string' (aka
'std::__1::basic_string<char, std::__1::char_traits<char>,
std::__1::allocator<char> >')
note: declared here with type 'ComdatSymTabType' (aka
'llvm::StringMap<llvm::Comdat, llvm::MallocAllocator>')
note: declared here with type 'string' (aka
'std::__1::basic_string<char, std::__1::char_traits<char>,
std::__1::allocator<char> >')
note: declared here with type 'string' (aka
'std::__1::basic_string<char, std::__1::char_traits<char>,
std::__1::allocator<char> >')
note: declared here with type 'string' (aka
'std::__1::basic_string<char, std::__1::char_traits<char>,
std::__1::allocator<char> >')
note: declared here with type 'llvm::Module *'
note: declared here with type 'llvm::Module *'
note: declared here with type 'llvm::LLVMContext &'
error: 16 errors parsing expression
(lldb) f 4
frame #4: 0x0000000102ea820f
libmwcgir_vm_rt.dylib`llvm::FPPassManager::runOnFunction(this=0x000000010e864360,
F=0x000000010a62ccc0) + 431 at LegacyPassManager.cpp:1545
  1542 PassManagerPrettyStackEntry X(FP, F);
  1543 TimeRegion PassTimer(getPassTimer(FP));
  1544
-> 1545 LocalChanged |= FP->runOnFunction(F);
  1546 }
  1547
  1548 Changed |= LocalChanged;
(lldb) p F
(llvm::Function) $0 = {
llvm::GlobalObject = {
   llvm::GlobalValue = {
     llvm::Constant = {
       llvm::User = {
         llvm::Value = {
           VTy = 0x000000010d8038e0
           UseList = 0x000000010b805f50
           Name = 0x000000010a62cd60
           SubclassID = '\x02'
           HasValueHandle = '\x01'
           SubclassOptionalData = '\0'
           SubclassData = 0
         }
         NumOperands = 0
         OperandList = 0x0000000000000000
       }
     }
     Linkage = ExternalLinkage
     Visibility = 0
     UnnamedAddr = 0
     DllStorageClass = 0
     ThreadLocal = 0
     SubClassData = 0
     Parent = 0x000000010b901250
   }
   Section = ""
   ObjComdat = 0x0000000000000000
}
llvm::ilist_node<llvm::Function> = {
   llvm::ilist_half_node<llvm::Function> = {
     Prev = 0x000000010a62cb50
   }
   Next = 0x000000010a6375d0
}
BasicBlocks = {
   llvm::ilist_traits<llvm::BasicBlock> = {
     Sentinel = {
       Prev = 0x000000010a634b70
     }
   }
   Head = 0x000000010a62cfd0
}
ArgumentList = {
   llvm::ilist_traits<llvm::Argument> = {
     Sentinel = {
       Prev = 0x000000010a62ce40
     }
   }
   Head = 0x000000010a62ce00
}
SymTab = 0x000000010a62cd90
AttributeSets = {
   pImpl = 0x0000000000000000
}
}
(lldb) f 0
frame #0: 0x0000000101c3ce8c libmwcgir_vm_rt.dylib`(anonymous
namespace)::CgJITMemManager::endFunctionBody(this=0x000000010e8637b0,
F=0x000000010a62ccc0, FunctionStart="�?^\n\x01",
FunctionEnd="����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������...")
+ 28 at CgJITMemoryManager.cpp:437
  434 (void)FunctionStart;
  435 (void)FunctionEnd;
  436
-> 437 assert(FunctionEnd > FunctionStart);
  438 assert(FunctionStart == (uint8_T *)(CurBlock+1) &&
  439 "Mismatched function start/end!");
  440
(lldb) p F
error: field '__r_' declared with incompatible types in different
translation units
('std::__1::__compressed_pair<std::__1::basic_string<char,
std::__1::char_traits<char>, std::__1::allocator<char> >::__rep,
std::__1::allocator<char> >' vs.
'std::__1::__compressed_pair<std::__1::basic_string<char,
std::__1::char_traits<char>, std::__1::allocator<char> >::__rep,
std::__1::allocator<char> >')
note: declared here with type
'std::__1::__compressed_pair<std::__1::basic_string<char,
std::__1::char_traits<char>, std::__1::allocator<char> >::__rep,
std::__1::allocator<char> >'
error: 1 errors parsing expression
(lldb) im loo -t
"std::__1::__compressed_pair<std::__1::basic_string<char,
std::__1::char_traits<char>, std::__1::allocator<char> >::__rep,
std::__1::allocator<char> >"
        Best match found in
/mathworks/devel/sbs/34/rramacha.idivide-final-lap/matlab/bin/maci64/libmwcgir_vm_rt.dylib:
id = {0x000457b5}, name =
"__compressed_pair<std::__1::basic_string<char,
std::__1::char_traits<char>, std::__1::allocator<char> >::__rep,
std::__1::allocator<char> >", qualified =
"std::__1::__compressed_pair<std::__1::basic_string<char,
std::__1::char_traits<char>, std::__1::allocator<char> >::__rep,
std::__1::allocator<char> >", byte-size = 24, decl = memory:2297,
compiler_type = "class __compressed_pair : private
std::__1::__libcpp_compressed_pair_imp<std::__1::basic_string<char,
std::__1::char_traits<char>, std::__1::allocator<char> >::__rep,
std::__1::allocator<char>, 2> {
   __compressed_pair();
   explicit __compressed_pair(_T1_param);
   explicit __compressed_pair(_T2_param);
   __compressed_pair(_T1_param, _T2_param);
   _T1_reference first();
   _T1_const_reference first() const;
   _T2_reference second();
   _T2_const_reference second() const;
   void swap(std::__1::__compressed_pair<std::__1::basic_string<char,
std::__1::char_traits<char>, std::__1::allocator<char> >::__rep,
std::__1::allocator<char> > &);
}"

Before the recent patch you developed, the variable on f 4 also failed to print.

More insights into what might be going on?

Not from the above output. Try to enable expression logging with:

(lldb) log enable -f /tmp/expr-log.txt lldb expr

Then run your expression. It might shed some more light...

Be sure to use "frame variable" more as it will never run into these type importation problems when you need to view a variable or members of a variable.

It would be interesting to see the output of "frame variable" from frame 0 and frame 4 and see if they differ at all.

Greg Clayton wrote:

Be sure to use "frame variable" more as it will never run into these type importation problems when you need to view a variable or members of a variable.

It would be interesting to see the output of "frame variable" from frame 0 and frame 4 and see if they differ at all.

`fr va` seems to fix the immediate problem, thanks! I'll let you know
if I run into issues with it.

We really should fix the expression parser, no? Why is it behaving strangely?

Greg Clayton wrote:

Be sure to use "frame variable" more as it will never run into these type importation problems when you need to view a variable or members of a variable.

It would be interesting to see the output of "frame variable" from frame 0 and frame 4 and see if they differ at all.

`fr va` seems to fix the immediate problem, thanks! I'll let you know
if I run into issues with it.

We really should fix the expression parser, no?

Yes, but we need to identify the problem.

Why is it behaving strangely?

There are many clang::ASTContext objects in LLDB. 1 per module, 1 per target and 1 for each expression. We import types from one AST to another. When running expressions we import one type for "foo<int>" from liba.so into the expression AST, then we might try to import another from libb.so into the expression AST. If the "foo<int>" type is already in the expression AST, then we need to verify the two types are the same. When this fails, then the expression fails.

So we need to determine which two versions of "foo<int>" are different and where they differ so we can understand how to fix this.

Follow my previous suggestions: enable lldb expr logging and also compare the output of the two "frame variable F" for frame 0 and frame 4 in your previous example. Since "frame variable" always uses the type _only_ from liba.so or libb.so, we might be able to see a difference in the output of "frame variable F" for the two frames. If we don't see any difference, we need to dump the type from "image lookup --all -t "foo<int>" and see if we see any differences there. If we don't see differences we need to then step through the code that is attempting to import "foo<int>" the second time and see where it thinks the types differ.

Greg Clayton

I will need to pass this to Sean Callanan to see if he can tell anything. It might be a few days before he can get to it.

I'll let you know when I know more.