Adrian McCarthy | c96516f | 2015-08-03 23:01:51 +0000 | [diff] [blame] | 1 | //===-- ThreadWinMiniDump.cpp -----------------------------------*- C++ -*-===// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | |
| 10 | #include "ThreadWinMiniDump.h" |
| 11 | |
| 12 | // Windows includes |
| 13 | #include "lldb/Host/windows/windows.h" |
| 14 | #include <DbgHelp.h> |
| 15 | |
| 16 | #include "ProcessWinMiniDump.h" |
| 17 | #include "RegisterContextWindowsMiniDump.h" |
| 18 | |
| 19 | using namespace lldb; |
| 20 | using namespace lldb_private; |
| 21 | |
| 22 | // This is a minimal implementation in order to get something running. It will |
| 23 | // be fleshed out as more mini-dump functionality is added. |
| 24 | |
| 25 | ThreadWinMiniDump::ThreadWinMiniDump(lldb_private::Process &process, lldb::tid_t tid) : |
| 26 | Thread(process, tid), |
| 27 | m_thread_name() |
| 28 | { |
| 29 | } |
| 30 | |
| 31 | ThreadWinMiniDump::~ThreadWinMiniDump() |
| 32 | { |
| 33 | } |
| 34 | |
| 35 | void |
| 36 | ThreadWinMiniDump::RefreshStateAfterStop() |
| 37 | { |
| 38 | } |
| 39 | |
| 40 | lldb::RegisterContextSP |
| 41 | ThreadWinMiniDump::GetRegisterContext() |
| 42 | { |
| 43 | if (m_reg_context_sp.get() == NULL) { |
| 44 | m_reg_context_sp = CreateRegisterContextForFrame (NULL); |
| 45 | } |
| 46 | return m_reg_context_sp; |
| 47 | } |
| 48 | |
| 49 | lldb::RegisterContextSP |
| 50 | ThreadWinMiniDump::CreateRegisterContextForFrame(lldb_private::StackFrame *frame) |
| 51 | { |
| 52 | const uint32_t concrete_frame_idx = (frame) ? frame->GetConcreteFrameIndex() : 0; |
| 53 | RegisterContextSP reg_ctx_sp(new RegisterContextWindowsMiniDump(*this, concrete_frame_idx)); |
| 54 | return reg_ctx_sp; |
| 55 | } |
| 56 | |
| 57 | void |
| 58 | ThreadWinMiniDump::ClearStackFrames() |
| 59 | { |
| 60 | } |
| 61 | |
| 62 | const char * |
| 63 | ThreadWinMiniDump::GetName() |
| 64 | { |
| 65 | return m_thread_name.empty() ? nullptr : m_thread_name.c_str(); |
| 66 | } |
| 67 | |
| 68 | void |
| 69 | ThreadWinMiniDump::SetName(const char *name) |
| 70 | { |
| 71 | if (name && name[0]) |
| 72 | m_thread_name.assign(name); |
| 73 | else |
| 74 | m_thread_name.clear(); |
| 75 | } |
| 76 | |
| 77 | bool ThreadWinMiniDump::CalculateStopInfo() |
| 78 | { |
| 79 | return false; |
| 80 | } |