GetEmulateInstructionCreateCallbackForPluginName(ConstString name);
// OperatingSystem
- static bool RegisterPlugin(ConstString name, const char *description,
+ static bool RegisterPlugin(llvm::StringRef name, llvm::StringRef description,
OperatingSystemCreateInstance create_callback,
DebuggerInitializeCallback debugger_init_callback);
GetOperatingSystemCreateCallbackAtIndex(uint32_t idx);
static OperatingSystemCreateInstance
- GetOperatingSystemCreateCallbackForPluginName(ConstString name);
+ GetOperatingSystemCreateCallbackForPluginName(llvm::StringRef name);
// Language
static bool RegisterPlugin(ConstString name, const char *description,
// ObjectFile
static bool
- RegisterPlugin(ConstString name, const char *description,
+ RegisterPlugin(llvm::StringRef name, llvm::StringRef description,
ObjectFileCreateInstance create_callback,
ObjectFileCreateMemoryInstance create_memory_callback,
ObjectFileGetModuleSpecifications get_module_specifications,
GetObjectFileGetModuleSpecificationsCallbackAtIndex(uint32_t idx);
static ObjectFileCreateMemoryInstance
- GetObjectFileCreateMemoryCallbackForPluginName(ConstString name);
+ GetObjectFileCreateMemoryCallbackForPluginName(llvm::StringRef name);
static Status SaveCore(const lldb::ProcessSP &process_sp,
const FileSpec &outfile,
lldb::SaveCoreStyle &core_style,
- const ConstString plugin_name);
+ llvm::StringRef plugin_name);
// ObjectContainer
static bool
- RegisterPlugin(ConstString name, const char *description,
+ RegisterPlugin(llvm::StringRef name, llvm::StringRef description,
ObjectContainerCreateInstance create_callback,
ObjectFileGetModuleSpecifications get_module_specifications);
FileSpec core_file(file_name);
SaveCoreStyle core_style = SaveCoreStyle::eSaveCoreFull;
- error.ref() =
- PluginManager::SaveCore(process_sp, core_file, core_style, ConstString());
+ error.ref() = PluginManager::SaveCore(process_sp, core_file, core_style, "");
return LLDB_RECORD_RESULT(error);
}
switch (short_option) {
case 'p':
- m_requested_plugin_name.SetString(option_arg);
+ m_requested_plugin_name = option_arg.str();
break;
case 's':
m_requested_save_core_style =
void OptionParsingStarting(ExecutionContext *execution_context) override {
m_requested_save_core_style = eSaveCoreUnspecified;
- m_requested_plugin_name.Clear();
+ m_requested_plugin_name.clear();
}
// Instance variables to hold the values for command options.
SaveCoreStyle m_requested_save_core_style;
- ConstString m_requested_plugin_name;
+ std::string m_requested_plugin_name;
};
protected:
}
bool PluginManager::RegisterPlugin(
- ConstString name, const char *description,
+ llvm::StringRef name, llvm::StringRef description,
OperatingSystemCreateInstance create_callback,
DebuggerInitializeCallback debugger_init_callback) {
return GetOperatingSystemInstances().RegisterPlugin(
- name, description, create_callback, debugger_init_callback);
+ ConstString(name), description.str().c_str(), create_callback,
+ debugger_init_callback);
}
bool PluginManager::UnregisterPlugin(
}
OperatingSystemCreateInstance
-PluginManager::GetOperatingSystemCreateCallbackForPluginName(ConstString name) {
- return GetOperatingSystemInstances().GetCallbackForName(name);
+PluginManager::GetOperatingSystemCreateCallbackForPluginName(
+ llvm::StringRef name) {
+ return GetOperatingSystemInstances().GetCallbackForName(ConstString(name));
}
#pragma mark Language
}
bool PluginManager::RegisterPlugin(
- ConstString name, const char *description,
+ llvm::StringRef name, llvm::StringRef description,
ObjectFileCreateInstance create_callback,
ObjectFileCreateMemoryInstance create_memory_callback,
ObjectFileGetModuleSpecifications get_module_specifications,
ObjectFileSaveCore save_core) {
return GetObjectFileInstances().RegisterPlugin(
- name, description, create_callback, create_memory_callback,
- get_module_specifications, save_core);
+ ConstString(name), description.str().c_str(), create_callback,
+ create_memory_callback, get_module_specifications, save_core);
}
bool PluginManager::UnregisterPlugin(ObjectFileCreateInstance create_callback) {
ObjectFileCreateMemoryInstance
PluginManager::GetObjectFileCreateMemoryCallbackForPluginName(
- ConstString name) {
- if (!name)
- return nullptr;
+ llvm::StringRef name) {
const auto &instances = GetObjectFileInstances().GetInstances();
for (auto &instance : instances) {
- if (instance.name == name)
+ if (instance.name.GetStringRef() == name)
return instance.create_memory_callback;
}
return nullptr;
Status PluginManager::SaveCore(const lldb::ProcessSP &process_sp,
const FileSpec &outfile,
lldb::SaveCoreStyle &core_style,
- const ConstString plugin_name) {
- if (!plugin_name) {
+ llvm::StringRef plugin_name) {
+ if (plugin_name.empty()) {
// Try saving core directly from the process plugin first.
llvm::Expected<bool> ret = process_sp->SaveCore(outfile.GetPath());
if (!ret)
Status error;
auto &instances = GetObjectFileInstances().GetInstances();
for (auto &instance : instances) {
- if (plugin_name && instance.name != plugin_name)
+ if (instance.name.GetStringRef() != plugin_name)
continue;
if (instance.save_core &&
instance.save_core(process_sp, outfile, core_style, error))
}
bool PluginManager::RegisterPlugin(
- ConstString name, const char *description,
+ llvm::StringRef name, llvm::StringRef description,
ObjectContainerCreateInstance create_callback,
ObjectFileGetModuleSpecifications get_module_specifications) {
return GetObjectContainerInstances().RegisterPlugin(
- name, description, create_callback, get_module_specifications);
+ ConstString(name), description.str().c_str(), create_callback,
+ get_module_specifications);
}
bool PluginManager::UnregisterPlugin(
PluginManager::UnregisterPlugin(CreateInstance);
}
-lldb_private::ConstString ObjectContainerBSDArchive::GetPluginNameStatic() {
- static ConstString g_name("bsd-archive");
- return g_name;
-}
-
-const char *ObjectContainerBSDArchive::GetPluginDescriptionStatic() {
- return "BSD Archive object container reader.";
-}
-
ObjectContainer *ObjectContainerBSDArchive::CreateInstance(
const lldb::ModuleSP &module_sp, DataBufferSP &data_sp,
lldb::offset_t data_offset, const FileSpec *file,
static void Terminate();
- static lldb_private::ConstString GetPluginNameStatic();
+ static llvm::StringRef GetPluginNameStatic() { return "bsd-archive"; }
- static const char *GetPluginDescriptionStatic();
+ static llvm::StringRef GetPluginDescriptionStatic() {
+ return "BSD Archive object container reader.";
+ }
static lldb_private::ObjectContainer *
CreateInstance(const lldb::ModuleSP &module_sp, lldb::DataBufferSP &data_sp,
lldb::ObjectFileSP GetObjectFile(const lldb_private::FileSpec *file) override;
// PluginInterface protocol
- llvm::StringRef GetPluginName() override {
- return GetPluginNameStatic().GetStringRef();
- }
+ llvm::StringRef GetPluginName() override { return GetPluginNameStatic(); }
protected:
struct Object {
PluginManager::UnregisterPlugin(CreateInstance);
}
-lldb_private::ConstString ObjectContainerUniversalMachO::GetPluginNameStatic() {
- static ConstString g_name("mach-o");
- return g_name;
-}
-
-const char *ObjectContainerUniversalMachO::GetPluginDescriptionStatic() {
- return "Universal mach-o object container reader.";
-}
-
ObjectContainer *ObjectContainerUniversalMachO::CreateInstance(
const lldb::ModuleSP &module_sp, DataBufferSP &data_sp,
lldb::offset_t data_offset, const FileSpec *file,
static void Terminate();
- static lldb_private::ConstString GetPluginNameStatic();
+ static llvm::StringRef GetPluginNameStatic() { return "mach-o"; }
- static const char *GetPluginDescriptionStatic();
+ static llvm::StringRef GetPluginDescriptionStatic() {
+ return "Universal mach-o object container reader.";
+ }
static lldb_private::ObjectContainer *
CreateInstance(const lldb::ModuleSP &module_sp, lldb::DataBufferSP &data_sp,
lldb::ObjectFileSP GetObjectFile(const lldb_private::FileSpec *file) override;
// PluginInterface protocol
- llvm::StringRef GetPluginName() override {
- return GetPluginNameStatic().GetStringRef();
- }
+ llvm::StringRef GetPluginName() override { return GetPluginNameStatic(); }
protected:
llvm::MachO::fat_header m_header;
PluginManager::UnregisterPlugin(CreateInstance);
}
-ConstString ObjectFileBreakpad::GetPluginNameStatic() {
- static ConstString g_name("breakpad");
- return g_name;
-}
-
ObjectFile *ObjectFileBreakpad::CreateInstance(
const ModuleSP &module_sp, DataBufferSP &data_sp, offset_t data_offset,
const FileSpec *file, offset_t file_offset, offset_t length) {
static void Initialize();
static void Terminate();
- static ConstString GetPluginNameStatic();
+ static llvm::StringRef GetPluginNameStatic() { return "breakpad"; }
static const char *GetPluginDescriptionStatic() {
return "Breakpad object file reader.";
}
ModuleSpecList &specs);
// PluginInterface protocol
- llvm::StringRef GetPluginName() override {
- return GetPluginNameStatic().GetStringRef();
- }
+ llvm::StringRef GetPluginName() override { return GetPluginNameStatic(); }
// LLVM RTTI support
static char ID;
PluginManager::UnregisterPlugin(CreateInstance);
}
-lldb_private::ConstString ObjectFileELF::GetPluginNameStatic() {
- static ConstString g_name("elf");
- return g_name;
-}
-
-const char *ObjectFileELF::GetPluginDescriptionStatic() {
- return "ELF object file reader.";
-}
-
ObjectFile *ObjectFileELF::CreateInstance(const lldb::ModuleSP &module_sp,
DataBufferSP &data_sp,
lldb::offset_t data_offset,
static void Terminate();
- static lldb_private::ConstString GetPluginNameStatic();
+ static llvm::StringRef GetPluginNameStatic() { return "elf"; }
- static const char *GetPluginDescriptionStatic();
+ static llvm::StringRef GetPluginDescriptionStatic() {
+ return "ELF object file reader.";
+ }
static lldb_private::ObjectFile *
CreateInstance(const lldb::ModuleSP &module_sp, lldb::DataBufferSP &data_sp,
lldb::addr_t length);
// PluginInterface protocol
- llvm::StringRef GetPluginName() override {
- return GetPluginNameStatic().GetStringRef();
- }
+ llvm::StringRef GetPluginName() override { return GetPluginNameStatic(); }
// LLVM RTTI support
static char ID;
PluginManager::UnregisterPlugin(CreateInstance);
}
-lldb_private::ConstString ObjectFileJIT::GetPluginNameStatic() {
- static ConstString g_name("jit");
- return g_name;
-}
-
-const char *ObjectFileJIT::GetPluginDescriptionStatic() {
- return "JIT code object file";
-}
-
ObjectFile *ObjectFileJIT::CreateInstance(const lldb::ModuleSP &module_sp,
DataBufferSP &data_sp,
lldb::offset_t data_offset,
static void Terminate();
- static lldb_private::ConstString GetPluginNameStatic();
+ static llvm::StringRef GetPluginNameStatic() { return "jit"; }
- static const char *GetPluginDescriptionStatic();
+ static llvm::StringRef GetPluginDescriptionStatic() {
+ return "JIT code object file";
+ }
static lldb_private::ObjectFile *
CreateInstance(const lldb::ModuleSP &module_sp, lldb::DataBufferSP &data_sp,
ObjectFile::Strata CalculateStrata() override;
// PluginInterface protocol
- llvm::StringRef GetPluginName() override {
- return GetPluginNameStatic().GetStringRef();
- }
+ llvm::StringRef GetPluginName() override { return GetPluginNameStatic(); }
protected:
lldb::ObjectFileJITDelegateWP m_delegate_wp;
PluginManager::UnregisterPlugin(CreateInstance);
}
-lldb_private::ConstString ObjectFileMachO::GetPluginNameStatic() {
- static ConstString g_name("mach-o");
- return g_name;
-}
-
-const char *ObjectFileMachO::GetPluginDescriptionStatic() {
- return "Mach-o object file reader (32 and 64 bit)";
-}
-
ObjectFile *ObjectFileMachO::CreateInstance(const lldb::ModuleSP &module_sp,
DataBufferSP &data_sp,
lldb::offset_t data_offset,
static void Terminate();
- static lldb_private::ConstString GetPluginNameStatic();
+ static llvm::StringRef GetPluginNameStatic() { return "mach-o"; }
- static const char *GetPluginDescriptionStatic();
+ static llvm::StringRef GetPluginDescriptionStatic() {
+ return "Mach-o object file reader (32 and 64 bit)";
+ }
static lldb_private::ObjectFile *
CreateInstance(const lldb::ModuleSP &module_sp, lldb::DataBufferSP &data_sp,
bool AllowAssemblyEmulationUnwindPlans() override;
// PluginInterface protocol
- llvm::StringRef GetPluginName() override {
- return GetPluginNameStatic().GetStringRef();
- }
+ llvm::StringRef GetPluginName() override { return GetPluginNameStatic(); }
protected:
static lldb_private::UUID
PluginManager::UnregisterPlugin(CreateInstance);
}
-ConstString ObjectFileMinidump::GetPluginNameStatic() {
- static ConstString g_name("minidump");
- return g_name;
-}
-
ObjectFile *ObjectFileMinidump::CreateInstance(
const lldb::ModuleSP &module_sp, lldb::DataBufferSP &data_sp,
lldb::offset_t data_offset, const lldb_private::FileSpec *file,
static void Initialize();
static void Terminate();
- static lldb_private::ConstString GetPluginNameStatic();
+ static llvm::StringRef GetPluginNameStatic() { return "minidump"; }
static const char *GetPluginDescriptionStatic() {
return "Minidump object file.";
}
// PluginInterface protocol
- llvm::StringRef GetPluginName() override {
- return GetPluginNameStatic().GetStringRef();
- }
+ llvm::StringRef GetPluginName() override { return GetPluginNameStatic(); }
static lldb_private::ObjectFile *
CreateInstance(const lldb::ModuleSP &module_sp, lldb::DataBufferSP &data_sp,
PluginManager::UnregisterPlugin(CreateInstance);
}
-ConstString ObjectFilePDB::GetPluginNameStatic() {
- static ConstString g_name("pdb");
- return g_name;
-}
-
ArchSpec ObjectFilePDB::GetArchitecture() {
auto dbi_stream = m_file_up->getPDBDbiStream();
if (!dbi_stream) {
static void Initialize();
static void Terminate();
- static ConstString GetPluginNameStatic();
+ static llvm::StringRef GetPluginNameStatic() { return "pdb"; }
static const char *GetPluginDescriptionStatic() {
return "PDB object file reader.";
}
ModuleSpecList &specs);
// PluginInterface protocol
- llvm::StringRef GetPluginName() override {
- return GetPluginNameStatic().GetStringRef();
- }
+ llvm::StringRef GetPluginName() override { return GetPluginNameStatic(); }
// LLVM RTTI support
static char ID;
PluginManager::UnregisterPlugin(CreateInstance);
}
-lldb_private::ConstString ObjectFilePECOFF::GetPluginNameStatic() {
- static ConstString g_name("pe-coff");
- return g_name;
-}
-
-const char *ObjectFilePECOFF::GetPluginDescriptionStatic() {
+llvm::StringRef ObjectFilePECOFF::GetPluginDescriptionStatic() {
return "Portable Executable and Common Object File Format object file reader "
"(32 and 64 bit)";
}
static void Terminate();
- static lldb_private::ConstString GetPluginNameStatic();
+ static llvm::StringRef GetPluginNameStatic() { return "pe-coff"; }
- static const char *GetPluginDescriptionStatic();
+ static llvm::StringRef GetPluginDescriptionStatic();
static ObjectFile *
CreateInstance(const lldb::ModuleSP &module_sp, lldb::DataBufferSP &data_sp,
ObjectFile::Strata CalculateStrata() override;
// PluginInterface protocol
- llvm::StringRef GetPluginName() override {
- return GetPluginNameStatic().GetStringRef();
- }
+ llvm::StringRef GetPluginName() override { return GetPluginNameStatic(); }
bool IsWindowsSubsystem();
PluginManager::UnregisterPlugin(CreateInstance);
}
-ConstString ObjectFileWasm::GetPluginNameStatic() {
- static ConstString g_name("wasm");
- return g_name;
-}
-
ObjectFile *
ObjectFileWasm::CreateInstance(const ModuleSP &module_sp, DataBufferSP &data_sp,
offset_t data_offset, const FileSpec *file,
static void Initialize();
static void Terminate();
- static ConstString GetPluginNameStatic();
+ static llvm::StringRef GetPluginNameStatic() { return "wasm"; }
static const char *GetPluginDescriptionStatic() {
return "WebAssembly object file reader.";
}
/// PluginInterface protocol.
/// \{
- llvm::StringRef GetPluginName() override {
- return GetPluginNameStatic().GetStringRef();
- }
+ llvm::StringRef GetPluginName() override { return GetPluginNameStatic(); }
/// \}
/// LLVM RTTI support
return nullptr;
}
-ConstString OperatingSystemPython::GetPluginNameStatic() {
- static ConstString g_name("python");
- return g_name;
-}
-
-const char *OperatingSystemPython::GetPluginDescriptionStatic() {
+llvm::StringRef OperatingSystemPython::GetPluginDescriptionStatic() {
return "Operating system plug-in that gathers OS information from a python "
"class that implements the necessary OperatingSystem functionality.";
}
static void Terminate();
- static lldb_private::ConstString GetPluginNameStatic();
+ static llvm::StringRef GetPluginNameStatic() { return "python"; }
- static const char *GetPluginDescriptionStatic();
+ static llvm::StringRef GetPluginDescriptionStatic();
// lldb_private::PluginInterface Methods
- llvm::StringRef GetPluginName() override {
- return GetPluginNameStatic().GetStringRef();
- }
+ llvm::StringRef GetPluginName() override { return GetPluginNameStatic(); }
// lldb_private::OperatingSystem Methods
bool UpdateThreadList(lldb_private::ThreadList &old_thread_list,
const char *plugin_name) {
OperatingSystemCreateInstance create_callback = nullptr;
if (plugin_name) {
- ConstString const_plugin_name(plugin_name);
create_callback =
PluginManager::GetOperatingSystemCreateCallbackForPluginName(
- const_plugin_name);
+ plugin_name);
if (create_callback) {
std::unique_ptr<OperatingSystem> instance_up(
create_callback(process, true));