Debugging: "No TLS data currently exists for this thread." DynamicLoaderPOSIXDYLD m_loaded_modules link_map_addr == LLDB_INVALID_ADDRESS

We encountered an lldb specific issue (Linux x86_64) with TLS variables, as detailed here:

gdb (8.2) is able to handle such __thread value lookups without trouble (but we need to use lldb not gdb, as we’ve implemented our COBOL and PL/I debugging extensions in lldb)

I’ve attempted to start debugging this, and get as far as seeing that:

Trigger for this issue appears to be:

lldb_private::thread::GetThreadLocalData() calls DynamicLoaderPOSIXDYLD::GetThreadLocalData()

which creates an iterator with:

auto it = m_loaded_modules.find(module_sp);



There are two places ( DynamicLoaderPOSIXDYLD::UpdateLoadedSections, DynamicLoaderPOSIXDYLD::UpdateLoadedSections ) that insert values into the std::map m_loaded_modules, but in my debug session I see only calls to the first of these (some of these are -1 values, and others valid.)

Can somebody who is familiar with this lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp code point me in the right direction to isolate the root cause for this LLDB_INVALID_ADDRESS map insertion, or provide some pointers for how to further debug and/or fix this problem?