Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/freebsd-src
Path: blob/main/contrib/llvm-project/lldb/source/API/SBSaveCoreOptions.cpp
39587 views
1
//===-- SBSaveCoreOptions.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
//===----------------------------------------------------------------------===//
8
9
#include "lldb/API/SBSaveCoreOptions.h"
10
#include "lldb/API/SBError.h"
11
#include "lldb/API/SBFileSpec.h"
12
#include "lldb/Host/FileSystem.h"
13
#include "lldb/Symbol/SaveCoreOptions.h"
14
#include "lldb/Utility/Instrumentation.h"
15
16
#include "Utils.h"
17
18
using namespace lldb;
19
20
SBSaveCoreOptions::SBSaveCoreOptions() {
21
LLDB_INSTRUMENT_VA(this)
22
23
m_opaque_up = std::make_unique<lldb_private::SaveCoreOptions>();
24
}
25
26
SBSaveCoreOptions::SBSaveCoreOptions(const SBSaveCoreOptions &rhs) {
27
LLDB_INSTRUMENT_VA(this, rhs);
28
29
m_opaque_up = clone(rhs.m_opaque_up);
30
}
31
32
SBSaveCoreOptions::~SBSaveCoreOptions() = default;
33
34
const SBSaveCoreOptions &
35
SBSaveCoreOptions::operator=(const SBSaveCoreOptions &rhs) {
36
LLDB_INSTRUMENT_VA(this, rhs);
37
38
if (this != &rhs)
39
m_opaque_up = clone(rhs.m_opaque_up);
40
return *this;
41
}
42
43
SBError SBSaveCoreOptions::SetPluginName(const char *name) {
44
LLDB_INSTRUMENT_VA(this, name);
45
lldb_private::Status error = m_opaque_up->SetPluginName(name);
46
return SBError(error);
47
}
48
49
void SBSaveCoreOptions::SetStyle(lldb::SaveCoreStyle style) {
50
LLDB_INSTRUMENT_VA(this, style);
51
m_opaque_up->SetStyle(style);
52
}
53
54
void SBSaveCoreOptions::SetOutputFile(lldb::SBFileSpec file_spec) {
55
LLDB_INSTRUMENT_VA(this, file_spec);
56
m_opaque_up->SetOutputFile(file_spec.ref());
57
}
58
59
const char *SBSaveCoreOptions::GetPluginName() const {
60
LLDB_INSTRUMENT_VA(this);
61
const auto name = m_opaque_up->GetPluginName();
62
if (!name)
63
return nullptr;
64
return lldb_private::ConstString(name.value()).GetCString();
65
}
66
67
SBFileSpec SBSaveCoreOptions::GetOutputFile() const {
68
LLDB_INSTRUMENT_VA(this);
69
const auto file_spec = m_opaque_up->GetOutputFile();
70
if (file_spec)
71
return SBFileSpec(file_spec.value());
72
return SBFileSpec();
73
}
74
75
lldb::SaveCoreStyle SBSaveCoreOptions::GetStyle() const {
76
LLDB_INSTRUMENT_VA(this);
77
return m_opaque_up->GetStyle();
78
}
79
80
void SBSaveCoreOptions::Clear() {
81
LLDB_INSTRUMENT_VA(this);
82
m_opaque_up->Clear();
83
}
84
85
lldb_private::SaveCoreOptions &SBSaveCoreOptions::ref() const {
86
return *m_opaque_up.get();
87
}
88
89