[lldb-dev] Can Process hold a TargetSP instead of a Target&?

Greg Clayton via lldb-dev lldb-dev at lists.llvm.org
Mon Aug 31 14:53:38 PDT 2015


> On Aug 31, 2015, at 1:34 PM, Zachary Turner <zturner at google.com> wrote:
> 
> Windows plugin holds a strong reference to itself.  It calls shared_from_this() when the process is launched, and it releases this strong reference after a process exits.  It does this because the debug loop happens in a different thread, and it wanted to ensure that the process plugin cannot be killed before we've cleaned up gracefully.
> 
> Should this also be changed to a weak_ptr?

I would change it to a std::weak_ptr if possible. That way if the plug-in goes away, you will try to lock the weak pointer and notice the shared pointer is NULL and know the process is gone and you can proceed to shut down this extra thread. 


More information about the lldb-dev mailing list