Changeset View
Changeset View
Standalone View
Standalone View
lldb/source/Plugins/Process/Windows/Common/DebuggerThread.cpp
Show First 20 Lines • Show All 229 Lines • ▼ Show 20 Lines | |||||
void DebuggerThread::DebugLoop() { | void DebuggerThread::DebugLoop() { | ||||
Log *log = GetLog(WindowsLog::Event); | Log *log = GetLog(WindowsLog::Event); | ||||
DEBUG_EVENT dbe = {}; | DEBUG_EVENT dbe = {}; | ||||
bool should_debug = true; | bool should_debug = true; | ||||
LLDB_LOGV(log, "Entering WaitForDebugEvent loop"); | LLDB_LOGV(log, "Entering WaitForDebugEvent loop"); | ||||
while (should_debug) { | while (should_debug) { | ||||
LLDB_LOGV(log, "Calling WaitForDebugEvent"); | LLDB_LOGV(log, "Calling WaitForDebugEvent"); | ||||
// TODO: GetProcAddress("WaitForDebugEventEx") and call it if available to | |||||
// opt in to receiving Unicode messages from OutputDebugString. | |||||
BOOL wait_result = WaitForDebugEvent(&dbe, INFINITE); | BOOL wait_result = WaitForDebugEvent(&dbe, INFINITE); | ||||
if (wait_result) { | if (wait_result) { | ||||
DWORD continue_status = DBG_CONTINUE; | DWORD continue_status = DBG_CONTINUE; | ||||
switch (dbe.dwDebugEventCode) { | switch (dbe.dwDebugEventCode) { | ||||
default: | default: | ||||
llvm_unreachable("Unhandle debug event code!"); | llvm_unreachable("Unhandle debug event code!"); | ||||
case EXCEPTION_DEBUG_EVENT: { | case EXCEPTION_DEBUG_EVENT: { | ||||
ExceptionResult status = | ExceptionResult status = | ||||
▲ Show 20 Lines • Show All 282 Lines • ▼ Show 20 Lines | DebuggerThread::HandleUnloadDllEvent(const UNLOAD_DLL_DEBUG_INFO &info, | ||||
m_debug_delegate->OnUnloadDll( | m_debug_delegate->OnUnloadDll( | ||||
reinterpret_cast<lldb::addr_t>(info.lpBaseOfDll)); | reinterpret_cast<lldb::addr_t>(info.lpBaseOfDll)); | ||||
return DBG_CONTINUE; | return DBG_CONTINUE; | ||||
} | } | ||||
DWORD | DWORD | ||||
DebuggerThread::HandleODSEvent(const OUTPUT_DEBUG_STRING_INFO &info, | DebuggerThread::HandleODSEvent(const OUTPUT_DEBUG_STRING_INFO &info, | ||||
DWORD thread_id) { | DWORD thread_id) { | ||||
Log *log = GetLog(WindowsLog::Event); | |||||
lldb::addr_t debug_string_addr = | |||||
reinterpret_cast<lldb::addr_t>(info.lpDebugStringData); | |||||
LLDB_LOG(log, | |||||
"process {0} thread {1} OutputDebugString (data={2:x}, unicode={3}, " | |||||
"len={4})", | |||||
m_process.GetProcessId(), thread_id, debug_string_addr, | |||||
info.fUnicode, info.nDebugStringLength); | |||||
m_debug_delegate->OnDebugString(debug_string_addr, info.fUnicode, | |||||
info.nDebugStringLength); | |||||
return DBG_CONTINUE; | return DBG_CONTINUE; | ||||
} | } | ||||
DWORD | DWORD | ||||
DebuggerThread::HandleRipEvent(const RIP_INFO &info, DWORD thread_id) { | DebuggerThread::HandleRipEvent(const RIP_INFO &info, DWORD thread_id) { | ||||
Log *log = GetLog(WindowsLog::Event); | Log *log = GetLog(WindowsLog::Event); | ||||
LLDB_LOG(log, "encountered error {0} (type={1}) in process {2} thread {3}", | LLDB_LOG(log, "encountered error {0} (type={1}) in process {2} thread {3}", | ||||
info.dwError, info.dwType, m_process.GetProcessId(), thread_id); | info.dwError, info.dwType, m_process.GetProcessId(), thread_id); | ||||
Status error(info.dwError, eErrorTypeWin32); | Status error(info.dwError, eErrorTypeWin32); | ||||
m_debug_delegate->OnDebuggerError(error, info.dwType); | m_debug_delegate->OnDebuggerError(error, info.dwType); | ||||
return DBG_CONTINUE; | return DBG_CONTINUE; | ||||
} | } |