[Lldb-commits] [lldb] [lldb][Windows] Support TLS variables with PDB (PR #229894)

Charles Zablit via lldb-commits lldb-commits at lists.llvm.org
Thu Oct 8 02:59:03 PDT 2026


================
@@ -247,3 +247,96 @@ DynamicLoaderWindowsDYLD::GetStepThroughTrampolinePlan(Thread &thread,
   return ThreadPlanSP(new ThreadPlanStepInstruction(
       thread, false, false, eVoteNoOpinion, eVoteNoOpinion));
 }
+
+lldb::addr_t
+DynamicLoaderWindowsDYLD::GetThreadLocalData(const lldb::ModuleSP module,
+                                             lldb::ThreadSP thread,
+                                             lldb::addr_t tls_file_addr) {
+  Log *log = GetLog(LLDBLog::DynamicLoader);
+  std::string object_name;
+  if (log) {
+    ObjectFile *obj = module->GetObjectFile();
+    if (obj)
+      object_name = obj->GetObjectName();
+  }
+
+  StructuredData::ObjectSP extended_info = thread->GetExtendedInfo();
+  if (!extended_info) {
+    LLDB_LOG(log, "missing extended info of thread");
+    return LLDB_INVALID_ADDRESS;
+  }
+  StructuredData::Dictionary *dict = extended_info->GetAsDictionary();
+  if (!dict) {
+    LLDB_LOG(log, "extended info of thread is not a dictionary");
+    return LLDB_INVALID_ADDRESS;
+  }
+  addr_t teb_base = 0;
+  if (!dict->GetValueForKeyAsInteger("teb_address", teb_base) || !teb_base ||
----------------
charles-zablit wrote:

Shouldn't the `!dict->GetValueForKeyAsInteger("teb_address", teb_base)` be at the very end here?

https://github.com/llvm/llvm-project/pull/229894


More information about the lldb-commits mailing list