diff options
author | Jason Molenda <jmolenda@apple.com> | 2015-04-17 05:01:58 +0000 |
---|---|---|
committer | Jason Molenda <jmolenda@apple.com> | 2015-04-17 05:01:58 +0000 |
commit | ede3193bbd336bd817b918b348243fc3bfc3ab6b (patch) | |
tree | 895b41ba17b787373ca6c6ac5b10ebeb2d040bb8 /lldb/source/Target/Process.cpp | |
parent | 66eda7323c8e627d8e796c6fac012d99d6fa3341 (diff) | |
download | bcm5719-llvm-ede3193bbd336bd817b918b348243fc3bfc3ab6b.tar.gz bcm5719-llvm-ede3193bbd336bd817b918b348243fc3bfc3ab6b.zip |
Add a "force_kill" arg to Process::Destroy(). This is needed after
the changes in r233255/r233258. Normally if lldb attaches to
a running process, when we call Process::Destroy, we want to detach
from the process. If lldb launched the process itself, ::Destroy
should kill it.
However, if we attach to a process and the driver calls SBProcess::Kill()
(which calls Destroy), we need to kill it even if we didn't launch it
originally.
The force_kill param allows for the SBProcess::Kill method to force the
behavior of Destroy.
<rdar://problem/20424439>
llvm-svn: 235158
Diffstat (limited to 'lldb/source/Target/Process.cpp')
-rw-r--r-- | lldb/source/Target/Process.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/lldb/source/Target/Process.cpp b/lldb/source/Target/Process.cpp index 606c2c0b2ff..caa6756afcd 100644 --- a/lldb/source/Target/Process.cpp +++ b/lldb/source/Target/Process.cpp @@ -836,7 +836,7 @@ Process::Finalize() case eStateStepping: case eStateCrashed: case eStateSuspended: - Destroy(); + Destroy(false); break; case eStateInvalid: @@ -3160,7 +3160,7 @@ Process::Launch (ProcessLaunchInfo &launch_info) // catch the initial stop. error.SetErrorString ("failed to catch stop after launch"); SetExitStatus (0, "failed to catch stop after launch"); - Destroy(); + Destroy(false); } else if (state == eStateStopped || state == eStateCrashed) { @@ -3787,7 +3787,7 @@ Process::Halt (bool clear_thread_plans) RestorePrivateProcessEvents(); restored_process_events = true; SetExitStatus(SIGKILL, "Cancelled async attach."); - Destroy (); + Destroy (false); } else { @@ -3961,12 +3961,15 @@ Process::Detach (bool keep_stopped) } Error -Process::Destroy () +Process::Destroy (bool force_kill) { // Tell ourselves we are in the process of destroying the process, so that we don't do any unnecessary work // that might hinder the destruction. Remember to set this back to false when we are done. That way if the attempt // failed and the process stays around for some reason it won't be in a confused state. + + if (force_kill) + m_should_detach = false; if (GetShouldDetach()) { |