From c8d9748c06ad4b6cd372a1564eaebf6398c31e13 Mon Sep 17 00:00:00 2001 From: Zachary Turner Date: Tue, 9 Dec 2014 19:13:50 +0000 Subject: [PATCH] Create a valid stop info for all non-breakpoint exceptions. llvm-svn: 223812 --- .../Plugins/Process/Windows/ProcessWindows.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/lldb/source/Plugins/Process/Windows/ProcessWindows.cpp b/lldb/source/Plugins/Process/Windows/ProcessWindows.cpp index 08bf698a3101..bedecd441251 100644 --- a/lldb/source/Plugins/Process/Windows/ProcessWindows.cpp +++ b/lldb/source/Plugins/Process/Windows/ProcessWindows.cpp @@ -41,6 +41,8 @@ #include "ProcessWindows.h" #include "TargetThreadWindows.h" +#include "llvm/Support/raw_ostream.h" + using namespace lldb; using namespace lldb_private; @@ -236,7 +238,7 @@ Error ProcessWindows::DoResume() { Error error; - if (GetPrivateState() == eStateStopped) + if (GetPrivateState() == eStateStopped || GetPrivateState() == eStateCrashed) { if (m_session_data->m_debugger->GetActiveException()) { @@ -299,9 +301,9 @@ ProcessWindows::RefreshStateAfterStop() ThreadSP stop_thread = m_thread_list.GetSelectedThread(); RegisterContextSP register_context = stop_thread->GetRegisterContext(); + uint64_t pc = register_context->GetPC(); if (active_exception->GetExceptionCode() == EXCEPTION_BREAKPOINT) { - uint64_t pc = register_context->GetPC(); // TODO(zturner): The current EIP is AFTER the BP opcode, which is one byte. So // to find the breakpoint, move the PC back. A better way to do this is probably // to ask the Platform how big a breakpoint opcode is. @@ -318,6 +320,14 @@ ProcessWindows::RefreshStateAfterStop() stop_info = StopInfo::CreateStopReasonWithBreakpointSiteID(*stop_thread, break_id, should_stop); stop_thread->SetStopInfo(stop_info); } + else + { + std::string desc; + llvm::raw_string_ostream desc_stream(desc); + desc_stream << "Exception " << active_exception->GetExceptionCode() << " encountered at address " << pc; + stop_info = StopInfo::CreateStopReasonWithException(*stop_thread, desc_stream.str().c_str()); + stop_thread->SetStopInfo(stop_info); + } } bool