1 //===-- SaveCoreOptions.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 9 #include "lldb/Symbol/SaveCoreOptions.h" 10 #include "lldb/Core/PluginManager.h" 11 12 using namespace lldb; 13 using namespace lldb_private; 14 SetPluginName(const char * name)15Status SaveCoreOptions::SetPluginName(const char *name) { 16 Status error; 17 if (!name || !name[0]) { 18 m_plugin_name = std::nullopt; 19 return error; 20 } 21 22 if (!PluginManager::IsRegisteredObjectFilePluginName(name)) { 23 error.SetErrorStringWithFormat( 24 "plugin name '%s' is not a valid ObjectFile plugin name", name); 25 return error; 26 } 27 28 m_plugin_name = name; 29 return error; 30 } 31 SetStyle(lldb::SaveCoreStyle style)32void SaveCoreOptions::SetStyle(lldb::SaveCoreStyle style) { m_style = style; } 33 SetOutputFile(FileSpec file)34void SaveCoreOptions::SetOutputFile(FileSpec file) { m_file = file; } 35 GetPluginName() const36std::optional<std::string> SaveCoreOptions::GetPluginName() const { 37 return m_plugin_name; 38 } 39 GetStyle() const40lldb::SaveCoreStyle SaveCoreOptions::GetStyle() const { 41 return m_style.value_or(lldb::eSaveCoreUnspecified); 42 } 43 44 const std::optional<lldb_private::FileSpec> GetOutputFile() const45SaveCoreOptions::GetOutputFile() const { 46 return m_file; 47 } 48 Clear()49void SaveCoreOptions::Clear() { 50 m_file = std::nullopt; 51 m_plugin_name = std::nullopt; 52 m_style = std::nullopt; 53 } 54