[Lldb-commits] [PATCH] D84210: [lldb] Use a weak pointer to hold on to the underlying thread plan in SBThreadPlan

Jonas Devlieghere via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Mon Jul 20 21:16:37 PDT 2020


JDevlieghere created this revision.
JDevlieghere added reviewers: jingham, labath, teemperor.
JDevlieghere updated this revision to Diff 279379.
JDevlieghere added a comment.
jingham accepted this revision.
This revision is now accepted and ready to land.

`s/thread_plan/thread_plan_sp/g`


jingham added a comment.

Yes, the only way you can get your hands on an SBThreadPlan is in the process of queueing one, so the ThreadPlan stack will always be the one to manage the lifecycle of a plan.  And if an SBThreadPlan represents a ThreadPlan that has been discarded, it should convert back to an empty SBThreadPlan rather than keeping the underlying plan alive.  So this is correct.


jingham added a comment.

LGTM


Use a weak pointer to hold on to the the underlying thread plan in SBThreadPlan. When the process continues, all the popped ThreadPlans get discarded, and you can’t reuse them, so you have to create them anew. Therefore the SBThreadPlan doesn’t need to keep the ThreadPlan alive. This fixes the cleanup error in TestThreadPlanCommands.py and TestStepScripted.py caused by the thread plans never being deleted.


https://reviews.llvm.org/D84210

Files:
  lldb/include/lldb/API/SBThreadPlan.h
  lldb/include/lldb/lldb-forward.h
  lldb/source/API/SBThreadPlan.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D84210.279379.patch
Type: text/x-patch
Size: 12135 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20200721/5252fb71/attachment-0001.bin>


More information about the lldb-commits mailing list