beanz added a comment.

This patch ends up hiding the problem, not fixing it. If it unblocks something 
it might be ok, but it doesn't actually fix the problem.

The underlying problem is that liblldb and lldb-mi have their own copies of 
LLVM with their own copies of the GlobalParser static 
(llvm/lib/Support/CommandLine.cpp), and the corresponding static for the debug 
cl::opt (llvm/lib/Support/Debug.cpp).

When the library exports the LLVM symbols, the dynamic loader loads lldb-mi and 
it makes the cl::opt constructor point at the same instance of the GlobalParser 
(following link-once ODR rules).

When the library doesn't export the LLVM symbols, the cl::opt variables inside 
liblldb resolve to the GlobalParser inside liblldb (because it is local), and 
the cl::opt variables inside lldb-mi resolve inside lldb-mi because the loader 
cannot see the GlobalParser from liblldb because the symbol isn't exported. 
This makes two instances of the GlobalParser exist at the same time.

This does work around the problem Todd was seeing. Unfortunately, it doesn't 
actually fix the problem, and if lldb-mi is using cl::opt across the library 
boundary it will cause subtle and difficult to diagnose bugs.


https://reviews.llvm.org/D26093



_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to