Index: lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump/TestMiniDump.py =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump/TestMiniDump.py +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump/TestMiniDump.py @@ -32,6 +32,20 @@ stop_description = thread.GetStopDescription(256); self.assertTrue("0xc0000005" in stop_description); + @no_debug_info_test + def test_stack_info_in_mini_dump(self): + """Test that we can see the stack.""" + self.assertEqual(self.process.GetNumThreads(), 1) + thread = self.process.GetThreadAtIndex(0) + # The crash is in main, so there should be one frame on the stack. + self.assertEqual(thread.GetNumFrames(), 1) + frame = thread.GetFrameAtIndex(0) + self.assertTrue(frame.IsValid()) + pc = frame.GetPC() + eip = frame.FindRegister("pc") + self.assertTrue(eip.IsValid()) + self.assertEqual(pc, eip.GetValueAsUnsigned()) + def setUp(self): # Call super's setUp(). TestBase.setUp(self) Index: lldb/trunk/source/Plugins/Process/Windows/Common/RegisterContextWindows.h =================================================================== --- lldb/trunk/source/Plugins/Process/Windows/Common/RegisterContextWindows.h +++ lldb/trunk/source/Plugins/Process/Windows/Common/RegisterContextWindows.h @@ -60,8 +60,6 @@ virtual bool CacheAllRegisterValues(); CONTEXT m_context; - - private: bool m_context_stale; }; } Index: lldb/trunk/source/Plugins/Process/Windows/Common/x86/RegisterContextWindows_x86.h =================================================================== --- lldb/trunk/source/Plugins/Process/Windows/Common/x86/RegisterContextWindows_x86.h +++ lldb/trunk/source/Plugins/Process/Windows/Common/x86/RegisterContextWindows_x86.h @@ -38,6 +38,9 @@ size_t GetRegisterSetCount() override; const RegisterSet *GetRegisterSet(size_t reg_set) override; + + bool ReadRegister(const RegisterInfo *reg_info, RegisterValue ®_value) override; + }; } Index: lldb/trunk/source/Plugins/Process/Windows/Common/x86/RegisterContextWindows_x86.cpp =================================================================== --- lldb/trunk/source/Plugins/Process/Windows/Common/x86/RegisterContextWindows_x86.cpp +++ lldb/trunk/source/Plugins/Process/Windows/Common/x86/RegisterContextWindows_x86.cpp @@ -121,3 +121,58 @@ return &g_register_sets[reg_set]; } +bool +RegisterContextWindows_x86::ReadRegister(const RegisterInfo *reg_info, RegisterValue ®_value) +{ + if (!CacheAllRegisterValues()) + return false; + + uint32_t reg = reg_info->kinds[eRegisterKindLLDB]; + switch (reg) + { + case lldb_eax_i386: + WINLOG_IFALL(WINDOWS_LOG_REGISTERS, "Read value 0x%x from EAX", m_context.Eax); + reg_value.SetUInt32(m_context.Eax); + break; + case lldb_ebx_i386: + WINLOG_IFALL(WINDOWS_LOG_REGISTERS, "Read value 0x%x from EBX", m_context.Ebx); + reg_value.SetUInt32(m_context.Ebx); + break; + case lldb_ecx_i386: + WINLOG_IFALL(WINDOWS_LOG_REGISTERS, "Read value 0x%x from ECX", m_context.Ecx); + reg_value.SetUInt32(m_context.Ecx); + break; + case lldb_edx_i386: + WINLOG_IFALL(WINDOWS_LOG_REGISTERS, "Read value 0x%x from EDX", m_context.Edx); + reg_value.SetUInt32(m_context.Edx); + break; + case lldb_edi_i386: + WINLOG_IFALL(WINDOWS_LOG_REGISTERS, "Read value 0x%x from EDI", m_context.Edi); + reg_value.SetUInt32(m_context.Edi); + break; + case lldb_esi_i386: + WINLOG_IFALL(WINDOWS_LOG_REGISTERS, "Read value 0x%x from ESI", m_context.Esi); + reg_value.SetUInt32(m_context.Esi); + break; + case lldb_ebp_i386: + WINLOG_IFALL(WINDOWS_LOG_REGISTERS, "Read value 0x%x from EBP", m_context.Ebp); + reg_value.SetUInt32(m_context.Ebp); + break; + case lldb_esp_i386: + WINLOG_IFALL(WINDOWS_LOG_REGISTERS, "Read value 0x%x from ESP", m_context.Esp); + reg_value.SetUInt32(m_context.Esp); + break; + case lldb_eip_i386: + WINLOG_IFALL(WINDOWS_LOG_REGISTERS, "Read value 0x%x from EIP", m_context.Eip); + reg_value.SetUInt32(m_context.Eip); + break; + case lldb_eflags_i386: + WINLOG_IFALL(WINDOWS_LOG_REGISTERS, "Read value 0x%x from EFLAGS", m_context.EFlags); + reg_value.SetUInt32(m_context.EFlags); + break; + default: + WINWARN_IFALL(WINDOWS_LOG_REGISTERS, "Requested unknown register %u", reg); + break; + } + return true; +} Index: lldb/trunk/source/Plugins/Process/Windows/Live/x86/RegisterContextWindowsLive_x86.h =================================================================== --- lldb/trunk/source/Plugins/Process/Windows/Live/x86/RegisterContextWindowsLive_x86.h +++ lldb/trunk/source/Plugins/Process/Windows/Live/x86/RegisterContextWindowsLive_x86.h @@ -28,8 +28,6 @@ virtual ~RegisterContextWindowsLive_x86(); - bool ReadRegister(const RegisterInfo *reg_info, RegisterValue ®_value) override; - bool WriteRegister(const RegisterInfo *reg_info, const RegisterValue ®_value) override; }; Index: lldb/trunk/source/Plugins/Process/Windows/Live/x86/RegisterContextWindowsLive_x86.cpp =================================================================== --- lldb/trunk/source/Plugins/Process/Windows/Live/x86/RegisterContextWindowsLive_x86.cpp +++ lldb/trunk/source/Plugins/Process/Windows/Live/x86/RegisterContextWindowsLive_x86.cpp @@ -36,63 +36,6 @@ bool -RegisterContextWindowsLive_x86::ReadRegister(const RegisterInfo *reg_info, RegisterValue ®_value) -{ - if (!CacheAllRegisterValues()) - return false; - - uint32_t reg = reg_info->kinds[eRegisterKindLLDB]; - switch (reg) - { - case lldb_eax_i386: - WINLOG_IFALL(WINDOWS_LOG_REGISTERS, "Read value 0x%x from EAX", m_context.Eax); - reg_value.SetUInt32(m_context.Eax); - break; - case lldb_ebx_i386: - WINLOG_IFALL(WINDOWS_LOG_REGISTERS, "Read value 0x%x from EBX", m_context.Ebx); - reg_value.SetUInt32(m_context.Ebx); - break; - case lldb_ecx_i386: - WINLOG_IFALL(WINDOWS_LOG_REGISTERS, "Read value 0x%x from ECX", m_context.Ecx); - reg_value.SetUInt32(m_context.Ecx); - break; - case lldb_edx_i386: - WINLOG_IFALL(WINDOWS_LOG_REGISTERS, "Read value 0x%x from EDX", m_context.Edx); - reg_value.SetUInt32(m_context.Edx); - break; - case lldb_edi_i386: - WINLOG_IFALL(WINDOWS_LOG_REGISTERS, "Read value 0x%x from EDI", m_context.Edi); - reg_value.SetUInt32(m_context.Edi); - break; - case lldb_esi_i386: - WINLOG_IFALL(WINDOWS_LOG_REGISTERS, "Read value 0x%x from ESI", m_context.Esi); - reg_value.SetUInt32(m_context.Esi); - break; - case lldb_ebp_i386: - WINLOG_IFALL(WINDOWS_LOG_REGISTERS, "Read value 0x%x from EBP", m_context.Ebp); - reg_value.SetUInt32(m_context.Ebp); - break; - case lldb_esp_i386: - WINLOG_IFALL(WINDOWS_LOG_REGISTERS, "Read value 0x%x from ESP", m_context.Esp); - reg_value.SetUInt32(m_context.Esp); - break; - case lldb_eip_i386: - WINLOG_IFALL(WINDOWS_LOG_REGISTERS, "Read value 0x%x from EIP", m_context.Eip); - reg_value.SetUInt32(m_context.Eip); - break; - case lldb_eflags_i386: - WINLOG_IFALL(WINDOWS_LOG_REGISTERS, "Read value 0x%x from EFLAGS", m_context.EFlags); - reg_value.SetUInt32(m_context.EFlags); - break; - default: - WINWARN_IFALL(WINDOWS_LOG_REGISTERS, "Requested unknown register %u", reg); - break; - } - return true; -} - - -bool RegisterContextWindowsLive_x86::WriteRegister(const RegisterInfo *reg_info, const RegisterValue ®_value) { // Since we cannot only write a single register value to the inferior, we need to make sure Index: lldb/trunk/source/Plugins/Process/Windows/MiniDump/CMakeLists.txt =================================================================== --- lldb/trunk/source/Plugins/Process/Windows/MiniDump/CMakeLists.txt +++ lldb/trunk/source/Plugins/Process/Windows/MiniDump/CMakeLists.txt @@ -1,8 +1,21 @@ include_directories(../../Utility) include_directories(../Common) -add_lldb_library(lldbPluginProcessWinMiniDump +set(PROC_WINDOWS_MINIDUMP_SOURCES ProcessWinMiniDump.cpp - RegisterContextWindowsMiniDump.cpp ThreadWinMiniDump.cpp ) + +if (CMAKE_SIZEOF_VOID_P EQUAL 4) + set(PROC_WINDOWS_MINIDUMP_SOURCES ${PROC_WINDOWS_MINIDUMP_SOURCES} + x86/RegisterContextWindowsMiniDump_x86.cpp + ) +elseif (CMAKE_SIZEOF_VOID_P EQUAL 8) + set(PROC_WINDOWS_MINIDUMP_SOURCES ${PROC_WINDOWS_MINIDUMP_SOURCES} + x64/RegisterContextWindowsMiniDump_x64.cpp + ) +endif() + +add_lldb_library(lldbPluginProcessWinMiniDump + ${PROC_WINDOWS_MINIDUMP_SOURCES} + ) Index: lldb/trunk/source/Plugins/Process/Windows/MiniDump/ProcessWinMiniDump.cpp =================================================================== --- lldb/trunk/source/Plugins/Process/Windows/MiniDump/ProcessWinMiniDump.cpp +++ lldb/trunk/source/Plugins/Process/Windows/MiniDump/ProcessWinMiniDump.cpp @@ -14,7 +14,7 @@ #include #include - +#include #include #include "lldb/Core/PluginManager.h" @@ -189,7 +189,13 @@ { const ULONG32 thread_count = thread_list_ptr->NumberOfThreads; for (ULONG32 i = 0; i < thread_count; ++i) { - std::shared_ptr thread_sp(new ThreadWinMiniDump(*this, thread_list_ptr->Threads[i].ThreadId)); + const auto &mini_dump_thread = thread_list_ptr->Threads[i]; + auto thread_sp = std::make_shared(*this, mini_dump_thread.ThreadId); + if (mini_dump_thread.ThreadContext.DataSize >= sizeof(CONTEXT)) + { + const CONTEXT *context = reinterpret_cast(static_cast(m_data_up->m_base_addr) + mini_dump_thread.ThreadContext.Rva); + thread_sp->SetContext(context); + } new_thread_list.AddThread(thread_sp); } } Index: lldb/trunk/source/Plugins/Process/Windows/MiniDump/RegisterContextWindowsMiniDump.h =================================================================== --- lldb/trunk/source/Plugins/Process/Windows/MiniDump/RegisterContextWindowsMiniDump.h +++ lldb/trunk/source/Plugins/Process/Windows/MiniDump/RegisterContextWindowsMiniDump.h @@ -1,75 +0,0 @@ -//===-- RegisterContextWindowsMiniDump.h --------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#ifndef liblldb_RegisterContextWindowsMiniDump_H_ -#define liblldb_RegisterContextWindowsMiniDump_H_ - -#include "lldb/lldb-forward.h" -#include "lldb/Target/RegisterContext.h" - -#include "Plugins/Process/Windows/Common/RegisterContextWindows.h" - - -namespace lldb_private -{ - -class Thread; - -class RegisterContextWindowsMiniDump : public lldb_private::RegisterContextWindows -{ - public: - RegisterContextWindowsMiniDump(Thread &thread, uint32_t concrete_frame_idx); - - virtual ~RegisterContextWindowsMiniDump(); - - void - InvalidateAllRegisters() override; - - size_t - GetRegisterCount() override; - - const RegisterInfo * - GetRegisterInfoAtIndex(size_t reg) override; - - size_t - GetRegisterSetCount() override; - - const RegisterSet * - GetRegisterSet(size_t reg_set) override; - - bool - ReadRegister(const RegisterInfo *reg_info, RegisterValue ®_value) override; - - bool - WriteRegister(const RegisterInfo *reg_info, const RegisterValue ®_value) override; - - bool ReadAllRegisterValues(lldb::DataBufferSP &data_sp) override; - - bool WriteAllRegisterValues(const lldb::DataBufferSP &data_sp) override; - - uint32_t ConvertRegisterKindToRegisterNumber(lldb::RegisterKind kind, uint32_t num) override; - - uint32_t NumSupportedHardwareBreakpoints() override; - - uint32_t SetHardwareBreakpoint(lldb::addr_t addr, size_t size) override; - - bool ClearHardwareBreakpoint(uint32_t hw_idx) override; - - uint32_t NumSupportedHardwareWatchpoints() override; - - uint32_t SetHardwareWatchpoint(lldb::addr_t addr, size_t size, bool read, bool write) override; - - bool ClearHardwareWatchpoint(uint32_t hw_index) override; - - bool HardwareSingleStep(bool enable) override; -}; - -} - -#endif // #ifndef liblldb_RegisterContextWindowsMiniDump_H_ Index: lldb/trunk/source/Plugins/Process/Windows/MiniDump/RegisterContextWindowsMiniDump.cpp =================================================================== --- lldb/trunk/source/Plugins/Process/Windows/MiniDump/RegisterContextWindowsMiniDump.cpp +++ lldb/trunk/source/Plugins/Process/Windows/MiniDump/RegisterContextWindowsMiniDump.cpp @@ -1,146 +0,0 @@ -//===-- RegisterContextWindowsMiniDump.cpp ------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#include "lldb/lldb-private-types.h" -#include "lldb/Core/DataBufferHeap.h" -#include "lldb/Core/Error.h" -#include "lldb/Host/windows/HostThreadWindows.h" -#include "lldb/Host/windows/windows.h" - -#include "RegisterContextWindowsMiniDump.h" - -#include "llvm/ADT/STLExtras.h" - -using namespace lldb; -using namespace lldb_private; - -// This is a do-nothing stub implementation for now. - -RegisterContextWindowsMiniDump::RegisterContextWindowsMiniDump(Thread &thread, uint32_t concrete_frame_idx) - : RegisterContextWindows(thread, concrete_frame_idx) -{ -} - -RegisterContextWindowsMiniDump::~RegisterContextWindowsMiniDump() -{ -} - -void -RegisterContextWindowsMiniDump::InvalidateAllRegisters() -{ -} - -size_t -RegisterContextWindowsMiniDump::GetRegisterCount() -{ - return 0; -} - -const RegisterInfo * -RegisterContextWindowsMiniDump::GetRegisterInfoAtIndex(size_t reg) -{ - return nullptr; -} - -size_t -RegisterContextWindowsMiniDump::GetRegisterSetCount() -{ - return 0; -} - -const RegisterSet * -RegisterContextWindowsMiniDump::GetRegisterSet(size_t reg_set) -{ - return nullptr; -} - -bool -RegisterContextWindowsMiniDump::ReadRegister(const RegisterInfo *reg_info, RegisterValue ®_value) -{ - return false; -} - -bool -RegisterContextWindowsMiniDump::WriteRegister (const RegisterInfo *reg_info, const RegisterValue ®_value) -{ - return false; -} - -bool -RegisterContextWindowsMiniDump::ReadAllRegisterValues(lldb::DataBufferSP &data_sp) -{ - return false; -} - -bool -RegisterContextWindowsMiniDump::WriteAllRegisterValues(const lldb::DataBufferSP &data_sp) -{ - return false; -} - -uint32_t -RegisterContextWindowsMiniDump::ConvertRegisterKindToRegisterNumber(lldb::RegisterKind kind, uint32_t num) -{ - const uint32_t num_regs = GetRegisterCount(); - - assert(kind < kNumRegisterKinds); - for (uint32_t reg_idx = 0; reg_idx < num_regs; ++reg_idx) - { - const RegisterInfo *reg_info = GetRegisterInfoAtIndex(reg_idx); - - if (reg_info->kinds[kind] == num) - return reg_idx; - } - - return LLDB_INVALID_REGNUM; -} - -uint32_t -RegisterContextWindowsMiniDump::NumSupportedHardwareBreakpoints() -{ - // Support for hardware breakpoints not yet implemented. - return 0; -} - -uint32_t -RegisterContextWindowsMiniDump::SetHardwareBreakpoint(lldb::addr_t addr, size_t size) -{ - return 0; -} - -bool -RegisterContextWindowsMiniDump::ClearHardwareBreakpoint(uint32_t hw_idx) -{ - return false; -} - -uint32_t -RegisterContextWindowsMiniDump::NumSupportedHardwareWatchpoints() -{ - // Support for hardware watchpoints not yet implemented. - return 0; -} - -uint32_t -RegisterContextWindowsMiniDump::SetHardwareWatchpoint(lldb::addr_t addr, size_t size, bool read, bool write) -{ - return 0; -} - -bool -RegisterContextWindowsMiniDump::ClearHardwareWatchpoint(uint32_t hw_index) -{ - return false; -} - -bool -RegisterContextWindowsMiniDump::HardwareSingleStep(bool enable) -{ - return false; -} Index: lldb/trunk/source/Plugins/Process/Windows/MiniDump/ThreadWinMiniDump.h =================================================================== --- lldb/trunk/source/Plugins/Process/Windows/MiniDump/ThreadWinMiniDump.h +++ lldb/trunk/source/Plugins/Process/Windows/MiniDump/ThreadWinMiniDump.h @@ -35,15 +35,13 @@ void ClearStackFrames() override; - const char * - GetName() override; - void - SetName(const char *name); + SetContext(const void *context); protected: - std::string m_thread_name; lldb::RegisterContextSP m_reg_context_sp; + class Data; + std::unique_ptr m_data; // for WinAPI-specific data bool CalculateStopInfo() override; }; Index: lldb/trunk/source/Plugins/Process/Windows/MiniDump/ThreadWinMiniDump.cpp =================================================================== --- lldb/trunk/source/Plugins/Process/Windows/MiniDump/ThreadWinMiniDump.cpp +++ lldb/trunk/source/Plugins/Process/Windows/MiniDump/ThreadWinMiniDump.cpp @@ -9,12 +9,16 @@ #include "ThreadWinMiniDump.h" -// Windows includes +#include "lldb/Host/HostInfo.h" #include "lldb/Host/windows/windows.h" #include #include "ProcessWinMiniDump.h" -#include "RegisterContextWindowsMiniDump.h" +#if defined(_WIN64) +#include "x64/RegisterContextWindowsMiniDump_x64.h" +#else +#include "x86/RegisterContextWindowsMiniDump_x86.h" +#endif using namespace lldb; using namespace lldb_private; @@ -22,9 +26,15 @@ // This is a minimal implementation in order to get something running. It will // be fleshed out as more mini-dump functionality is added. +class ThreadWinMiniDump::Data { + public: + Data() : m_context(nullptr) {} + const CONTEXT *m_context; +}; + ThreadWinMiniDump::ThreadWinMiniDump(lldb_private::Process &process, lldb::tid_t tid) : Thread(process, tid), - m_thread_name() + m_data(new Data) { } @@ -50,7 +60,26 @@ ThreadWinMiniDump::CreateRegisterContextForFrame(lldb_private::StackFrame *frame) { const uint32_t concrete_frame_idx = (frame) ? frame->GetConcreteFrameIndex() : 0; - RegisterContextSP reg_ctx_sp(new RegisterContextWindowsMiniDump(*this, concrete_frame_idx)); + RegisterContextSP reg_ctx_sp; + ArchSpec arch = HostInfo::GetArchitecture(); + switch (arch.GetMachine()) + { + case llvm::Triple::x86: +#if defined(_WIN64) + // FIXME: This is a Wow64 process, create a RegisterContextWindows_Wow64 +#else + reg_ctx_sp.reset(new RegisterContextWindowsMiniDump_x86(*this, concrete_frame_idx, m_data->m_context)); +#endif + break; + case llvm::Triple::x86_64: +#if defined(_WIN64) + reg_ctx_sp.reset(new RegisterContextWindowsMiniDump_x64(*this, concrete_frame_idx, m_data->m_context)); +#else + // LLDB is 32-bit, but the target process is 64-bit. We probably can't debug this. +#endif + default: + break; + } return reg_ctx_sp; } @@ -59,22 +88,17 @@ { } -const char * -ThreadWinMiniDump::GetName() -{ - return m_thread_name.empty() ? nullptr : m_thread_name.c_str(); -} - void -ThreadWinMiniDump::SetName(const char *name) +ThreadWinMiniDump::SetContext(const void *context) { - if (name && name[0]) - m_thread_name.assign(name); - else - m_thread_name.clear(); + if (m_data) + { + m_data->m_context = static_cast(context); + } } -bool ThreadWinMiniDump::CalculateStopInfo() +bool +ThreadWinMiniDump::CalculateStopInfo() { return false; } Index: lldb/trunk/source/Plugins/Process/Windows/MiniDump/x64/RegisterContextWindowsMiniDump_x64.h =================================================================== --- lldb/trunk/source/Plugins/Process/Windows/MiniDump/x64/RegisterContextWindowsMiniDump_x64.h +++ lldb/trunk/source/Plugins/Process/Windows/MiniDump/x64/RegisterContextWindowsMiniDump_x64.h @@ -0,0 +1,36 @@ +//===-- RegisterContextWindowsMiniDump_x64.h --------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#ifndef liblldb_RegisterContextWindowsMiniDump_x64_H_ +#define liblldb_RegisterContextWindowsMiniDump_x64_H_ + +#include "lldb/lldb-forward.h" +#include "Plugins/Process/Windows/Common/x64/RegisterContextWindows_x64.h" + +namespace lldb_private +{ + +class Thread; + +class RegisterContextWindowsMiniDump_x64 : public RegisterContextWindows_x64 +{ + public: + RegisterContextWindowsMiniDump_x64(Thread &thread, uint32_t concrete_frame_idx, const CONTEXT *context); + + virtual ~RegisterContextWindowsMiniDump_x64(); + + bool WriteRegister(const RegisterInfo *reg_info, const RegisterValue ®_value) override; + + protected: + bool CacheAllRegisterValues() override; +}; + +} + +#endif // #ifndef liblldb_RegisterContextWindowsMiniDump_x64_H_ Index: lldb/trunk/source/Plugins/Process/Windows/MiniDump/x64/RegisterContextWindowsMiniDump_x64.cpp =================================================================== --- lldb/trunk/source/Plugins/Process/Windows/MiniDump/x64/RegisterContextWindowsMiniDump_x64.cpp +++ lldb/trunk/source/Plugins/Process/Windows/MiniDump/x64/RegisterContextWindowsMiniDump_x64.cpp @@ -0,0 +1,47 @@ +//===-- RegisterContextWindowsMiniDump_x64.cpp ------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#include "lldb/lldb-private-types.h" +#include "lldb/Host/windows/windows.h" + +#include "RegisterContextWindowsMiniDump_x64.h" + +using namespace lldb; + +namespace lldb_private +{ + +RegisterContextWindowsMiniDump_x64::RegisterContextWindowsMiniDump_x64(Thread &thread, uint32_t concrete_frame_idx, const CONTEXT *context) + : RegisterContextWindows_x64(thread, concrete_frame_idx) +{ + if (context) + { + m_context = *context; + m_context_stale = false; + } +} + +RegisterContextWindowsMiniDump_x64::~RegisterContextWindowsMiniDump_x64() +{ +} + +bool +RegisterContextWindowsMiniDump_x64::WriteRegister(const RegisterInfo * /* reg_info */, const RegisterValue & /* reg_value */) +{ + return false; +} + +bool +RegisterContextWindowsMiniDump_x64::CacheAllRegisterValues() +{ + // Since this is post-mortem debugging, we either have the context or we don't. + return !m_context_stale; +} + +} // namespace lldb_private Index: lldb/trunk/source/Plugins/Process/Windows/MiniDump/x86/RegisterContextWindowsMiniDump_x86.h =================================================================== --- lldb/trunk/source/Plugins/Process/Windows/MiniDump/x86/RegisterContextWindowsMiniDump_x86.h +++ lldb/trunk/source/Plugins/Process/Windows/MiniDump/x86/RegisterContextWindowsMiniDump_x86.h @@ -0,0 +1,36 @@ +//===-- RegisterContextWindowsMiniDump_x86.h ------------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#ifndef liblldb_RegisterContextWindowsMiniDump_x86_H_ +#define liblldb_RegisterContextWindowsMiniDump_x86_H_ + +#include "lldb/lldb-forward.h" +#include "Plugins/Process/Windows/Common/x86/RegisterContextWindows_x86.h" + +namespace lldb_private +{ + +class Thread; + +class RegisterContextWindowsMiniDump_x86 : public RegisterContextWindows_x86 +{ + public: + RegisterContextWindowsMiniDump_x86(Thread &thread, uint32_t concrete_frame_idx, const CONTEXT *context); + + virtual ~RegisterContextWindowsMiniDump_x86(); + + bool WriteRegister(const RegisterInfo *reg_info, const RegisterValue ®_value) override; + + protected: + bool CacheAllRegisterValues() override; +}; + +} + +#endif // #ifndef liblldb_RegisterContextWindowsMiniDump_x86_H_ Index: lldb/trunk/source/Plugins/Process/Windows/MiniDump/x86/RegisterContextWindowsMiniDump_x86.cpp =================================================================== --- lldb/trunk/source/Plugins/Process/Windows/MiniDump/x86/RegisterContextWindowsMiniDump_x86.cpp +++ lldb/trunk/source/Plugins/Process/Windows/MiniDump/x86/RegisterContextWindowsMiniDump_x86.cpp @@ -0,0 +1,47 @@ +//===-- RegisterContextWindowsMiniDump_x86.cpp ------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#include "lldb/lldb-private-types.h" +#include "lldb/Host/windows/windows.h" + +#include "RegisterContextWindowsMiniDump_x86.h" + +using namespace lldb; + +namespace lldb_private +{ + +RegisterContextWindowsMiniDump_x86::RegisterContextWindowsMiniDump_x86(Thread &thread, uint32_t concrete_frame_idx, const CONTEXT *context) + : RegisterContextWindows_x86(thread, concrete_frame_idx) +{ + if (context) + { + m_context = *context; + m_context_stale = false; + } +} + +RegisterContextWindowsMiniDump_x86::~RegisterContextWindowsMiniDump_x86() +{ +} + +bool +RegisterContextWindowsMiniDump_x86::WriteRegister(const RegisterInfo * /* reg_info */, const RegisterValue & /* reg_value */) +{ + return false; +} + +bool +RegisterContextWindowsMiniDump_x86::CacheAllRegisterValues() +{ + // Since this is post-mortem debugging, we either have the context or we don't. + return !m_context_stale; +} + +} // namespace lldb_private