diff options
| author | Stephen Wilson <wilsons@start.ca> | 2011-01-19 01:30:44 +0000 |
|---|---|---|
| committer | Stephen Wilson <wilsons@start.ca> | 2011-01-19 01:30:44 +0000 |
| commit | e3296308730ce840f8ce2240d260ab54f430215c (patch) | |
| tree | 592185ab3f2d51f6427952f484d4f3741bcaaafc /lldb/source/Plugins/Process/Linux | |
| parent | 9f71f0cb667422d6778768b101e56e15b528e2ca (diff) | |
| download | bcm5719-llvm-e3296308730ce840f8ce2240d260ab54f430215c.tar.gz bcm5719-llvm-e3296308730ce840f8ce2240d260ab54f430215c.zip | |
Timeout if we fail to receive a state change event when destroying an inferior.
llvm-svn: 123796
Diffstat (limited to 'lldb/source/Plugins/Process/Linux')
| -rw-r--r-- | lldb/source/Plugins/Process/Linux/ProcessLinux.cpp | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/lldb/source/Plugins/Process/Linux/ProcessLinux.cpp b/lldb/source/Plugins/Process/Linux/ProcessLinux.cpp index 0e8774f4d61..ecf8479ddde 100644 --- a/lldb/source/Plugins/Process/Linux/ProcessLinux.cpp +++ b/lldb/source/Plugins/Process/Linux/ProcessLinux.cpp @@ -223,20 +223,28 @@ ProcessLinux::DoDestroy() return error; } - // Wait for the event to arrive. This guaranteed to be an exit event. + // Wait for the event to arrive. This is guaranteed to be an exit event. StateType state; EventSP event; do { - state = WaitForStateChangedEventsPrivate(NULL, event); - } while (state != eStateExited); + TimeValue timeout_time; + timeout_time = TimeValue::Now(); + timeout_time.OffsetWithSeconds(2); + state = WaitForStateChangedEventsPrivate(&timeout_time, event); + } while (state != eStateExited && state != eStateInvalid); + + // Check if we timed out waiting for the exit event to arrive. + if (state == eStateInvalid) + error.SetErrorString("ProcessLinux::DoDestroy timed out."); // Restart standard event handling and send the process the final kill, // driving it out of limbo. ResumePrivateStateThread(); } - if (kill(m_monitor->GetPID(), SIGKILL)) + if (kill(m_monitor->GetPID(), SIGKILL) && error.Success()) error.SetErrorToErrno(); + return error; } |

