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"
15#include "lldb/API/SBProcess.h"
16#include "lldb/API/SBThread.h"
18
19namespace lldb {
20
22public:
26
27 const SBSaveCoreOptions &operator=(const lldb::SBSaveCoreOptions &rhs);
28
29 /// Set the plugin name. Supplying null or empty string will reset
30 /// the option.
31 ///
32 /// \param plugin
33 /// Name of the object file plugin.
34 SBError SetPluginName(const char *plugin);
35
36 /// Get the Core dump plugin name, if set.
37 ///
38 /// \return
39 /// The name of the plugin, or null if not set.
40 const char *GetPluginName() const;
41
42 /// Set the Core dump style.
43 ///
44 /// \param style
45 /// The style of the core dump.
46 void SetStyle(lldb::SaveCoreStyle style);
47
48 /// Get the Core dump style, if set.
49 ///
50 /// \return
51 /// The core dump style, or undefined if not set.
52 lldb::SaveCoreStyle GetStyle() const;
53
54 /// Set the output file path
55 ///
56 /// \param
57 /// output_file a \class SBFileSpec object that describes the output file.
58 void SetOutputFile(SBFileSpec output_file);
59
60 /// Get the output file spec
61 ///
62 /// \return
63 /// The output file spec.
64 SBFileSpec GetOutputFile() const;
65
66 /// Set the process to save, or unset if supplied with a default constructed
67 /// process.
68 ///
69 /// \param process
70 /// The process to save.
71 ///
72 /// \return
73 /// Success if process was set, otherwise an error
74 ///
75 /// \note
76 /// This will clear all process specific options if a different process
77 /// is specified than the current set process, either explicitly from this
78 /// api, or implicitly from any function that requires a process.
79 SBError SetProcess(lldb::SBProcess process);
80
81 /// Add a thread to save in the core file.
82 ///
83 /// \param thread
84 /// The thread to save.
85 ///
86 /// \note
87 /// This will set the process if it is not already set, or return
88 /// and error if the SBThread is not from the set process.
89 SBError AddThread(lldb::SBThread thread);
90
91 /// Remove a thread from the list of threads to save.
92 ///
93 /// \param thread
94 /// The thread to remove.
95 ///
96 /// \return
97 /// True if the thread was removed, false if it was not in the list.
98 bool RemoveThread(lldb::SBThread thread);
99
100 /// Add a memory region to save in the core file.
101 ///
102 /// \param region
103 /// The memory region to save.
104 ///
105 /// \returns
106 /// An empty SBError upon success, or an error if the region is invalid.
107 ///
108 /// \note
109 /// Ranges that overlapped will be unioned into a single region, this also
110 /// supercedes stack minification. Specifying full regions and a non-custom
111 /// core style will include the specified regions and union them with all
112 /// style specific regions.
113 SBError AddMemoryRegionToSave(const SBMemoryRegionInfo &region);
114
115 /// Get an unsorted copy of all threads to save
116 ///
117 /// \returns
118 /// An unsorted copy of all threads to save. If no process is specified
119 /// an empty collection will be returned.
120 SBThreadCollection GetThreadsToSave() const;
121
122 /// Reset all options.
123 void Clear();
124
125protected:
126 friend class SBProcess;
127 friend class SBThreadCollection;
129
130private:
131 std::unique_ptr<lldb_private::SaveCoreOptions> m_opaque_up;
132}; // SBSaveCoreOptions
133} // namespace lldb
134
135#endif // LLDB_API_SBSAVECOREOPTIONS_H
#define LLDB_API
Definition: SBDefines.h:28
Set the output file path.
std::unique_ptr< lldb_private::SaveCoreOptions > m_opaque_up
Definition: SBAddress.h:15