to reflect the new license. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351636
94 lines
2.7 KiB
C++
94 lines
2.7 KiB
C++
//===-- SBTraceOptions.cpp --------------------------------------*- C++ -*-===//
|
|
//
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#include "lldb/API/SBTraceOptions.h"
|
|
#include "lldb/API/SBError.h"
|
|
#include "lldb/API/SBStructuredData.h"
|
|
#include "lldb/Core/StructuredDataImpl.h"
|
|
#include "lldb/Utility/Log.h"
|
|
#include "lldb/Utility/TraceOptions.h"
|
|
|
|
using namespace lldb;
|
|
using namespace lldb_private;
|
|
|
|
SBTraceOptions::SBTraceOptions() {
|
|
m_traceoptions_sp.reset(new TraceOptions());
|
|
}
|
|
|
|
lldb::TraceType SBTraceOptions::getType() const {
|
|
if (m_traceoptions_sp)
|
|
return m_traceoptions_sp->getType();
|
|
return lldb::TraceType::eTraceTypeNone;
|
|
}
|
|
|
|
uint64_t SBTraceOptions::getTraceBufferSize() const {
|
|
if (m_traceoptions_sp)
|
|
return m_traceoptions_sp->getTraceBufferSize();
|
|
return 0;
|
|
}
|
|
|
|
lldb::SBStructuredData SBTraceOptions::getTraceParams(lldb::SBError &error) {
|
|
error.Clear();
|
|
const lldb_private::StructuredData::DictionarySP dict_obj =
|
|
m_traceoptions_sp->getTraceParams();
|
|
lldb::SBStructuredData structData;
|
|
if (dict_obj && structData.m_impl_up)
|
|
structData.m_impl_up->SetObjectSP(dict_obj->shared_from_this());
|
|
else
|
|
error.SetErrorString("Empty trace params");
|
|
return structData;
|
|
}
|
|
|
|
uint64_t SBTraceOptions::getMetaDataBufferSize() const {
|
|
if (m_traceoptions_sp)
|
|
return m_traceoptions_sp->getTraceBufferSize();
|
|
return 0;
|
|
}
|
|
|
|
void SBTraceOptions::setTraceParams(lldb::SBStructuredData ¶ms) {
|
|
if (m_traceoptions_sp && params.m_impl_up) {
|
|
StructuredData::ObjectSP obj_sp = params.m_impl_up->GetObjectSP();
|
|
if (obj_sp && obj_sp->GetAsDictionary() != nullptr)
|
|
m_traceoptions_sp->setTraceParams(
|
|
std::static_pointer_cast<StructuredData::Dictionary>(obj_sp));
|
|
}
|
|
return;
|
|
}
|
|
|
|
void SBTraceOptions::setType(lldb::TraceType type) {
|
|
if (m_traceoptions_sp)
|
|
m_traceoptions_sp->setType(type);
|
|
}
|
|
|
|
void SBTraceOptions::setTraceBufferSize(uint64_t size) {
|
|
if (m_traceoptions_sp)
|
|
m_traceoptions_sp->setTraceBufferSize(size);
|
|
}
|
|
|
|
void SBTraceOptions::setMetaDataBufferSize(uint64_t size) {
|
|
if (m_traceoptions_sp)
|
|
m_traceoptions_sp->setMetaDataBufferSize(size);
|
|
}
|
|
|
|
bool SBTraceOptions::IsValid() {
|
|
if (m_traceoptions_sp)
|
|
return true;
|
|
return false;
|
|
}
|
|
|
|
void SBTraceOptions::setThreadID(lldb::tid_t thread_id) {
|
|
if (m_traceoptions_sp)
|
|
m_traceoptions_sp->setThreadID(thread_id);
|
|
}
|
|
|
|
lldb::tid_t SBTraceOptions::getThreadID() {
|
|
if (m_traceoptions_sp)
|
|
return m_traceoptions_sp->getThreadID();
|
|
return LLDB_INVALID_THREAD_ID;
|
|
}
|