[Lldb-commits] [lldb] [lldb] Fix missing overloads in ThreadMemory (PR #132734)

via lldb-commits lldb-commits at lists.llvm.org
Mon Mar 24 14:12:55 PDT 2025


================
@@ -79,34 +136,124 @@ class ThreadMemory : public lldb_private::Thread {
   }
 
   bool SetBackingThread(const lldb::ThreadSP &thread_sp) override {
-    // printf ("Thread 0x%llx is being backed by thread 0x%llx\n", GetID(),
-    // thread_sp->GetID());
     m_backing_thread_sp = thread_sp;
     thread_sp->SetBackedThread(*this);
-    return (bool)thread_sp;
+    return thread_sp.get();
   }
 
   lldb::ThreadSP GetBackingThread() const override {
     return m_backing_thread_sp;
   }
 
-protected:
   bool IsOperatingSystemPluginThread() const override { return true; }
 
-  // If this memory thread is actually represented by a thread from the
-  // lldb_private::Process subclass, then fill in the thread here and
-  // all APIs will be routed through this thread object. If m_backing_thread_sp
-  // is empty, then this thread is simply in memory with no representation
-  // through the process plug-in.
+private:
+  lldb::addr_t m_register_data_addr;
   lldb::ThreadSP m_backing_thread_sp;
-  lldb::ValueObjectSP m_thread_info_valobj_sp;
+
+  ThreadMemory(const ThreadMemory &) = delete;
+  const ThreadMemory &operator=(const ThreadMemory &) = delete;
+};
+
+class ThreadMemoryProvidingName : public ThreadMemory {
+public:
+  ThreadMemoryProvidingName(lldb_private::Process &process, lldb::tid_t tid,
+                            lldb::addr_t register_data_addr,
+                            llvm::StringRef name)
+      : ThreadMemory(process, tid, register_data_addr), m_name(name) {}
+
+  const char *GetName() override {
+    if (!m_name.empty())
+      return m_name.c_str();
+    return ThreadMemory::GetName();
+  }
+
+  ~ThreadMemoryProvidingName() override = default;
+
+private:
   std::string m_name;
+};
+
+/// A NamedThreadMemory that has optional queue information.
+class ThreadMemoryProvidingNameAndQueue : public ThreadMemoryProvidingName {
+public:
+  ThreadMemoryProvidingNameAndQueue(
+      lldb_private::Process &process, lldb::tid_t tid,
+      const lldb::ValueObjectSP &thread_info_valobj_sp);
+
+  ThreadMemoryProvidingNameAndQueue(lldb_private::Process &process,
+                                    lldb::tid_t tid, llvm::StringRef name,
+                                    llvm::StringRef queue,
+                                    lldb::addr_t register_data_addr);
+
+  ~ThreadMemoryProvidingNameAndQueue() override = default;
+
+  const char *GetQueueName() override {
+    if (!m_queue.empty())
+      return m_queue.c_str();
+    return ThreadMemory::GetQueueName();
+  }
+
+  /// This method has not yet been specialized.
+  void SetQueueName(const char *name) override { Thread::SetQueueName(name); }
+
+  /// This method has not yet been specialized.
+  lldb::queue_id_t GetQueueID() override { return Thread::GetQueueID(); }
+
+  /// This method has not yet been specialized.
+  void SetQueueID(lldb::queue_id_t new_val) override {
+    Thread::SetQueueID(new_val);
+  }
+
+  /// This method has not yet been specialized.
+  lldb::QueueKind GetQueueKind() override { return Thread::GetQueueKind(); }
+
+  /// This method has not yet been specialized.
+  void SetQueueKind(lldb::QueueKind kind) override {
+    Thread::SetQueueKind(kind);
+  }
+
+  /// This method has not yet been specialized.
----------------
jimingham wrote:

This is a bit mysterious, what do you mean by this?

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


More information about the lldb-commits mailing list