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
13
14#include "Utils.h"
15
16using namespace lldb;
17
20
21 m_opaque_up = std::make_unique<lldb_private::SaveCoreOptions>();
22}
23
25 LLDB_INSTRUMENT_VA(this, rhs);
26
27 m_opaque_up = clone(rhs.m_opaque_up);
28}
29
31
34 LLDB_INSTRUMENT_VA(this, rhs);
35
36 if (this != &rhs)
37 m_opaque_up = clone(rhs.m_opaque_up);
38 return *this;
39}
40
42 LLDB_INSTRUMENT_VA(this, name);
43 lldb_private::Status error = m_opaque_up->SetPluginName(name);
44 return SBError(error);
45}
46
48 LLDB_INSTRUMENT_VA(this, style);
49 m_opaque_up->SetStyle(style);
50}
51
53 LLDB_INSTRUMENT_VA(this, file_spec);
54 m_opaque_up->SetOutputFile(file_spec.ref());
55}
56
59 const auto name = m_opaque_up->GetPluginName();
60 if (!name)
61 return nullptr;
62 return lldb_private::ConstString(name.value()).GetCString();
63}
64
67 const auto file_spec = m_opaque_up->GetOutputFile();
68 if (file_spec)
69 return SBFileSpec(file_spec.value());
70 return SBFileSpec();
71}
72
75 return m_opaque_up->GetStyle();
76}
77
79 LLDB_INSTRUMENT_VA(this, process);
80 return m_opaque_up->SetProcess(process.GetSP());
81}
82
84 LLDB_INSTRUMENT_VA(this, thread);
85 return m_opaque_up->AddThread(thread.GetSP());
86}
87
89 LLDB_INSTRUMENT_VA(this, thread);
90 return m_opaque_up->RemoveThread(thread.GetSP());
91}
92
95 m_opaque_up->Clear();
96}
97
99 return *m_opaque_up.get();
100}
static llvm::raw_ostream & error(Stream &strm)
#define LLDB_INSTRUMENT_VA(...)
const lldb_private::FileSpec & ref() const
Definition: SBFileSpec.cpp:162
lldb::ProcessSP GetSP() const
Definition: SBProcess.cpp:106
bool RemoveThread(lldb::SBThread thread)
Remove a thread from the list of threads to save.
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
SBError SetProcess(lldb::SBProcess process)
Set the process to save, or unset if supplied with a default constructed process.
SBError AddThread(lldb::SBThread thread)
Add a thread to save in the core file.
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.
lldb::ThreadSP GetSP() const
Definition: SBThread.cpp:1341
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