diff options
| author | Zachary Turner <zturner@google.com> | 2016-10-05 17:07:34 +0000 |
|---|---|---|
| committer | Zachary Turner <zturner@google.com> | 2016-10-05 17:07:34 +0000 |
| commit | 5a8ad4591bb688760c018b4f2e3ec51b3bb3c783 (patch) | |
| tree | 31b2c619792632567e165cf0d45e710f350c9fce /lldb/source/Plugins/Process/Windows | |
| parent | d6ef28462bd17c39edef192a1298060910b0e15b (diff) | |
| download | bcm5719-llvm-5a8ad4591bb688760c018b4f2e3ec51b3bb3c783.tar.gz bcm5719-llvm-5a8ad4591bb688760c018b4f2e3ec51b3bb3c783.zip | |
Make lldb -Werror clean on Windows.
Differential Revision: https://reviews.llvm.org/D25247
llvm-svn: 283344
Diffstat (limited to 'lldb/source/Plugins/Process/Windows')
7 files changed, 128 insertions, 112 deletions
diff --git a/lldb/source/Plugins/Process/Windows/Common/RegisterContextWindows.cpp b/lldb/source/Plugins/Process/Windows/Common/RegisterContextWindows.cpp index 73bcd4ac38a..0ef3c77e47c 100644 --- a/lldb/source/Plugins/Process/Windows/Common/RegisterContextWindows.cpp +++ b/lldb/source/Plugins/Process/Windows/Common/RegisterContextWindows.cpp @@ -124,13 +124,12 @@ bool RegisterContextWindows::CacheAllRegisterValues() { &m_context)) { WINERR_IFALL( WINDOWS_LOG_REGISTERS, - "GetThreadContext failed with error %u while caching register values.", + "GetThreadContext failed with error %lu while caching register values.", ::GetLastError()); return false; } WINLOG_IFALL(WINDOWS_LOG_REGISTERS, - "GetThreadContext successfully updated the register values.", - ::GetLastError()); + "GetThreadContext successfully updated the register values."); m_context_stale = false; return true; } diff --git a/lldb/source/Plugins/Process/Windows/Common/x86/RegisterContextWindows_x86.cpp b/lldb/source/Plugins/Process/Windows/Common/x86/RegisterContextWindows_x86.cpp index 04b6ab317ca..b379322f3d9 100644 --- a/lldb/source/Plugins/Process/Windows/Common/x86/RegisterContextWindows_x86.cpp +++ b/lldb/source/Plugins/Process/Windows/Common/x86/RegisterContextWindows_x86.cpp @@ -62,52 +62,72 @@ RegisterInfo g_register_infos[] = { {ehframe_eax_i386, dwarf_eax_i386, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, lldb_eax_i386}, nullptr, - nullptr}, + nullptr, + nullptr, + 0u}, {DEFINE_GPR(ebx, nullptr), {ehframe_ebx_i386, dwarf_ebx_i386, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, lldb_ebx_i386}, nullptr, - nullptr}, + nullptr, + nullptr, + 0u}, {DEFINE_GPR(ecx, nullptr), {ehframe_ecx_i386, dwarf_ecx_i386, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, lldb_ecx_i386}, nullptr, - nullptr}, + nullptr, + nullptr, + 0u}, {DEFINE_GPR(edx, nullptr), {ehframe_edx_i386, dwarf_edx_i386, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, lldb_edx_i386}, nullptr, - nullptr}, + nullptr, + nullptr, + 0u}, {DEFINE_GPR(edi, nullptr), {ehframe_edi_i386, dwarf_edi_i386, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, lldb_edi_i386}, nullptr, - nullptr}, + nullptr, + nullptr, + 0u}, {DEFINE_GPR(esi, nullptr), {ehframe_esi_i386, dwarf_esi_i386, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, lldb_esi_i386}, nullptr, - nullptr}, + nullptr, + nullptr, + 0u}, {DEFINE_GPR(ebp, "fp"), {ehframe_ebp_i386, dwarf_ebp_i386, LLDB_REGNUM_GENERIC_FP, LLDB_INVALID_REGNUM, lldb_ebp_i386}, nullptr, - nullptr}, + nullptr, + nullptr, + 0u}, {DEFINE_GPR(esp, "sp"), {ehframe_esp_i386, dwarf_esp_i386, LLDB_REGNUM_GENERIC_SP, LLDB_INVALID_REGNUM, lldb_esp_i386}, nullptr, - nullptr}, + nullptr, + nullptr, + 0u}, {DEFINE_GPR(eip, "pc"), {ehframe_eip_i386, dwarf_eip_i386, LLDB_REGNUM_GENERIC_PC, LLDB_INVALID_REGNUM, lldb_eip_i386}, nullptr, - nullptr}, + nullptr, + nullptr, + 0u}, {DEFINE_GPR_BIN(eflags, "flags"), {ehframe_eflags_i386, dwarf_eflags_i386, LLDB_REGNUM_GENERIC_FLAGS, LLDB_INVALID_REGNUM, lldb_eflags_i386}, nullptr, - nullptr}, + nullptr, + nullptr, + 0u}, }; static size_t k_num_register_infos = llvm::array_lengthof(g_register_infos); @@ -196,7 +216,7 @@ bool RegisterContextWindows_x86::ReadRegisterHelper( reg_name); return false; } - WINLOG_IFALL(WINDOWS_LOG_REGISTERS, "Read value 0x%x from %s", value, + WINLOG_IFALL(WINDOWS_LOG_REGISTERS, "Read value 0x%lx from %s", value, reg_name); reg_value.SetUInt32(value); return true; diff --git a/lldb/source/Plugins/Process/Windows/Live/DebuggerThread.cpp b/lldb/source/Plugins/Process/Windows/Live/DebuggerThread.cpp index 4dcd7894e4d..5c985bf868d 100644 --- a/lldb/source/Plugins/Process/Windows/Live/DebuggerThread.cpp +++ b/lldb/source/Plugins/Process/Windows/Live/DebuggerThread.cpp @@ -54,9 +54,8 @@ struct DebugAttachContext { } DebuggerThread::DebuggerThread(DebugDelegateSP debug_delegate) - : m_debug_delegate(debug_delegate), m_image_file(nullptr), - m_debugging_ended_event(nullptr), m_is_shutting_down(false), - m_pid_to_detach(0), m_detached(false) { + : m_debug_delegate(debug_delegate), m_pid_to_detach(0), + m_is_shutting_down(false) { m_debugging_ended_event = ::CreateEvent(nullptr, TRUE, FALSE, nullptr); } @@ -85,7 +84,7 @@ Error DebuggerThread::DebugLaunch(const ProcessLaunchInfo &launch_info) { Error DebuggerThread::DebugAttach(lldb::pid_t pid, const ProcessAttachInfo &attach_info) { WINLOG_IFALL(WINDOWS_LOG_PROCESS, - "DebuggerThread::DebugAttach attaching to '%u'", (DWORD)pid); + "DebuggerThread::DebugAttach attaching to '%llu'", pid); Error error; DebugAttachContext *context = new DebugAttachContext(this, pid, attach_info); @@ -95,7 +94,7 @@ Error DebuggerThread::DebugAttach(lldb::pid_t pid, if (!error.Success()) { WINERR_IFALL(WINDOWS_LOG_PROCESS, - "DebugAttach couldn't attach to process '%u'. %s", (DWORD)pid, + "DebugAttach couldn't attach to process '%llu'. %s", pid, error.AsCString()); } @@ -157,8 +156,8 @@ lldb::thread_result_t DebuggerThread::DebuggerThreadAttachRoutine( std::shared_ptr<DebuggerThread> this_ref(shared_from_this()); WINLOG_IFALL(WINDOWS_LOG_PROCESS, "DebuggerThread preparing to attach to " - "process '%u' on background thread.", - (DWORD)pid); + "process '%llu' on background thread.", + pid); if (!DebugActiveProcess((DWORD)pid)) { Error error(::GetLastError(), eErrorTypeWin32); @@ -233,25 +232,25 @@ Error DebuggerThread::StopDebugging(bool terminate) { } } - WINLOG_IFALL(WINDOWS_LOG_PROCESS, - "StopDebugging waiting for detach from process %u to complete.", - pid); + WINLOG_IFALL( + WINDOWS_LOG_PROCESS, + "StopDebugging waiting for detach from process %llu to complete.", pid); DWORD wait_result = WaitForSingleObject(m_debugging_ended_event, 5000); if (wait_result != WAIT_OBJECT_0) { error.SetError(GetLastError(), eErrorTypeWin32); WINERR_IFALL(WINDOWS_LOG_PROCESS, - "StopDebugging WaitForSingleObject(0x%p, 5000) returned %u", + "StopDebugging WaitForSingleObject(0x%p, 5000) returned %lu", m_debugging_ended_event, wait_result); } else { - WINLOG_IFALL(WINDOWS_LOG_PROCESS, - "StopDebugging detach from process %u completed successfully.", - pid); + WINLOG_IFALL( + WINDOWS_LOG_PROCESS, + "StopDebugging detach from process %llu completed successfully.", pid); } if (!error.Success()) { WINERR_IFALL(WINDOWS_LOG_PROCESS, "StopDebugging encountered an error " - "while trying to stop process %u. %s", + "while trying to stop process %llu. %s", pid, error.AsCString()); } return error; @@ -280,7 +279,7 @@ void DebuggerThread::FreeProcessHandles() { } void DebuggerThread::DebugLoop() { - DEBUG_EVENT dbe = {0}; + DEBUG_EVENT dbe = {}; bool should_debug = true; WINLOG_IFALL(WINDOWS_LOG_EVENT, "Entering WaitForDebugEvent loop"); while (should_debug) { @@ -335,7 +334,7 @@ void DebuggerThread::DebugLoop() { WINLOGD_IFALL( WINDOWS_LOG_EVENT, - "DebugLoop calling ContinueDebugEvent(%u, %u, %u) on thread %u.", + "DebugLoop calling ContinueDebugEvent(%lu, %lu, %lu) on thread %lu.", dbe.dwProcessId, dbe.dwThreadId, continue_status, ::GetCurrentThreadId()); @@ -347,8 +346,8 @@ void DebuggerThread::DebugLoop() { } else { WINERR_IFALL( WINDOWS_LOG_EVENT, - "DebugLoop returned FALSE from WaitForDebugEvent. Error = %u", - ::GetCurrentThreadId(), ::GetLastError()); + "DebugLoop returned FALSE from WaitForDebugEvent. Error = %lu", + ::GetLastError()); should_debug = false; } @@ -371,7 +370,7 @@ DebuggerThread::HandleExceptionEvent(const EXCEPTION_DEBUG_INFO &info, info.ExceptionRecord.ExceptionCode == EXCEPTION_BREAKPOINT) { WINLOG_IFANY(WINDOWS_LOG_EVENT | WINDOWS_LOG_EXCEPTION | WINDOWS_LOG_PROCESS, - "Breakpoint exception is cue to detach from process 0x%x", + "Breakpoint exception is cue to detach from process 0x%lx", m_pid_to_detach.load()); ::DebugActiveProcessStop(m_pid_to_detach); m_detached = true; @@ -388,8 +387,8 @@ DebuggerThread::HandleExceptionEvent(const EXCEPTION_DEBUG_INFO &info, m_active_exception.reset( new ExceptionRecord(info.ExceptionRecord, thread_id)); WINLOG_IFANY(WINDOWS_LOG_EVENT | WINDOWS_LOG_EXCEPTION, - "HandleExceptionEvent encountered %s chance exception 0x%x on " - "thread 0x%x", + "HandleExceptionEvent encountered %s chance exception 0x%lx on " + "thread 0x%lx", first_chance ? "first" : "second", info.ExceptionRecord.ExceptionCode, thread_id); @@ -415,7 +414,7 @@ DWORD DebuggerThread::HandleCreateThreadEvent(const CREATE_THREAD_DEBUG_INFO &info, DWORD thread_id) { WINLOG_IFANY(WINDOWS_LOG_EVENT | WINDOWS_LOG_THREAD, - "HandleCreateThreadEvent Thread 0x%x spawned in process %I64u", + "HandleCreateThreadEvent Thread 0x%lx spawned in process %llu", thread_id, m_process.GetProcessId()); HostThread thread(info.hThread); thread.GetNativeThread().SetOwnsHandle(false); @@ -456,7 +455,7 @@ DebuggerThread::HandleExitThreadEvent(const EXIT_THREAD_DEBUG_INFO &info, DWORD thread_id) { WINLOG_IFANY( WINDOWS_LOG_EVENT | WINDOWS_LOG_THREAD, - "HandleExitThreadEvent Thread %u exited with code %u in process %I64u", + "HandleExitThreadEvent Thread %lu exited with code %lu in process %llu", thread_id, info.dwExitCode, m_process.GetProcessId()); m_debug_delegate->OnExitThread(thread_id, info.dwExitCode); return DBG_CONTINUE; @@ -466,7 +465,7 @@ DWORD DebuggerThread::HandleExitProcessEvent(const EXIT_PROCESS_DEBUG_INFO &info, DWORD thread_id) { WINLOG_IFANY(WINDOWS_LOG_EVENT | WINDOWS_LOG_THREAD, - "HandleExitProcessEvent process %I64u exited with code %u", + "HandleExitProcessEvent process %llu exited with code %lu", m_process.GetProcessId(), info.dwExitCode); m_debug_delegate->OnExitProcess(info.dwExitCode); @@ -480,7 +479,7 @@ DebuggerThread::HandleLoadDllEvent(const LOAD_DLL_DEBUG_INFO &info, DWORD thread_id) { if (info.hFile == nullptr) { // Not sure what this is, so just ignore it. - WINWARN_IFALL(WINDOWS_LOG_EVENT, "Inferior %I64u - HandleLoadDllEvent has " + WINWARN_IFALL(WINDOWS_LOG_EVENT, "Inferior %llu - HandleLoadDllEvent has " "a NULL file handle, returning...", m_process.GetProcessId()); return DBG_CONTINUE; @@ -510,8 +509,8 @@ DebuggerThread::HandleLoadDllEvent(const LOAD_DLL_DEBUG_INFO &info, m_debug_delegate->OnLoadDll(module_spec, load_addr); } else { - WINERR_IFALL(WINDOWS_LOG_EVENT, "Inferior %I64u - HandleLoadDllEvent Error " - "%u occurred calling " + WINERR_IFALL(WINDOWS_LOG_EVENT, "Inferior %llu - HandleLoadDllEvent Error " + "%lu occurred calling " "GetFinalPathNameByHandle", m_process.GetProcessId(), ::GetLastError()); } @@ -524,7 +523,7 @@ DWORD DebuggerThread::HandleUnloadDllEvent(const UNLOAD_DLL_DEBUG_INFO &info, DWORD thread_id) { WINLOG_IFALL(WINDOWS_LOG_EVENT, - "HandleUnloadDllEvent process %I64u unloading DLL at addr 0x%p.", + "HandleUnloadDllEvent process %llu unloading DLL at addr 0x%p.", m_process.GetProcessId(), info.lpBaseOfDll); m_debug_delegate->OnUnloadDll( @@ -540,8 +539,8 @@ DebuggerThread::HandleODSEvent(const OUTPUT_DEBUG_STRING_INFO &info, DWORD DebuggerThread::HandleRipEvent(const RIP_INFO &info, DWORD thread_id) { - WINERR_IFALL(WINDOWS_LOG_EVENT, "HandleRipEvent encountered error %u " - "(type=%u) in process %I64u thread %u", + WINERR_IFALL(WINDOWS_LOG_EVENT, "HandleRipEvent encountered error %lu " + "(type=%lu) in process %llu thread %lu", info.dwError, info.dwType, m_process.GetProcessId(), thread_id); Error error(info.dwError, eErrorTypeWin32); diff --git a/lldb/source/Plugins/Process/Windows/Live/DebuggerThread.h b/lldb/source/Plugins/Process/Windows/Live/DebuggerThread.h index fb536b4cc11..ef4b47bab8c 100644 --- a/lldb/source/Plugins/Process/Windows/Live/DebuggerThread.h +++ b/lldb/source/Plugins/Process/Windows/Live/DebuggerThread.h @@ -68,27 +68,31 @@ private: HostProcess m_process; // The process being debugged. HostThread m_main_thread; // The main thread of the inferior. - HANDLE m_image_file; // The image file of the process being debugged. - ExceptionRecordSP - m_active_exception; // The current exception waiting to be handled + // The image file of the process being debugged. + HANDLE m_image_file = nullptr; - Predicate<ExceptionResult> - m_exception_pred; // A predicate which gets signalled when an exception - // is finished processing and the debug loop can be - // continued. + // The current exception waiting to be handled + ExceptionRecordSP m_active_exception; - HANDLE m_debugging_ended_event; // An event which gets signalled by the - // debugger thread when it - // exits the debugger loop and is detached from the inferior. + // A predicate which gets signalled when an exception is finished processing + // and the debug loop can be continued. + Predicate<ExceptionResult> m_exception_pred; - std::atomic<DWORD> m_pid_to_detach; // Signals the loop to detach from the - // process (specified by pid). - std::atomic<bool> m_is_shutting_down; // Signals the debug loop to stop - // processing certain types of - // events that block shutdown. - bool m_detached; // Indicates we've detached from the inferior process and the - // debug loop can exit. + // An event which gets signalled by the debugger thread when it exits the + // debugger loop and is detached from the inferior. + HANDLE m_debugging_ended_event = nullptr; + + // Signals the loop to detach from the process (specified by pid). + std::atomic<DWORD> m_pid_to_detach; + + // Signals the debug loop to stop processing certain types of events that + // block shutdown. + std::atomic<bool> m_is_shutting_down; + + // Indicates we've detached from the inferior process and the debug loop can + // exit. + bool m_detached = false; static lldb::thread_result_t DebuggerThreadLaunchRoutine(void *data); lldb::thread_result_t @@ -99,5 +103,4 @@ private: const ProcessAttachInfo &launch_info); }; } - #endif diff --git a/lldb/source/Plugins/Process/Windows/Live/ProcessWindowsLive.cpp b/lldb/source/Plugins/Process/Windows/Live/ProcessWindowsLive.cpp index 9bfa247c2ed..7ddc5866a5f 100644 --- a/lldb/source/Plugins/Process/Windows/Live/ProcessWindowsLive.cpp +++ b/lldb/source/Plugins/Process/Windows/Live/ProcessWindowsLive.cpp @@ -94,9 +94,7 @@ namespace lldb_private { // OS specific types and implementation details from a public header file. class ProcessWindowsData { public: - ProcessWindowsData(bool stop_at_entry) - : m_stop_at_entry(stop_at_entry), m_initial_stop_event(nullptr), - m_initial_stop_received(false) { + ProcessWindowsData(bool stop_at_entry) : m_stop_at_entry(stop_at_entry) { m_initial_stop_event = ::CreateEvent(nullptr, TRUE, FALSE, nullptr); } @@ -105,9 +103,9 @@ public: lldb_private::Error m_launch_error; lldb_private::DebuggerThreadSP m_debugger; StopInfoSP m_pending_stop_info; - HANDLE m_initial_stop_event; + HANDLE m_initial_stop_event = nullptr; + bool m_initial_stop_received = false; bool m_stop_at_entry; - bool m_initial_stop_received; std::map<lldb::tid_t, HostThread> m_new_threads; std::set<lldb::tid_t> m_exited_threads; }; @@ -153,8 +151,8 @@ const char *ProcessWindowsLive::GetPluginDescriptionStatic() { Error ProcessWindowsLive::EnableBreakpointSite(BreakpointSite *bp_site) { WINLOG_IFALL(WINDOWS_LOG_BREAKPOINTS, "EnableBreakpointSite called with bp_site 0x%p " - "(id=%d, addr=0x%x)", - bp_site->GetID(), bp_site->GetLoadAddress()); + "(id=%d, addr=0x%llx)", + bp_site, bp_site->GetID(), bp_site->GetLoadAddress()); Error error = EnableSoftwareBreakpoint(bp_site); if (!error.Success()) { @@ -167,7 +165,7 @@ Error ProcessWindowsLive::EnableBreakpointSite(BreakpointSite *bp_site) { Error ProcessWindowsLive::DisableBreakpointSite(BreakpointSite *bp_site) { WINLOG_IFALL(WINDOWS_LOG_BREAKPOINTS, "DisableBreakpointSite called with bp_site 0x%p " - "(id=%d, addr=0x%x)", + "(id=%d, addr=0x%llx)", bp_site, bp_site->GetID(), bp_site->GetLoadAddress()); Error error = DisableSoftwareBreakpoint(bp_site); @@ -199,12 +197,13 @@ bool ProcessWindowsLive::UpdateThreadList(ThreadList &old_thread_list, ++continued_threads; WINLOGV_IFALL( WINDOWS_LOG_THREAD, - "UpdateThreadList - Thread %u was running and is still running.", + "UpdateThreadList - Thread %llu was running and is still running.", old_thread_id); } else { - WINLOGV_IFALL(WINDOWS_LOG_THREAD, - "UpdateThreadList - Thread %u was running and has exited.", - old_thread_id); + WINLOGV_IFALL( + WINDOWS_LOG_THREAD, + "UpdateThreadList - Thread %llu was running and has exited.", + old_thread_id); ++exited_threads; } } @@ -218,7 +217,7 @@ bool ProcessWindowsLive::UpdateThreadList(ThreadList &old_thread_list, ++new_size; ++new_threads; WINLOGV_IFALL(WINDOWS_LOG_THREAD, - "UpdateThreadList - Thread %u is new since last update.", + "UpdateThreadList - Thread %llu is new since last update.", thread_info.first); } @@ -250,7 +249,7 @@ Error ProcessWindowsLive::DoLaunch(Module *exe_module, std::string message = stream.GetString(); result.SetErrorString(message.c_str()); - WINERR_IFALL(WINDOWS_LOG_PROCESS, message.c_str()); + WINERR_IFALL(WINDOWS_LOG_PROCESS, "%s", message.c_str()); return result; } @@ -328,7 +327,7 @@ Error ProcessWindowsLive::DoAttachToProcessWithID( WINLOG_IFALL( WINDOWS_LOG_PROCESS, - "DoAttachToProcessWithID successfully attached to process with pid=%u", + "DoAttachToProcessWithID successfully attached to process with pid=%lu", process_id); // We've hit the initial stop. If eLaunchFlagsStopAtEntry was specified, the @@ -385,7 +384,7 @@ Error ProcessWindowsLive::DoResume() { WINLOG_IFANY(WINDOWS_LOG_PROCESS | WINDOWS_LOG_THREAD, "DoResume resuming %u threads.", m_thread_list.GetSize()); - for (int i = 0; i < m_thread_list.GetSize(); ++i) { + for (uint32_t i = 0; i < m_thread_list.GetSize(); ++i) { auto thread = std::static_pointer_cast<TargetThreadWindowsLive>( m_thread_list.GetThreadAtIndex(i)); thread->DoResume(); @@ -438,7 +437,7 @@ Error ProcessWindowsLive::DoDetach(bool keep_stopped) { if (private_state != eStateExited && private_state != eStateDetached) { WINLOG_IFALL( WINDOWS_LOG_PROCESS, - "DoDetach called for process %I64u while state = %u. Detaching...", + "DoDetach called for process %p while state = %d. Detaching...", debugger_thread->GetProcess().GetNativeProcess().GetSystemHandle(), private_state); error = debugger_thread->StopDebugging(false); @@ -451,8 +450,8 @@ Error ProcessWindowsLive::DoDetach(bool keep_stopped) { m_session_data.reset(); } else { WINERR_IFALL( - WINDOWS_LOG_PROCESS, "DoDetach called for process %I64u while state = " - "%u, but cannot destroy in this state.", + WINDOWS_LOG_PROCESS, "DoDetach called for process %p while state = " + "%d, but cannot destroy in this state.", debugger_thread->GetProcess().GetNativeProcess().GetSystemHandle(), private_state); } @@ -487,7 +486,7 @@ Error ProcessWindowsLive::DoDestroy() { Error error; if (private_state != eStateExited && private_state != eStateDetached) { WINLOG_IFALL( - WINDOWS_LOG_PROCESS, "DoDestroy called for process %I64u while state = " + WINDOWS_LOG_PROCESS, "DoDestroy called for process %p while state = " "%u. Shutting down...", debugger_thread->GetProcess().GetNativeProcess().GetSystemHandle(), private_state); @@ -498,8 +497,8 @@ Error ProcessWindowsLive::DoDestroy() { m_session_data.reset(); } else { WINERR_IFALL( - WINDOWS_LOG_PROCESS, "DoDestroy called for process %I64u while state = " - "%u, but cannot destroy in this state.", + WINDOWS_LOG_PROCESS, "DoDestroy called for process %p while state = " + "%d, but cannot destroy in this state.", debugger_thread->GetProcess().GetNativeProcess().GetSystemHandle(), private_state); } @@ -554,7 +553,7 @@ void ProcessWindowsLive::RefreshStateAfterStop() { stop_thread->SetStopInfo(stop_info); } else { WINLOG_IFANY(WINDOWS_LOG_EXCEPTION | WINDOWS_LOG_STEP, - "RefreshStateAfterStop single stepping thread %u", + "RefreshStateAfterStop single stepping thread %llu", stop_thread->GetID()); stop_info = StopInfo::CreateStopReasonToTrace(*stop_thread); stop_thread->SetStopInfo(stop_info); @@ -616,7 +615,7 @@ void ProcessWindowsLive::RefreshStateAfterStop() { stop_info = StopInfo::CreateStopReasonWithException( *stop_thread, desc_stream.str().c_str()); stop_thread->SetStopInfo(stop_info); - WINLOG_IFALL(WINDOWS_LOG_EXCEPTION, desc_stream.str().c_str()); + WINLOG_IFALL(WINDOWS_LOG_EXCEPTION, "%s", desc_stream.str().c_str()); return; } } @@ -733,7 +732,7 @@ Error ProcessWindowsLive::GetMemoryRegionInfo(lldb::addr_t vm_addr, if (!m_session_data) { error.SetErrorString( "GetMemoryRegionInfo called with no debugging session."); - WINERR_IFALL(WINDOWS_LOG_MEMORY, error.AsCString()); + WINERR_IFALL(WINDOWS_LOG_MEMORY, "%s", error.AsCString()); return error; } HostProcess process = m_session_data->m_debugger->GetProcess(); @@ -741,7 +740,7 @@ Error ProcessWindowsLive::GetMemoryRegionInfo(lldb::addr_t vm_addr, if (handle == nullptr || handle == LLDB_INVALID_PROCESS) { error.SetErrorString( "GetMemoryRegionInfo called with an invalid target process."); - WINERR_IFALL(WINDOWS_LOG_MEMORY, error.AsCString()); + WINERR_IFALL(WINDOWS_LOG_MEMORY, "%s", error.AsCString()); return error; } @@ -749,7 +748,7 @@ Error ProcessWindowsLive::GetMemoryRegionInfo(lldb::addr_t vm_addr, "GetMemoryRegionInfo getting info for address 0x%I64x", vm_addr); void *addr = reinterpret_cast<void *>(vm_addr); - MEMORY_BASIC_INFORMATION mem_info = {0}; + MEMORY_BASIC_INFORMATION mem_info = {}; SIZE_T result = ::VirtualQueryEx(handle, addr, &mem_info, sizeof(mem_info)); if (result == 0) { if (::GetLastError() == ERROR_INVALID_PARAMETER) { @@ -812,10 +811,10 @@ Error ProcessWindowsLive::GetMemoryRegionInfo(lldb::addr_t vm_addr, } error.SetError(::GetLastError(), eErrorTypeWin32); - WINLOGV_IFALL(WINDOWS_LOG_MEMORY, "Memory region info for address 0x%I64u: " + WINLOGV_IFALL(WINDOWS_LOG_MEMORY, "Memory region info for address %llu: " "readable=%s, executable=%s, writable=%s", - BOOL_STR(info.GetReadable()), BOOL_STR(info.GetExecutable()), - BOOL_STR(info.GetWritable())); + vm_addr, BOOL_STR(info.GetReadable()), + BOOL_STR(info.GetExecutable()), BOOL_STR(info.GetWritable())); return error; } @@ -835,7 +834,7 @@ bool ProcessWindowsLive::CanDebug(lldb::TargetSP target_sp, void ProcessWindowsLive::OnExitProcess(uint32_t exit_code) { // No need to acquire the lock since m_session_data isn't accessed. - WINLOG_IFALL(WINDOWS_LOG_PROCESS, "Process %u exited with code %u", GetID(), + WINLOG_IFALL(WINDOWS_LOG_PROCESS, "Process %llu exited with code %u", GetID(), exit_code); TargetSP target = m_target_sp.lock(); @@ -912,7 +911,7 @@ ProcessWindowsLive::OnDebugException(bool first_chance, // lldb logs, and then add logging to the process plugin. if (!m_session_data) { WINERR_IFANY(WINDOWS_LOG_EXCEPTION, "Debugger thread reported exception " - "0x%x at address 0x%I64x, but there is " + "0x%lx at address 0x%llu, but there is " "no session.", record.GetExceptionCode(), record.GetExceptionAddress()); return ExceptionResult::SendToApplication; @@ -949,7 +948,7 @@ ProcessWindowsLive::OnDebugException(bool first_chance, break; default: WINLOG_IFANY(WINDOWS_LOG_EXCEPTION, "Debugger thread reported exception " - "0x%x at address 0x%I64x " + "0x%lx at address 0x%llx " "(first_chance=%s)", record.GetExceptionCode(), record.GetExceptionAddress(), BOOL_STR(first_chance)); diff --git a/lldb/source/Plugins/Process/Windows/Live/ProcessWindowsLive.h b/lldb/source/Plugins/Process/Windows/Live/ProcessWindowsLive.h index 89d69f6f043..0b6f4074d29 100644 --- a/lldb/source/Plugins/Process/Windows/Live/ProcessWindowsLive.h +++ b/lldb/source/Plugins/Process/Windows/Live/ProcessWindowsLive.h @@ -26,7 +26,7 @@ #include "llvm/Support/Mutex.h" -#include "plugins/Process/Windows/Common/ProcessWindows.h" +#include "Plugins/Process/Windows/Common/ProcessWindows.h" class ProcessMonitor; diff --git a/lldb/source/Plugins/Process/Windows/MiniDump/ProcessWinMiniDump.cpp b/lldb/source/Plugins/Process/Windows/MiniDump/ProcessWinMiniDump.cpp index 14ef9f02f2a..128c4c16c36 100644 --- a/lldb/source/Plugins/Process/Windows/MiniDump/ProcessWinMiniDump.cpp +++ b/lldb/source/Plugins/Process/Windows/MiniDump/ProcessWinMiniDump.cpp @@ -162,25 +162,21 @@ bool ProcessWinMiniDump::Impl::UpdateThreadList(ThreadList &old_thread_list, if (m_is_wow64) { // On Windows, a 32-bit process can run on a 64-bit machine under - // WOW64. - // If the minidump was captured with a 64-bit debugger, then the - // CONTEXT - // we just grabbed from the mini_dump_thread is the one for the 64-bit - // "native" process rather than the 32-bit "guest" process we care - // about. - // In this case, we can get the 32-bit CONTEXT from the TEB (Thread - // Environment Block) of the 64-bit process. + // WOW64. If the minidump was captured with a 64-bit debugger, then + // the CONTEXT we just grabbed from the mini_dump_thread is the one + // for the 64-bit "native" process rather than the 32-bit "guest" + // process we care about. In this case, we can get the 32-bit CONTEXT + // from the TEB (Thread Environment Block) of the 64-bit process. Error error; - TEB64 wow64teb = {0}; + TEB64 wow64teb = {}; m_self->ReadMemory(mini_dump_thread.Teb, &wow64teb, sizeof(wow64teb), error); if (error.Success()) { // Slot 1 of the thread-local storage in the 64-bit TEB points to a - // structure - // that includes the 32-bit CONTEXT (after a ULONG). + // structure that includes the 32-bit CONTEXT (after a ULONG). // See: https://msdn.microsoft.com/en-us/library/ms681670.aspx - const size_t addr = wow64teb.TlsSlots[1]; - Range range = {0}; + const lldb::addr_t addr = wow64teb.TlsSlots[1]; + Range range = {}; if (FindMemoryRange(addr, &range)) { lldbassert(range.start <= addr); const size_t offset = addr - range.start + sizeof(ULONG); @@ -234,7 +230,7 @@ size_t ProcessWinMiniDump::Impl::DoReadMemory(lldb::addr_t addr, void *buf, // ranges a mini dump typically has, so I'm not sure if searching for the // appropriate range linearly each time is stupid. Perhaps we should build // an index for faster lookups. - Range range = {0}; + Range range = {}; if (!FindMemoryRange(addr, &range)) { return 0; } @@ -275,7 +271,7 @@ Error ProcessWinMiniDump::Impl::GetMemoryRegionInfo( const MINIDUMP_MEMORY_INFO *next_entry = nullptr; - for (int i = 0; i < list->NumberOfEntries; ++i) { + for (uint64_t i = 0; i < list->NumberOfEntries; ++i) { const auto entry = reinterpret_cast<const MINIDUMP_MEMORY_INFO *>( reinterpret_cast<const char *>(list) + list->SizeOfHeader + i * list->SizeOfEntry); |

