[Lldb-commits] [lldb] Fix a bug with cancelling "attach -w" after you have run a process previously (PR #65822)

via lldb-commits lldb-commits at lists.llvm.org
Mon Sep 11 09:34:17 PDT 2023


jimingham wrote:

> > This is in reply to Alex's comment about why we keep the process around, but the quote this reply didn't seem to work...
> > After a process exits you might still want to ask it what its exit status was. Plus there might be other system accounting we've gathered for that process. So until you replace it with another process, you very well might want to ask questions of it. So we can't just destroy it as soon as it exits.
> 
> That definitely explains why we persist the previous process even after its finished, but this doesn't sound like there's a technical limitation to actually removing the Process from the Target after it exits. To be more specific, you could either make it so the Process object in `m_process_sp` could be moved out and into another member of Target, or you could just persist the data you care about instead of the entire process.
> 
> That might be an alternative to this solution but I'm not sure if that would be any better or more useful than what you're doing here. I'm mostly thinking aloud here (and trying to improve my knowledge of LLDB).

I'm not sure this would make things easier.  The model where you just ask info of the dead process till you make another one is very straightforward.  Also, the window where this is likely to cause problems is very small, and all internal to launching and attaching, so making the handling of the old process more complex to solve this problem seems like overkill.  

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


More information about the lldb-commits mailing list