1 //===-- ThreadPostMortemTrace.cpp -----------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #include "ThreadPostMortemTrace.h"
10 
11 #include <memory>
12 
13 #include "Plugins/Process/Utility/RegisterContextHistory.h"
14 #include "lldb/Target/Process.h"
15 #include "lldb/Target/RegisterContext.h"
16 
17 using namespace lldb;
18 using namespace lldb_private;
19 using namespace llvm;
20 
21 void ThreadPostMortemTrace::RefreshStateAfterStop() {}
22 
23 RegisterContextSP ThreadPostMortemTrace::GetRegisterContext() {
24   if (!m_reg_context_sp)
25     m_reg_context_sp = CreateRegisterContextForFrame(nullptr);
26 
27   return m_reg_context_sp;
28 }
29 
30 RegisterContextSP
31 ThreadPostMortemTrace::CreateRegisterContextForFrame(StackFrame *frame) {
32   // Eventually this will calculate the register context based on the current
33   // trace position.
34   return std::make_shared<RegisterContextHistory>(
35       *this, 0, GetProcess()->GetAddressByteSize(), LLDB_INVALID_ADDRESS);
36 }
37 
38 bool ThreadPostMortemTrace::CalculateStopInfo() { return false; }
39 
40 const Optional<FileSpec> &ThreadPostMortemTrace::GetTraceFile() const {
41   return m_trace_file;
42 }
43