19 if (!name || !name[0]) {
24 std::vector<llvm::StringRef> plugin_names =
26 if (!llvm::is_contained(plugin_names, name)) {
28 stream.
Printf(
"plugin name '%s' is not a valid ObjectFile plugin name.",
31 if (!plugin_names.empty()) {
33 std::string plugin_names_str = llvm::join(plugin_names,
", ");
56const std::optional<lldb_private::FileSpec>
69 if (!process_sp->IsValid()) {
93 "Cannot add a thread from a different process.");
129 std::string error_str;
131 error_str +=
"Cannot save a full core with a subset of threads\n";
134 error_str +=
"Need to assign a valid process\n";
136 if (!error_str.empty())
147 return thread_collection;
153 return thread_collection;
156llvm::Expected<lldb_private::CoreFileMemoryRanges>
164 return error.takeError();
169 return error.takeError();
181 return error.takeError();
186 return error.takeError();
188 llvm::Expected<lldb_private::CoreFileMemoryRanges> core_file_ranges_maybe =
190 if (!core_file_ranges_maybe)
191 return core_file_ranges_maybe.takeError();
193 *core_file_ranges_maybe;
194 uint64_t total_in_bytes = 0;
195 for (
const auto &core_range : core_file_ranges)
196 total_in_bytes += core_range.data.range.size();
198 return total_in_bytes;
static llvm::raw_ostream & error(Stream &strm)
lldb_private::RangeVector< lldb::addr_t, lldb::addr_t > MemoryRanges
static std::vector< llvm::StringRef > GetSaveCorePluginNames()
lldb::ProcessSP m_process_sp
Status SetProcess(lldb::ProcessSP process_sp)
lldb_private::Status SetPluginName(const char *name)
bool RemoveThread(lldb::ThreadSP thread_sp)
MemoryRanges m_regions_to_save
const std::optional< lldb_private::FileSpec > GetOutputFile() const
lldb::SaveCoreStyle GetStyle() const
Status AddThread(lldb::ThreadSP thread_sp)
std::optional< std::string > m_plugin_name
void SetStyle(lldb::SaveCoreStyle style)
Status EnsureValidConfiguration() const
void AddMemoryRegionToSave(const lldb_private::MemoryRegionInfo ®ion)
llvm::Expected< lldb_private::CoreFileMemoryRanges > GetMemoryRegionsToSave()
bool HasSpecifiedThreads() const
llvm::Expected< uint64_t > GetCurrentSizeInBytes()
std::optional< std::string > GetPluginName() const
const MemoryRanges & GetCoreFileMemoryRanges() const
std::optional< lldb::SaveCoreStyle > m_style
void SetOutputFile(lldb_private::FileSpec file)
void ClearProcessSpecificData()
lldb_private::ThreadCollection::collection GetThreadsToSave() const
std::unordered_set< lldb::tid_t > m_threads_to_save
bool ShouldThreadBeSaved(lldb::tid_t tid) const
std::optional< lldb_private::FileSpec > m_file
static Status FromErrorString(const char *str)
llvm::StringRef GetString() const
size_t Printf(const char *format,...) __attribute__((format(printf
Output printf formatted output to the stream.
size_t PutCString(llvm::StringRef cstr)
Output a C string to the stream.
std::vector< lldb::ThreadSP > collection
lldb::ThreadSP FindThreadByID(lldb::tid_t tid, bool can_update=true)
A class that represents a running process on the host machine.
std::shared_ptr< lldb_private::Thread > ThreadSP
std::shared_ptr< lldb_private::Process > ProcessSP