[Lldb-commits] [PATCH] D75711: [NFC] Have ThreadPlans hold onto the Process & TID, rather than the Thread

Greg Clayton via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu Mar 12 16:18:36 PDT 2020


clayborg added a comment.

Everything looks good, just a question in inlined comment about having a thread plan hold onto a pointer to a thread. Seems dangerous



================
Comment at: lldb/include/lldb/Target/ThreadPlan.h:601
 
+  Thread *m_thread;
   ThreadPlanKind m_kind;
----------------
This seems dangerous to hold onto? It can go stale if the thread goes away right? If we have the m_tid, why do we need this? If we want a thread pointer in this class, should it be a std::weak_ptr? It also seems that if we make a ThreadRef class that is something like:

```
struct ThreadRef {
  std::weak_ptr<lldb_private::Thread> m_thread_wp;
  lldb::tid_t m_tid;
};
```

We could re-use this in this class and ExecutionContextRef.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D75711/new/

https://reviews.llvm.org/D75711





More information about the lldb-commits mailing list