[Bug 30822] New: lldb-mi failing in llvm::CommandLine global constructor on debug builds

Bug ID 30822
Summary lldb-mi failing in llvm::CommandLine global constructor on debug builds
Product lldb
Version unspecified
Hardware PC
OS Linux
Status NEW
Severity normal
Priority P
Component All Bugs
Assignee lldb-dev@lists.llvm.org
Reporter todd.fiala@gmail.com
CC llvm-bugs@lists.llvm.org
Classification Unclassified

On Ubuntu 14.04 and 16.04 x86_64, I am seeing a failure to run lldb-mi due to
an assert being raised on builds where NDEBUG is not defined.

The failure is in a global constructor in LLVM's Debug.cpp file where it adds a
'debug' command line option.  At the time the global constructor files, the
StringDictionary where the option is being checked for existence seems to
indicate it has something like 7k objects in it, which seems wrong.  Running
through valgrind doesn't show any memory stomps, though.

Here is the CMake/ninja setup I'm using:

# For Ubuntu 14.04
$ CC=clang-3.6 CXX=clang++-3.6 cmake -GNinja -DCMAKE_BUILD_TYPE=Debug ../llvm
$ ninja

Here's the error:
$ bin/lldb-mi
: CommandLine Error: Option 'debug' registered more than once!
LLVM ERROR: inconsistency in registered CommandLine options

I am wondering if:
(a) our Ubuntu buildbots are seeing this behavior?
(b) why we're not failing the build?

This regression seems to have been introduced fairly recently, as I have
downstream Ubuntu repositories that I directly manage (ci.swift.org) where we
do run the lldb-mi tests on Ubuntu, and the lldb-mi failure seems to have only
shown up after r281031.

Todd Fiala changed bug 30822