Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / lldb / source / Target / TraceCursor.cpp
blobb85cc750a8a4118112f0a4d067c5b6854178375b
1 //===-- TraceCursor.cpp -----------------------------------------*- C++ -*-===//
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 //===----------------------------------------------------------------------===//
9 #include "lldb/Target/TraceCursor.h"
11 #include "lldb/Target/ExecutionContext.h"
12 #include "lldb/Target/Trace.h"
14 using namespace lldb;
15 using namespace lldb_private;
16 using namespace llvm;
18 TraceCursor::TraceCursor(lldb::ThreadSP thread_sp)
19 : m_exe_ctx_ref(ExecutionContext(thread_sp)) {}
21 ExecutionContextRef &TraceCursor::GetExecutionContextRef() {
22 return m_exe_ctx_ref;
25 void TraceCursor::SetForwards(bool forwards) { m_forwards = forwards; }
27 bool TraceCursor::IsForwards() const { return m_forwards; }
29 bool TraceCursor::IsError() const {
30 return GetItemKind() == lldb::eTraceItemKindError;
33 bool TraceCursor::IsEvent() const {
34 return GetItemKind() == lldb::eTraceItemKindEvent;
37 bool TraceCursor::IsInstruction() const {
38 return GetItemKind() == lldb::eTraceItemKindInstruction;
41 const char *TraceCursor::GetEventTypeAsString() const {
42 return EventKindToString(GetEventType());
45 const char *TraceCursor::EventKindToString(lldb::TraceEvent event_kind) {
46 switch (event_kind) {
47 case lldb::eTraceEventDisabledHW:
48 return "hardware disabled tracing";
49 case lldb::eTraceEventDisabledSW:
50 return "software disabled tracing";
51 case lldb::eTraceEventCPUChanged:
52 return "CPU core changed";
53 case lldb::eTraceEventHWClockTick:
54 return "HW clock tick";
55 case lldb::eTraceEventSyncPoint:
56 return "trace synchronization point";
58 llvm_unreachable("Fully covered switch above");