diff options
| author | Zachary Turner <zturner@google.com> | 2014-12-03 22:04:18 +0000 |
|---|---|---|
| committer | Zachary Turner <zturner@google.com> | 2014-12-03 22:04:18 +0000 |
| commit | c6a6653ebb59a40f1701bd757540cdaf1108c969 (patch) | |
| tree | fba6553f28bbb3e1fb79ea0297e6029051f775bb /lldb/source/Plugins/Process/Windows/DebuggerThread.h | |
| parent | bbc017851815da300ce9d6315204a73d68754a1c (diff) | |
| download | bcm5719-llvm-c6a6653ebb59a40f1701bd757540cdaf1108c969.tar.gz bcm5719-llvm-c6a6653ebb59a40f1701bd757540cdaf1108c969.zip | |
Correctly shutdown when DoDestroy is called with an active exception.
Previously if we got a DoDestroy while stopped at a breakpoint, we
would detach and then say the process had exited. This is completely
wrong, as it resulted in the python script incorrectly assuming that
the process had actually exited and trying to delete the image, when
in fact it had done no such thing.
The fix employed here is that when we get a DoDestroy, we do 3 steps:
1) initiate a termination sequence on the process
2) If we were stopped handling an exception of any kind, mask it and
let the program resume, causing the program to see the termination
request and exit on its own.
3) Let the program exit normally, and close all of our handles before
returning control back to DoDestroy.
This fixes Bug 21722 and Bug 21723.
llvm-svn: 223272
Diffstat (limited to 'lldb/source/Plugins/Process/Windows/DebuggerThread.h')
| -rw-r--r-- | lldb/source/Plugins/Process/Windows/DebuggerThread.h | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/lldb/source/Plugins/Process/Windows/DebuggerThread.h b/lldb/source/Plugins/Process/Windows/DebuggerThread.h index 389a1d3c88c..586a1a76856 100644 --- a/lldb/source/Plugins/Process/Windows/DebuggerThread.h +++ b/lldb/source/Plugins/Process/Windows/DebuggerThread.h @@ -45,10 +45,18 @@ class DebuggerThread : public std::enable_shared_from_this<DebuggerThread> { return m_main_thread; } + ExceptionRecord * + GetActiveException() + { + return m_active_exception.get(); + } + + Error StopDebugging(bool terminate); void ContinueAsyncException(ExceptionResult result); private: + void FreeProcessHandles(); void DebugLoop(); ExceptionResult HandleExceptionEvent(const EXCEPTION_DEBUG_INFO &info, DWORD thread_id); DWORD HandleCreateThreadEvent(const CREATE_THREAD_DEBUG_INFO &info, DWORD thread_id); @@ -66,9 +74,11 @@ class DebuggerThread : public std::enable_shared_from_this<DebuggerThread> HostThread m_main_thread; // The main thread of the inferior. HANDLE m_image_file; // The image file of the process being debugged. - Predicate<ExceptionResult> m_exception; // A predicate which gets signalled when an exception - // is finished processing and the debug loop can be - // continued. + ExceptionRecordUP m_active_exception; // The current exception waiting to be handled + + Predicate<ExceptionResult> m_exception_pred; // A predicate which gets signalled when an exception + // is finished processing and the debug loop can be + // continued. static lldb::thread_result_t DebuggerThreadRoutine(void *data); lldb::thread_result_t DebuggerThreadRoutine(const ProcessLaunchInfo &launch_info); |

