LLDB mainline
SBSaveCoreOptions.h
Go to the documentation of this file.
1//===-- SBSaveCoreOptions.h -------------------------------------*- 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#ifndef LLDB_API_SBSAVECOREOPTIONS_H
10#define LLDB_API_SBSAVECOREOPTIONS_H
11
12#include "lldb/API/SBDefines.h"
13#include "lldb/API/SBError.h"
14#include "lldb/API/SBFileSpec.h"
16#include "lldb/API/SBProcess.h"
17#include "lldb/API/SBThread.h"
19
20namespace lldb {
21
23public:
27
29
30 /// Set the plugin name. Supplying null or empty string will reset
31 /// the option.
32 ///
33 /// \param plugin
34 /// Name of the object file plugin.
35 SBError SetPluginName(const char *plugin);
36
37 /// Get the Core dump plugin name, if set.
38 ///
39 /// \return
40 /// The name of the plugin, or null if not set.
41 const char *GetPluginName() const;
42
43 /// Set the Core dump style.
44 ///
45 /// \param style
46 /// The style of the core dump.
47 void SetStyle(lldb::SaveCoreStyle style);
48
49 /// Get the Core dump style, if set.
50 ///
51 /// \return
52 /// The core dump style, or undefined if not set.
54
55 /// Set the output file path
56 ///
57 /// \param
58 /// output_file a \ref SBFileSpec object that describes the output file.
59 void SetOutputFile(SBFileSpec output_file);
60
61 /// Get the output file spec
62 ///
63 /// \return
64 /// The output file spec.
66
67 /// Set the process to save, or unset if supplied with a default constructed
68 /// process.
69 ///
70 /// \param process
71 /// The process to save.
72 ///
73 /// \return
74 /// Success if process was set, otherwise an error
75 ///
76 /// \note
77 /// This will clear all process specific options if a different process
78 /// is specified than the current set process, either explicitly from this
79 /// api, or implicitly from any function that requires a process.
81
82 /// Get the process to save, if the process is not set an invalid SBProcess
83 /// will be returned.
84 ///
85 /// \return
86 /// The set process, or an invalid SBProcess if no process is set.
88
89 /// Add a thread to save in the core file.
90 ///
91 /// \param thread
92 /// The thread to save.
93 ///
94 /// \note
95 /// This will set the process if it is not already set, or return
96 /// and error if the SBThread is not from the set process.
98
99 /// Remove a thread from the list of threads to save.
100 ///
101 /// \param thread
102 /// The thread to remove.
103 ///
104 /// \return
105 /// True if the thread was removed, false if it was not in the list.
106 bool RemoveThread(lldb::SBThread thread);
107
108 /// Add a memory region to save in the core file.
109 ///
110 /// \param region
111 /// The memory region to save.
112 ///
113 /// \returns
114 /// An empty SBError upon success, or an error if the region is invalid.
115 ///
116 /// \note
117 /// Ranges that overlapped will be unioned into a single region, this also
118 /// supercedes stack minification. Specifying full regions and a non-custom
119 /// core style will include the specified regions and union them with all
120 /// style specific regions.
122
123 /// Get an unsorted copy of all threads to save
124 ///
125 /// \returns
126 /// An unsorted copy of all threads to save. If no process is specified
127 /// an empty collection will be returned.
129
130 /// Get an unsorted copy of all memory regions to save
131 ///
132 /// \returns
133 /// An unsorted copy of all memory regions to save. If no process or style
134 /// is specified an empty collection will be returned.
136
137 /// Get the current total number of bytes the core is expected to have
138 /// excluding the overhead of the core file format. Requires a Process and
139 /// Style to be specified.
140 ///
141 /// \note
142 /// This can cause some modification of the underlying data store
143 /// as regions with no permissions, or invalid permissions will be removed
144 /// and stacks will be minified up to their stack pointer + the redzone.
145 ///
146 /// \returns
147 /// The expected size of the data contained in the core in bytes.
149
150 /// Reset all options.
151 void Clear();
152
153protected:
154 friend class SBProcess;
155 friend class SBThreadCollection;
157
158private:
159 std::unique_ptr<lldb_private::SaveCoreOptions> m_opaque_up;
160}; // SBSaveCoreOptions
161} // namespace lldb
162
163#endif // LLDB_API_SBSAVECOREOPTIONS_H
static llvm::raw_ostream & error(Stream &strm)
#define LLDB_API
Definition SBDefines.h:28
SBThreadCollection GetThreadsToSave() const
Get an unsorted copy of all threads to save.
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)
Set the output file path.
lldb_private::SaveCoreOptions & ref() const
uint64_t GetCurrentSizeInBytes(SBError &error)
Get the current total number of bytes the core is expected to have excluding the overhead of the core...
SBError SetProcess(lldb::SBProcess process)
Set the process to save, or unset if supplied with a default constructed process.
SBProcess GetProcess()
Get the process to save, if the process is not set an invalid SBProcess will be returned.
SBMemoryRegionInfoList GetMemoryRegionsToSave()
Get an unsorted copy of all memory regions to save.
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.