brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.7 KiB · b85cc75 Raw
60 lines · cpp
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-exception6//7//===----------------------------------------------------------------------===//8 9#include "lldb/Target/TraceCursor.h"10 11#include "lldb/Target/ExecutionContext.h"12#include "lldb/Target/Trace.h"13 14using namespace lldb;15using namespace lldb_private;16using namespace llvm;17 18TraceCursor::TraceCursor(lldb::ThreadSP thread_sp)19    : m_exe_ctx_ref(ExecutionContext(thread_sp)) {}20 21ExecutionContextRef &TraceCursor::GetExecutionContextRef() {22  return m_exe_ctx_ref;23}24 25void TraceCursor::SetForwards(bool forwards) { m_forwards = forwards; }26 27bool TraceCursor::IsForwards() const { return m_forwards; }28 29bool TraceCursor::IsError() const {30  return GetItemKind() == lldb::eTraceItemKindError;31}32 33bool TraceCursor::IsEvent() const {34  return GetItemKind() == lldb::eTraceItemKindEvent;35}36 37bool TraceCursor::IsInstruction() const {38  return GetItemKind() == lldb::eTraceItemKindInstruction;39}40 41const char *TraceCursor::GetEventTypeAsString() const {42  return EventKindToString(GetEventType());43}44 45const 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";57  }58  llvm_unreachable("Fully covered switch above");59}60