jimingham wrote:

This is fine.  

The thread management in ThreadPlans has gotten tricky because we can't in fact 
guarantee that a ThreadPlan will always have a Thread associated with it.  

In cases like the xnu which only lists the "on core" threads at any given spot, 
lldb stores the TID and attaches itself to any new Thread that shows up with 
that TID.  And for async systems like swift-async, the ThreadPlan might have to 
migrate from one user-space thread to another.

The guarantee is really that by the time there's any useful question you might 
ask of a ThreadPlan, it will have gotten reattached to a thread.  But 
DoTakedown is special since it gets called in the Destructor, and since there's 
no clear way to assign a thread to it before Destruction, making the check here 
is appropriate.

Note, you could also just check if the process is alive - if they've called 
exit it should no longer be.  If you get to DoTakedown and the m_process in the 
ThreadPlan is in eStateExited, you can just exit right away, you aren't going 
to do any good.

https://github.com/llvm/llvm-project/pull/195910
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to