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
14
15#include "Utils.h"
16
17using namespace lldb;
18
21
22 m_opaque_up = std::make_unique<lldb_private::SaveCoreOptions>();
23}
24
26 LLDB_INSTRUMENT_VA(this, rhs);
27
28 m_opaque_up = clone(rhs.m_opaque_up);
29}
30
32
35 LLDB_INSTRUMENT_VA(this, rhs);
36
37 if (this != &rhs)
38 m_opaque_up = clone(rhs.m_opaque_up);
39 return *this;
40}
41
43 LLDB_INSTRUMENT_VA(this, name);
44 return SBError(m_opaque_up->SetPluginName(name));
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 LLDB_INSTRUMENT_VA(this, region);
96 // Currently add memory region can't fail, so we always return a success
97 // SBerror, but because these API's live forever, this is the most future
98 // proof thing to do.
99 m_opaque_up->AddMemoryRegionToSave(region.ref());
100 return SBError();
101}
102
104 LLDB_INSTRUMENT_VA(this);
105 m_opaque_up->Clear();
106}
107
109 return *m_opaque_up.get();
110}
#define LLDB_INSTRUMENT_VA(...)
const lldb_private::FileSpec & ref() const
Definition: SBFileSpec.cpp:162
lldb_private::MemoryRegionInfo & ref()
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 AddMemoryRegionToSave(const SBMemoryRegionInfo &region)
Add a memory region to save in the core file.
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:1346
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
Definition: SBAddress.h:15