New test test/functionalities/process_attach/attach_denied covers the case when attach is denied by potential inferior.
This test uncovered next issues that I fixed along as well:
- lldbtest calls SBProcess::Kill for every inferior within test's tearDown. If attach fails ProcessPOSIX::DoDestroy calls m_monitor->Kill() which sends SIGKILL to pid 0, i.e. killing all processes in the current process group. Added check for invalid pid in ProcessPOSIX::DoDestroy
- Modified ProcessPOSIX::DoDestroy made test to fail since Kill returns an error. Changed Target/Process.cpp in order to transition process to exited state in case of attach failure - so, DoDestroy exits properly since HasExited() returns true.