Author: labath Date: Tue Sep 1 05:59:36 2015 New Revision: 246539 URL: http://llvm.org/viewvc/llvm-project?rev=246539&view=rev Log: [NativeProcessLinux] Fix assertion failure when killing a process
Linux sometimes sends us a PTRACE_EVENT_EXIT when an inferior process gets a SIGKILL. This can be confusing, since normally we don't expect any events when the inferior is stopped. This commit adds code to handle this situation (resume the thread and let it exit normally) and avoid an assertion failure in ResumeThread(). Modified: lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp Modified: lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp?rev=246539&r1=246538&r2=246539&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp (original) +++ lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp Tue Sep 1 05:59:36 2015 @@ -1262,7 +1262,16 @@ NativeProcessLinux::MonitorSIGTRAP(const SetExitStatus (convert_pid_status_to_exit_type (data), convert_pid_status_to_return_code (data), nullptr, true); } - ResumeThread(thread, thread.GetState(), LLDB_INVALID_SIGNAL_NUMBER); + StateType state = thread.GetState(); + if (! StateIsRunningState(state)) + { + // Due to a kernel bug, we may sometimes get this stop after the inferior gets a + // SIGKILL. This confuses our state tracking logic in ResumeThread(), since normally, + // we should not be receiving any ptrace events while the inferior is stopped. This + // makes sure that the inferior is resumed and exits normally. + state = eStateRunning; + } + ResumeThread(thread, state, LLDB_INVALID_SIGNAL_NUMBER); break; } _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits