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"
14
15using namespace lldb;
16using namespace lldb_private;
17
19
21 : m_opaque_sp{std::move(trace_cursor_sp)} {
22 LLDB_INSTRUMENT_VA(this, trace_cursor_sp);
23}
24
25void SBTraceCursor::SetForwards(bool forwards) {
26 LLDB_INSTRUMENT_VA(this, forwards);
27
28 m_opaque_sp->SetForwards(forwards);
29}
30
33
34 return m_opaque_sp->IsForwards();
35}
36
39
40 return m_opaque_sp->Next();
41}
42
45
46 return m_opaque_sp->HasValue();
47}
48
50 LLDB_INSTRUMENT_VA(this, id);
51
52 return m_opaque_sp->GoToId(id);
53}
54
56 LLDB_INSTRUMENT_VA(this, id);
57
58 return m_opaque_sp->HasId(id);
59}
60
63
64 return m_opaque_sp->GetId();
65}
66
67bool SBTraceCursor::Seek(int64_t offset, lldb::TraceCursorSeekType origin) {
68 LLDB_INSTRUMENT_VA(this, offset);
69
70 return m_opaque_sp->Seek(offset, origin);
71}
72
75
76 return m_opaque_sp->GetItemKind();
77}
78
81
82 return m_opaque_sp->IsError();
83}
84
85const char *SBTraceCursor::GetError() const {
87
88 return ConstString(m_opaque_sp->GetError()).GetCString();
89}
90
93
94 return m_opaque_sp->IsEvent();
95}
96
99
100 return m_opaque_sp->GetEventType();
101}
102
104 LLDB_INSTRUMENT_VA(this);
105
106 return ConstString(m_opaque_sp->GetEventTypeAsString()).GetCString();
107}
108
110 LLDB_INSTRUMENT_VA(this);
111
112 return m_opaque_sp->IsInstruction();
113}
114
116 LLDB_INSTRUMENT_VA(this);
117
118 return m_opaque_sp->GetLoadAddress();
119}
120
122 LLDB_INSTRUMENT_VA(this);
123
124 return m_opaque_sp->GetCPU();
125}
126
128 LLDB_INSTRUMENT_VA(this);
129
130 return this->operator bool();
131}
132
133SBTraceCursor::operator bool() const {
134 LLDB_INSTRUMENT_VA(this);
135
136 return m_opaque_sp.get() != nullptr;
137}
#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 HasValue() const
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.
bool IsError() const
bool IsEvent() const
lldb::TraceEvent GetEventType() const
lldb::TraceItemKind GetItemKind() const
Trace item information (instructions, errors and events)
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
A uniqued constant string class.
Definition: ConstString.h:40
const char * GetCString() const
Get the string value as a C string.
Definition: ConstString.h:214
A class that represents a running process on the host machine.
Definition: SBAttachInfo.h:14
Definition: SBAddress.h:15
TraceEvent
Events that might happen during a trace session.
uint32_t cpu_id_t
Definition: lldb-types.h:89
TraceCursorSeekType
Enum to indicate the reference point when invoking TraceCursor::Seek().
std::shared_ptr< lldb_private::TraceCursor > TraceCursorSP
Definition: lldb-forward.h:448
uint64_t user_id_t
Definition: lldb-types.h:80
uint64_t addr_t
Definition: lldb-types.h:79