LLDB mainline
SBTraceCursor.cpp
Go to the documentation of this file.
1//===-- SBTraceCursor.cpp
2//-------------------------------------------------------===//
3//
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7//
8//===----------------------------------------------------------------------===//
9
11#include "Utils.h"
15
16using namespace lldb;
17using namespace lldb_private;
18
20
25
27 LLDB_INSTRUMENT_VA(this, rhs);
28
29 if (this != &rhs)
31 return *this;
32}
33
36
38 m_opaque_sp = std::move(rhs.m_opaque_sp);
39 return *this;
40}
41
43
45 : m_opaque_sp{std::move(trace_cursor_sp)} {
46 LLDB_INSTRUMENT_VA(this, trace_cursor_sp);
47}
48
49void SBTraceCursor::SetForwards(bool forwards) {
50 LLDB_INSTRUMENT_VA(this, forwards);
51
52 m_opaque_sp->SetForwards(forwards);
53}
54
57
58 return m_opaque_sp->IsForwards();
59}
60
63
64 return m_opaque_sp->Next();
65}
66
69
70 return m_opaque_sp->HasValue();
71}
72
74 LLDB_INSTRUMENT_VA(this, id);
75
76 return m_opaque_sp->GoToId(id);
77}
78
80 LLDB_INSTRUMENT_VA(this, id);
81
82 return m_opaque_sp->HasId(id);
83}
84
87
88 return m_opaque_sp->GetId();
89}
90
91bool SBTraceCursor::Seek(int64_t offset, lldb::TraceCursorSeekType origin) {
92 LLDB_INSTRUMENT_VA(this, offset);
93
94 return m_opaque_sp->Seek(offset, origin);
95}
96
99
100 return m_opaque_sp->GetItemKind();
101}
102
104 LLDB_INSTRUMENT_VA(this);
105
106 return m_opaque_sp->IsError();
107}
108
109const char *SBTraceCursor::GetError() const {
110 LLDB_INSTRUMENT_VA(this);
111
112 return StringPool::GetSystemPool().Intern(m_opaque_sp->GetError());
113}
114
116 LLDB_INSTRUMENT_VA(this);
117
118 return m_opaque_sp->IsEvent();
119}
120
122 LLDB_INSTRUMENT_VA(this);
123
124 return m_opaque_sp->GetEventType();
125}
126
128 LLDB_INSTRUMENT_VA(this);
129
131 m_opaque_sp->GetEventTypeAsString());
132}
133
135 LLDB_INSTRUMENT_VA(this);
136
137 return m_opaque_sp->IsInstruction();
138}
139
141 LLDB_INSTRUMENT_VA(this);
142
143 return m_opaque_sp->GetLoadAddress();
144}
145
147 LLDB_INSTRUMENT_VA(this);
148
149 return m_opaque_sp->GetCPU();
150}
151
153 LLDB_INSTRUMENT_VA(this);
154
155 return this->operator bool();
156}
157
158SBTraceCursor::operator bool() const {
159 LLDB_INSTRUMENT_VA(this);
160
161 return m_opaque_sp.get() != nullptr;
162}
#define LLDB_INSTRUMENT_VA(...)
lldb::user_id_t GetId() const
lldb::addr_t GetLoadAddress() const
lldb::TraceCursorSP m_opaque_sp
bool IsForwards() const
Check if the direction to use in the SBTraceCursor::Next() method is forwards.
const char * GetEventTypeAsString() const
bool GoToId(lldb::user_id_t id)
Instruction identifiers:
bool IsInstruction() const
void Next()
Move the cursor to the next item (instruction or error).
const char * GetError() const
SBTraceCursor()
Default constructor for an invalid SBTraceCursor object.
lldb::TraceEvent GetEventType() const
lldb::TraceItemKind GetItemKind() const
Trace item information (instructions, errors and events)
lldb::SBTraceCursor & operator=(const lldb::SBTraceCursor &rhs)
void SetForwards(bool forwards)
Set the direction to use in the SBTraceCursor::Next() method.
lldb::cpu_id_t GetCPU() const
bool Seek(int64_t offset, lldb::TraceCursorSeekType origin)
Make the cursor point to an item in the trace based on an origin point and an offset.
bool HasId(lldb::user_id_t id) const
const char * Intern(llvm::StringRef str) const
Definition StringPool.h:78
static StringPoolRef GetSystemPool()
The system pool. Only valid between Initialize and Terminate.
A class that represents a running process on the host machine.
TraceEvent
Events that might happen during a trace session.
uint32_t cpu_id_t
Definition lldb-types.h:93
TraceCursorSeekType
Enum to indicate the reference point when invoking TraceCursor::Seek().
std::shared_ptr< lldb_private::TraceCursor > TraceCursorSP
uint64_t user_id_t
Definition lldb-types.h:83
uint64_t addr_t
Definition lldb-types.h:80