diff options
| author | Pavel Labath <labath@google.com> | 2015-09-01 10:59:36 +0000 |
|---|---|---|
| committer | Pavel Labath <labath@google.com> | 2015-09-01 10:59:36 +0000 |
| commit | 86852d3676b8d3f12bbac36f107d44a5b73afcc8 (patch) | |
| tree | 9a5623b37c8ab9f82be0ce646d40c00464b23ddd /lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp | |
| parent | 55f5c3d43b21ccb3fcb93ad1ad2e7ff886950a6e (diff) | |
| download | llvm-86852d3676b8d3f12bbac36f107d44a5b73afcc8.zip llvm-86852d3676b8d3f12bbac36f107d44a5b73afcc8.tar.gz llvm-86852d3676b8d3f12bbac36f107d44a5b73afcc8.tar.bz2 | |
[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().
llvm-svn: 246539
Diffstat (limited to 'lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp')
| -rw-r--r-- | lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp b/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp index ba8e4be..0551596 100644 --- a/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp +++ b/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp @@ -1262,7 +1262,16 @@ NativeProcessLinux::MonitorSIGTRAP(const siginfo_t &info, NativeThreadLinux &thr 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; } |
