LLDB mainline
SBSaveCoreOptions.cpp
Go to the documentation of this file.
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
10#include "lldb/API/SBError.h"
11#include "lldb/API/SBFileSpec.h"
15
16#include "Utils.h"
17
18using namespace lldb;
19
22
23 m_opaque_up = std::make_unique<lldb_private::SaveCoreOptions>();
24}
25
27 LLDB_INSTRUMENT_VA(this, rhs);
28
29 m_opaque_up = clone(rhs.m_opaque_up);
30}
31
33
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
44 LLDB_INSTRUMENT_VA(this, name);
45 lldb_private::Status error = m_opaque_up->SetPluginName(name);
46 return SBError(error);
47}
48
50 LLDB_INSTRUMENT_VA(this, style);
51 m_opaque_up->SetStyle(style);
52}
53
55 LLDB_INSTRUMENT_VA(this, file_spec);
56 m_opaque_up->SetOutputFile(file_spec.ref());
57}
58
61 const auto name = m_opaque_up->GetPluginName();
62 if (!name)
63 return nullptr;
64 return lldb_private::ConstString(name.value()).GetCString();
65}
66
69 const auto file_spec = m_opaque_up->GetOutputFile();
70 if (file_spec)
71 return SBFileSpec(file_spec.value());
72 return SBFileSpec();
73}
74
77 return m_opaque_up->GetStyle();
78}
79
82 m_opaque_up->Clear();
83}
84
86 return *m_opaque_up.get();
87}
static llvm::raw_ostream & error(Stream &strm)
#define LLDB_INSTRUMENT_VA(...)
const lldb_private::FileSpec & ref() const
Definition: SBFileSpec.cpp:162
void SetStyle(lldb::SaveCoreStyle style)
Set the Core dump style.
const SBSaveCoreOptions & operator=(const lldb::SBSaveCoreOptions &rhs)
void Clear()
Reset all options.
void SetOutputFile(SBFileSpec output_file)
lldb_private::SaveCoreOptions & ref() const
const char * GetPluginName() const
Get the Core dump plugin name, if set.
lldb::SaveCoreStyle GetStyle() const
Get the Core dump style, if set.
SBError SetPluginName(const char *plugin)
Set the plugin name.
std::unique_ptr< lldb_private::SaveCoreOptions > m_opaque_up
SBFileSpec GetOutputFile() const
Get the output file spec.
A uniqued constant string class.
Definition: ConstString.h:40
const char * GetCString() const
Get the string value as a C string.
Definition: ConstString.h:216
An error handling class.
Definition: Status.h:44
Definition: SBAddress.h:15