[Lldb-commits] [lldb] r274374 - Try to fix Ubuntu buildbots after I broke thread local variables with 274366.

Greg Clayton via lldb-commits lldb-commits at lists.llvm.org
Fri Jul 1 11:22:01 PDT 2016


Author: gclayton
Date: Fri Jul  1 13:22:01 2016
New Revision: 274374

URL: http://llvm.org/viewvc/llvm-project?rev=274374&view=rev
Log:
Try to fix Ubuntu buildbots after I broke thread local variables with 274366.


Modified:
    lldb/trunk/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp

Modified: lldb/trunk/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp?rev=274374&r1=274373&r2=274374&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp (original)
+++ lldb/trunk/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp Fri Jul  1 13:22:01 2016
@@ -599,10 +599,19 @@ DynamicLoaderPOSIXDYLD::GetEntryPoint()
 }
 
 lldb::addr_t
-DynamicLoaderPOSIXDYLD::GetThreadLocalData(const lldb::ModuleSP module, const lldb::ThreadSP thread,
+DynamicLoaderPOSIXDYLD::GetThreadLocalData(const lldb::ModuleSP module_sp, const lldb::ThreadSP thread,
                                            lldb::addr_t tls_file_addr)
 {
-    auto it = m_loaded_modules.find (module);
+    lldb_private::Address tls_addr;
+    if (!module_sp->ResolveFileAddress(tls_file_addr, tls_addr))
+        return LLDB_INVALID_ADDRESS;
+
+    const lldb::addr_t tls_load_addr = tls_addr.GetLoadAddress(&m_process->GetTarget());;
+
+    if (tls_load_addr == LLDB_INVALID_ADDRESS)
+        return LLDB_INVALID_ADDRESS;
+
+    auto it = m_loaded_modules.find (module_sp);
     if (it == m_loaded_modules.end())
         return LLDB_INVALID_ADDRESS;
 
@@ -635,14 +644,13 @@ DynamicLoaderPOSIXDYLD::GetThreadLocalDa
     addr_t dtv_slot = dtv + metadata.dtv_slot_size*modid;
     addr_t tls_block = ReadPointer (dtv_slot + metadata.tls_offset);
 
-    Module *mod = module.get();
     Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER));
     if (log)
         log->Printf("DynamicLoaderPOSIXDYLD::Performed TLS lookup: "
                     "module=%s, link_map=0x%" PRIx64 ", tp=0x%" PRIx64 ", modid=%" PRId64 ", tls_block=0x%" PRIx64 "\n",
-                    mod->GetObjectName().AsCString(""), link_map, tp, (int64_t)modid, tls_block);
+                    module_sp->GetObjectName().AsCString(""), link_map, tp, (int64_t)modid, tls_block);
 
-    return tls_block + tls_file_addr;
+    return tls_block + tls_load_addr;
 }
 
 void




More information about the lldb-commits mailing list