xref: /freebsd/contrib/llvm-project/lldb/source/Plugins/Trace/common/ThreadPostMortemTrace.cpp (revision bdd1243df58e60e85101c09001d9812a789b6bc4)
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 #include <optional>
13 
14 #include "Plugins/Process/Utility/RegisterContextHistory.h"
15 #include "lldb/Target/Process.h"
16 #include "lldb/Target/RegisterContext.h"
17 
18 using namespace lldb;
19 using namespace lldb_private;
20 using namespace llvm;
21 
RefreshStateAfterStop()22 void ThreadPostMortemTrace::RefreshStateAfterStop() {}
23 
GetRegisterContext()24 RegisterContextSP ThreadPostMortemTrace::GetRegisterContext() {
25   if (!m_reg_context_sp)
26     m_reg_context_sp = CreateRegisterContextForFrame(nullptr);
27 
28   return m_reg_context_sp;
29 }
30 
31 RegisterContextSP
CreateRegisterContextForFrame(StackFrame * frame)32 ThreadPostMortemTrace::CreateRegisterContextForFrame(StackFrame *frame) {
33   // Eventually this will calculate the register context based on the current
34   // trace position.
35   return std::make_shared<RegisterContextHistory>(
36       *this, 0, GetProcess()->GetAddressByteSize(), LLDB_INVALID_ADDRESS);
37 }
38 
CalculateStopInfo()39 bool ThreadPostMortemTrace::CalculateStopInfo() { return false; }
40 
GetTraceFile() const41 const std::optional<FileSpec> &ThreadPostMortemTrace::GetTraceFile() const {
42   return m_trace_file;
43 }
44