diff options
102 files changed, 653 insertions, 881 deletions
diff --git a/lldb/include/lldb/API/SBProcess.h b/lldb/include/lldb/API/SBProcess.h index 288d7d0290d..784f362122a 100644 --- a/lldb/include/lldb/API/SBProcess.h +++ b/lldb/include/lldb/API/SBProcess.h @@ -51,6 +51,7 @@ public: const char * GetPluginName (); + // DEPRECATED: use GetPluginName() const char * GetShortPluginName (); diff --git a/lldb/include/lldb/Core/Log.h b/lldb/include/lldb/Core/Log.h index dafb5b5aa51..ced6f2565d9 100644 --- a/lldb/include/lldb/Core/Log.h +++ b/lldb/include/lldb/Core/Log.h @@ -78,14 +78,14 @@ public: // Static accessors for logging channels //------------------------------------------------------------------ static void - RegisterLogChannel (const char *channel, + RegisterLogChannel (const ConstString &channel, const Log::Callbacks &log_callbacks); static bool - UnregisterLogChannel (const char *channel); + UnregisterLogChannel (const ConstString &channel); static bool - GetLogChannelCallbacks (const char *channel, + GetLogChannelCallbacks (const ConstString &channel, Log::Callbacks &log_callbacks); diff --git a/lldb/include/lldb/Core/Module.h b/lldb/include/lldb/Core/Module.h index 9b59703135a..7ba9856fbeb 100644 --- a/lldb/include/lldb/Core/Module.h +++ b/lldb/include/lldb/Core/Module.h @@ -88,7 +88,8 @@ public: Module (const FileSpec& file_spec, const ArchSpec& arch, const ConstString *object_name = NULL, - off_t object_offset = 0); + off_t object_offset = 0, + const TimeValue *object_mod_time_ptr = NULL); Module (const ModuleSpec &module_spec); //------------------------------------------------------------------ @@ -552,8 +553,23 @@ public: SetSymbolFileFileSpec (const FileSpec &file); const TimeValue & - GetModificationTime () const; - + GetModificationTime () const + { + return m_mod_time; + } + + const TimeValue & + GetObjectModificationTime () const + { + return m_object_mod_time; + } + + void + SetObjectModificationTime (const TimeValue &mod_time) + { + m_mod_time = mod_time; + } + //------------------------------------------------------------------ /// Tells whether this module is capable of being the main executable /// for a process. @@ -963,6 +979,7 @@ protected: FileSpec m_symfile_spec; ///< If this path is valid, then this is the file that _will_ be used as the symbol file for this module ConstString m_object_name; ///< The name an object within this module that is selected, or empty of the module is represented by \a m_file. uint64_t m_object_offset; + TimeValue m_object_mod_time; lldb::ObjectFileSP m_objfile_sp; ///< A shared pointer to the object file parser for this module as it may or may not be shared with the SymbolFile std::unique_ptr<SymbolVendor> m_symfile_ap; ///< A pointer to the symbol vendor for this module. ClangASTContext m_ast; ///< The AST context for this module. diff --git a/lldb/include/lldb/Core/ModuleSpec.h b/lldb/include/lldb/Core/ModuleSpec.h index 52e9499b464..9882b243ca4 100644 --- a/lldb/include/lldb/Core/ModuleSpec.h +++ b/lldb/include/lldb/Core/ModuleSpec.h @@ -28,6 +28,7 @@ public: m_uuid (), m_object_name (), m_object_offset (0), + m_object_mod_time (), m_source_mappings () { } @@ -40,6 +41,7 @@ public: m_uuid (), m_object_name (), m_object_offset (0), + m_object_mod_time (), m_source_mappings () { } @@ -52,6 +54,7 @@ public: m_uuid (), m_object_name (), m_object_offset (0), + m_object_mod_time (), m_source_mappings () { } @@ -64,6 +67,7 @@ public: m_uuid (rhs.m_uuid), m_object_name (rhs.m_object_name), m_object_offset (rhs.m_object_offset), + m_object_mod_time (rhs.m_object_mod_time), m_source_mappings (rhs.m_source_mappings) { } @@ -80,6 +84,7 @@ public: m_uuid = rhs.m_uuid; m_object_name = rhs.m_object_name; m_object_offset = rhs.m_object_offset; + m_object_mod_time = rhs.m_object_mod_time; m_source_mappings = rhs.m_source_mappings; } return *this; @@ -248,6 +253,18 @@ public: { m_object_offset = object_offset; } + + TimeValue & + GetObjectModificationTime () + { + return m_object_mod_time; + } + + const TimeValue & + GetObjectModificationTime () const + { + return m_object_mod_time; + } PathMappingList & GetSourceMappingList () const @@ -266,6 +283,7 @@ public: m_object_name.Clear(); m_object_offset = 0; m_source_mappings.Clear(false); + m_object_mod_time.Clear(); } protected: @@ -276,6 +294,7 @@ protected: UUID m_uuid; ConstString m_object_name; uint64_t m_object_offset; + TimeValue m_object_mod_time; mutable PathMappingList m_source_mappings; }; diff --git a/lldb/include/lldb/Core/PluginInterface.h b/lldb/include/lldb/Core/PluginInterface.h index 97f6a37556e..19371ca9860 100644 --- a/lldb/include/lldb/Core/PluginInterface.h +++ b/lldb/include/lldb/Core/PluginInterface.h @@ -24,12 +24,9 @@ public: virtual ~PluginInterface () {} - virtual const char * + virtual ConstString GetPluginName() = 0; - virtual const char * - GetShortPluginName() = 0; - virtual uint32_t GetPluginVersion() = 0; diff --git a/lldb/include/lldb/Core/PluginManager.h b/lldb/include/lldb/Core/PluginManager.h index 93f2c32a7aa..c13a85830c0 100644 --- a/lldb/include/lldb/Core/PluginManager.h +++ b/lldb/include/lldb/Core/PluginManager.h @@ -29,7 +29,7 @@ public: // ABI //------------------------------------------------------------------ static bool - RegisterPlugin (const char *name, + RegisterPlugin (const ConstString &name, const char *description, ABICreateInstance create_callback); @@ -40,14 +40,14 @@ public: GetABICreateCallbackAtIndex (uint32_t idx); static ABICreateInstance - GetABICreateCallbackForPluginName (const char *name); + GetABICreateCallbackForPluginName (const ConstString &name); //------------------------------------------------------------------ // Disassembler //------------------------------------------------------------------ static bool - RegisterPlugin (const char *name, + RegisterPlugin (const ConstString &name, const char *description, DisassemblerCreateInstance create_callback); @@ -58,14 +58,14 @@ public: GetDisassemblerCreateCallbackAtIndex (uint32_t idx); static DisassemblerCreateInstance - GetDisassemblerCreateCallbackForPluginName (const char *name); + GetDisassemblerCreateCallbackForPluginName (const ConstString &name); //------------------------------------------------------------------ // DynamicLoader //------------------------------------------------------------------ static bool - RegisterPlugin (const char *name, + RegisterPlugin (const ConstString &name, const char *description, DynamicLoaderCreateInstance create_callback, DebuggerInitializeCallback debugger_init_callback = NULL); @@ -77,13 +77,13 @@ public: GetDynamicLoaderCreateCallbackAtIndex (uint32_t idx); static DynamicLoaderCreateInstance - GetDynamicLoaderCreateCallbackForPluginName (const char *name); + GetDynamicLoaderCreateCallbackForPluginName (const ConstString &name); //------------------------------------------------------------------ // EmulateInstruction //------------------------------------------------------------------ static bool - RegisterPlugin (const char *name, + RegisterPlugin (const ConstString &name, const char *description, EmulateInstructionCreateInstance create_callback); @@ -94,13 +94,13 @@ public: GetEmulateInstructionCreateCallbackAtIndex (uint32_t idx); static EmulateInstructionCreateInstance - GetEmulateInstructionCreateCallbackForPluginName (const char *name); + GetEmulateInstructionCreateCallbackForPluginName (const ConstString &name); //------------------------------------------------------------------ // OperatingSystem //------------------------------------------------------------------ static bool - RegisterPlugin (const char *name, + RegisterPlugin (const ConstString &name, const char *description, OperatingSystemCreateInstance create_callback); @@ -111,13 +111,13 @@ public: GetOperatingSystemCreateCallbackAtIndex (uint32_t idx); static OperatingSystemCreateInstance - GetOperatingSystemCreateCallbackForPluginName (const char *name); + GetOperatingSystemCreateCallbackForPluginName (const ConstString &name); //------------------------------------------------------------------ // LanguageRuntime //------------------------------------------------------------------ static bool - RegisterPlugin (const char *name, + RegisterPlugin (const ConstString &name, const char *description, LanguageRuntimeCreateInstance create_callback); @@ -128,14 +128,14 @@ public: GetLanguageRuntimeCreateCallbackAtIndex (uint32_t idx); static LanguageRuntimeCreateInstance - GetLanguageRuntimeCreateCallbackForPluginName (const char *name); + GetLanguageRuntimeCreateCallbackForPluginName (const ConstString &name); //------------------------------------------------------------------ // ObjectFile //------------------------------------------------------------------ static bool - RegisterPlugin (const char *name, + RegisterPlugin (const ConstString &name, const char *description, ObjectFileCreateInstance create_callback, ObjectFileCreateMemoryInstance create_memory_callback, @@ -154,17 +154,17 @@ public: GetObjectFileGetModuleSpecificationsCallbackAtIndex (uint32_t idx); static ObjectFileCreateInstance - GetObjectFileCreateCallbackForPluginName (const char *name); + GetObjectFileCreateCallbackForPluginName (const ConstString &name); static ObjectFileCreateMemoryInstance - GetObjectFileCreateMemoryCallbackForPluginName (const char *name); + GetObjectFileCreateMemoryCallbackForPluginName (const ConstString &name); //------------------------------------------------------------------ // ObjectContainer //------------------------------------------------------------------ static bool - RegisterPlugin (const char *name, + RegisterPlugin (const ConstString &name, const char *description, ObjectContainerCreateInstance create_callback, ObjectFileGetModuleSpecifications get_module_specifications); @@ -176,7 +176,7 @@ public: GetObjectContainerCreateCallbackAtIndex (uint32_t idx); static ObjectContainerCreateInstance - GetObjectContainerCreateCallbackForPluginName (const char *name); + GetObjectContainerCreateCallbackForPluginName (const ConstString &name); static ObjectFileGetModuleSpecifications GetObjectContainerGetModuleSpecificationsCallbackAtIndex (uint32_t idx); @@ -185,7 +185,7 @@ public: // LogChannel //------------------------------------------------------------------ static bool - RegisterPlugin (const char *name, + RegisterPlugin (const ConstString &name, const char *description, LogChannelCreateInstance create_callback); @@ -196,7 +196,7 @@ public: GetLogChannelCreateCallbackAtIndex (uint32_t idx); static LogChannelCreateInstance - GetLogChannelCreateCallbackForPluginName (const char *name); + GetLogChannelCreateCallbackForPluginName (const ConstString &name); static const char * GetLogChannelCreateNameAtIndex (uint32_t idx); @@ -205,7 +205,7 @@ public: // Platform //------------------------------------------------------------------ static bool - RegisterPlugin (const char *name, + RegisterPlugin (const ConstString &name, const char *description, PlatformCreateInstance create_callback, DebuggerInitializeCallback debugger_init_callback = NULL); @@ -217,7 +217,7 @@ public: GetPlatformCreateCallbackAtIndex (uint32_t idx); static PlatformCreateInstance - GetPlatformCreateCallbackForPluginName (const char *name); + GetPlatformCreateCallbackForPluginName (const ConstString &name); static const char * GetPlatformPluginNameAtIndex (uint32_t idx); @@ -232,7 +232,7 @@ public: // Process //------------------------------------------------------------------ static bool - RegisterPlugin (const char *name, + RegisterPlugin (const ConstString &name, const char *description, ProcessCreateInstance create_callback); @@ -243,7 +243,7 @@ public: GetProcessCreateCallbackAtIndex (uint32_t idx); static ProcessCreateInstance - GetProcessCreateCallbackForPluginName (const char *name); + GetProcessCreateCallbackForPluginName (const ConstString &name); static const char * GetProcessPluginNameAtIndex (uint32_t idx); @@ -255,7 +255,7 @@ public: // SymbolFile //------------------------------------------------------------------ static bool - RegisterPlugin (const char *name, + RegisterPlugin (const ConstString &name, const char *description, SymbolFileCreateInstance create_callback); @@ -266,14 +266,14 @@ public: GetSymbolFileCreateCallbackAtIndex (uint32_t idx); static SymbolFileCreateInstance - GetSymbolFileCreateCallbackForPluginName (const char *name); + GetSymbolFileCreateCallbackForPluginName (const ConstString &name); //------------------------------------------------------------------ // SymbolVendor //------------------------------------------------------------------ static bool - RegisterPlugin (const char *name, + RegisterPlugin (const ConstString &name, const char *description, SymbolVendorCreateInstance create_callback); @@ -284,13 +284,13 @@ public: GetSymbolVendorCreateCallbackAtIndex (uint32_t idx); static SymbolVendorCreateInstance - GetSymbolVendorCreateCallbackForPluginName (const char *name); + GetSymbolVendorCreateCallbackForPluginName (const ConstString &name); //------------------------------------------------------------------ // UnwindAssembly //------------------------------------------------------------------ static bool - RegisterPlugin (const char *name, + RegisterPlugin (const ConstString &name, const char *description, UnwindAssemblyCreateInstance create_callback); @@ -301,7 +301,7 @@ public: GetUnwindAssemblyCreateCallbackAtIndex (uint32_t idx); static UnwindAssemblyCreateInstance - GetUnwindAssemblyCreateCallbackForPluginName (const char *name); + GetUnwindAssemblyCreateCallbackForPluginName (const ConstString &name); //------------------------------------------------------------------ // Some plug-ins might register a DebuggerInitializeCallback diff --git a/lldb/include/lldb/Symbol/SymbolVendor.h b/lldb/include/lldb/Symbol/SymbolVendor.h index 9567c514ebd..4c17e0f55cd 100644 --- a/lldb/include/lldb/Symbol/SymbolVendor.h +++ b/lldb/include/lldb/Symbol/SymbolVendor.h @@ -36,15 +36,6 @@ class SymbolVendor : public PluginInterface { public: - static bool - RegisterPlugin (const char *name, - const char *description, - SymbolVendorCreateInstance create_callback); - - static bool - UnregisterPlugin (SymbolVendorCreateInstance create_callback); - - static SymbolVendor* FindPlugin (const lldb::ModuleSP &module_sp, lldb_private::Stream *feedback_strm); @@ -171,12 +162,9 @@ public: //------------------------------------------------------------------ // PluginInterface protocol //------------------------------------------------------------------ - virtual const char * + virtual lldb_private::ConstString GetPluginName(); - virtual const char * - GetShortPluginName(); - virtual uint32_t GetPluginVersion(); diff --git a/lldb/include/lldb/Target/Platform.h b/lldb/include/lldb/Target/Platform.h index e7e6dd5242f..b0a07946e74 100644 --- a/lldb/include/lldb/Target/Platform.h +++ b/lldb/include/lldb/Target/Platform.h @@ -108,7 +108,7 @@ namespace lldb_private { /// should be used. If NULL, pick the best plug-in. //------------------------------------------------------------------ static Platform* - FindPlugin (Process *process, const char *plugin_name); + FindPlugin (Process *process, const ConstString &plugin_name); //------------------------------------------------------------------ /// Set the target's executable based off of the existing @@ -215,7 +215,7 @@ namespace lldb_private { // Returns the the hostname if we are connected, else the short plugin // name. - const char * + ConstString GetName (); virtual const char * diff --git a/lldb/include/lldb/Target/Process.h b/lldb/include/lldb/Target/Process.h index 9190ec80eef..97a39959428 100644 --- a/lldb/include/lldb/Target/Process.h +++ b/lldb/include/lldb/Target/Process.h @@ -1747,7 +1747,7 @@ public: DoLoadCore () { Error error; - error.SetErrorStringWithFormat("error: %s does not support loading core files.", GetShortPluginName()); + error.SetErrorStringWithFormat("error: %s does not support loading core files.", GetPluginName().GetCString()); return error; } @@ -2059,7 +2059,7 @@ public: DoAttachToProcessWithID (lldb::pid_t pid) { Error error; - error.SetErrorStringWithFormat("error: %s does not support attaching to a process by pid", GetShortPluginName()); + error.SetErrorStringWithFormat("error: %s does not support attaching to a process by pid", GetPluginName().GetCString()); return error; } @@ -2082,7 +2082,7 @@ public: DoAttachToProcessWithID (lldb::pid_t pid, const ProcessAttachInfo &attach_info) { Error error; - error.SetErrorStringWithFormat("error: %s does not support attaching to a process by pid", GetShortPluginName()); + error.SetErrorStringWithFormat("error: %s does not support attaching to a process by pid", GetPluginName().GetCString()); return error; } @@ -2208,7 +2208,7 @@ public: const ProcessLaunchInfo &launch_info) { Error error; - error.SetErrorStringWithFormat("error: %s does not support launching processes", GetShortPluginName()); + error.SetErrorStringWithFormat("error: %s does not support launching processes", GetPluginName().GetCString()); return error; } @@ -2257,7 +2257,7 @@ public: DoResume () { Error error; - error.SetErrorStringWithFormat("error: %s does not support resuming processes", GetShortPluginName()); + error.SetErrorStringWithFormat("error: %s does not support resuming processes", GetPluginName().GetCString()); return error; } @@ -2306,7 +2306,7 @@ public: DoHalt (bool &caused_stop) { Error error; - error.SetErrorStringWithFormat("error: %s does not support halting processes", GetShortPluginName()); + error.SetErrorStringWithFormat("error: %s does not support halting processes", GetPluginName().GetCString()); return error; } @@ -2346,7 +2346,7 @@ public: DoDetach (bool keep_stopped) { Error error; - error.SetErrorStringWithFormat("error: %s does not support detaching from processes", GetShortPluginName()); + error.SetErrorStringWithFormat("error: %s does not support detaching from processes", GetPluginName().GetCString()); return error; } @@ -2387,7 +2387,7 @@ public: DoSignal (int signal) { Error error; - error.SetErrorStringWithFormat("error: %s does not support senging signals to processes", GetShortPluginName()); + error.SetErrorStringWithFormat("error: %s does not support senging signals to processes", GetPluginName().GetCString()); return error; } @@ -2817,7 +2817,7 @@ public: virtual size_t DoWriteMemory (lldb::addr_t vm_addr, const void *buf, size_t size, Error &error) { - error.SetErrorStringWithFormat("error: %s does not support writing to processes", GetShortPluginName()); + error.SetErrorStringWithFormat("error: %s does not support writing to processes", GetPluginName().GetCString()); return 0; } @@ -2914,7 +2914,7 @@ public: virtual lldb::addr_t DoAllocateMemory (size_t size, uint32_t permissions, Error &error) { - error.SetErrorStringWithFormat("error: %s does not support allocating in the debug process", GetShortPluginName()); + error.SetErrorStringWithFormat("error: %s does not support allocating in the debug process", GetPluginName().GetCString()); return LLDB_INVALID_ADDRESS; } @@ -2963,7 +2963,7 @@ public: virtual lldb::addr_t ResolveIndirectFunction(const Address *address, Error &error) { - error.SetErrorStringWithFormat("error: %s does not support indirect functions in the debug process", GetShortPluginName()); + error.SetErrorStringWithFormat("error: %s does not support indirect functions in the debug process", GetPluginName().GetCString()); return LLDB_INVALID_ADDRESS; } @@ -3084,7 +3084,7 @@ public: DoDeallocateMemory (lldb::addr_t ptr) { Error error; - error.SetErrorStringWithFormat("error: %s does not support deallocating in the debug process", GetShortPluginName()); + error.SetErrorStringWithFormat("error: %s does not support deallocating in the debug process", GetPluginName().GetCString()); return error; } @@ -3189,7 +3189,7 @@ public: EnableBreakpointSite (BreakpointSite *bp_site) { Error error; - error.SetErrorStringWithFormat("error: %s does not support enabling breakpoints", GetShortPluginName()); + error.SetErrorStringWithFormat("error: %s does not support enabling breakpoints", GetPluginName().GetCString()); return error; } @@ -3198,7 +3198,7 @@ public: DisableBreakpointSite (BreakpointSite *bp_site) { Error error; - error.SetErrorStringWithFormat("error: %s does not support disabling breakpoints", GetShortPluginName()); + error.SetErrorStringWithFormat("error: %s does not support disabling breakpoints", GetPluginName().GetCString()); return error; } diff --git a/lldb/source/API/SBProcess.cpp b/lldb/source/API/SBProcess.cpp index 6b4559a5035..d41ad6190d2 100644 --- a/lldb/source/API/SBProcess.cpp +++ b/lldb/source/API/SBProcess.cpp @@ -89,7 +89,7 @@ SBProcess::GetPluginName () ProcessSP process_sp(GetSP()); if (process_sp) { - return process_sp->GetPluginName(); + return process_sp->GetPluginName().GetCString(); } return "<Unknown>"; } @@ -100,7 +100,7 @@ SBProcess::GetShortPluginName () ProcessSP process_sp(GetSP()); if (process_sp) { - return process_sp->GetShortPluginName(); + return process_sp->GetPluginName().GetCString(); } return "<Unknown>"; } diff --git a/lldb/source/Commands/CommandObjectLog.cpp b/lldb/source/Commands/CommandObjectLog.cpp index 221c975bc99..5fb79154c4e 100644 --- a/lldb/source/Commands/CommandObjectLog.cpp +++ b/lldb/source/Commands/CommandObjectLog.cpp @@ -282,7 +282,7 @@ protected: std::string channel(args.GetArgumentAtIndex(0)); args.Shift (); // Shift off the channel - if (Log::GetLogChannelCallbacks (channel.c_str(), log_callbacks)) + if (Log::GetLogChannelCallbacks (ConstString(channel.c_str()), log_callbacks)) { log_callbacks.disable (args.GetConstArgumentVector(), &result.GetErrorStream()); result.SetStatus(eReturnStatusSuccessFinishNoResult); @@ -356,7 +356,7 @@ protected: Log::Callbacks log_callbacks; std::string channel(args.GetArgumentAtIndex(i)); - if (Log::GetLogChannelCallbacks (channel.c_str(), log_callbacks)) + if (Log::GetLogChannelCallbacks (ConstString(channel.c_str()), log_callbacks)) { log_callbacks.list_categories (&result.GetOutputStream()); result.SetStatus(eReturnStatusSuccessFinishResult); diff --git a/lldb/source/Commands/CommandObjectPlatform.cpp b/lldb/source/Commands/CommandObjectPlatform.cpp index 60bcece95d6..c2185e598ad 100644 --- a/lldb/source/Commands/CommandObjectPlatform.cpp +++ b/lldb/source/Commands/CommandObjectPlatform.cpp @@ -155,7 +155,7 @@ protected: PlatformSP host_platform_sp (Platform::GetDefaultPlatform()); ostrm.Printf ("%s: %s\n", - host_platform_sp->GetShortPluginName(), + host_platform_sp->GetPluginName().GetCString(), host_platform_sp->GetDescription()); uint32_t idx; @@ -326,7 +326,7 @@ protected: { Stream &ostrm = result.GetOutputStream(); if (hostname.empty()) - ostrm.Printf ("Disconnected from \"%s\"\n", platform_sp->GetShortPluginName()); + ostrm.Printf ("Disconnected from \"%s\"\n", platform_sp->GetPluginName().GetCString()); else ostrm.Printf ("Disconnected from \"%s\"\n", hostname.c_str()); result.SetStatus (eReturnStatusSuccessFinishResult); @@ -340,7 +340,7 @@ protected: else { // Not connected... - result.AppendErrorWithFormat ("not connected to '%s'", platform_sp->GetShortPluginName()); + result.AppendErrorWithFormat ("not connected to '%s'", platform_sp->GetPluginName().GetCString()); result.SetStatus (eReturnStatusFailed); } } @@ -570,9 +570,9 @@ protected: result.AppendErrorWithFormat ("no processes were found that %s \"%s\" on the \"%s\" platform\n", match_desc, match_name, - platform_sp->GetShortPluginName()); + platform_sp->GetPluginName().GetCString()); else - result.AppendErrorWithFormat ("no processes were found on the \"%s\" platform\n", platform_sp->GetShortPluginName()); + result.AppendErrorWithFormat ("no processes were found on the \"%s\" platform\n", platform_sp->GetPluginName().GetCString()); result.SetStatus (eReturnStatusFailed); } else @@ -580,7 +580,7 @@ protected: result.AppendMessageWithFormat ("%u matching process%s found on \"%s\"", matches, matches > 1 ? "es were" : " was", - platform_sp->GetName()); + platform_sp->GetName().GetCString()); if (match_desc) result.AppendMessageWithFormat (" whose name %s \"%s\"", match_desc, @@ -848,7 +848,7 @@ protected: else { // Not connected... - result.AppendErrorWithFormat ("not connected to '%s'", platform_sp->GetShortPluginName()); + result.AppendErrorWithFormat ("not connected to '%s'", platform_sp->GetPluginName().GetCString()); result.SetStatus (eReturnStatusFailed); } } diff --git a/lldb/source/Commands/CommandObjectTarget.cpp b/lldb/source/Commands/CommandObjectTarget.cpp index 522a4828624..0ad802d7a08 100644 --- a/lldb/source/Commands/CommandObjectTarget.cpp +++ b/lldb/source/Commands/CommandObjectTarget.cpp @@ -81,7 +81,7 @@ DumpTargetInfo (uint32_t target_idx, Target *target, const char *prefix_cstr, bo } PlatformSP platform_sp (target->GetPlatform()); if (platform_sp) - strm.Printf ("%splatform=%s", properties++ > 0 ? ", " : " ( ", platform_sp->GetName()); + strm.Printf ("%splatform=%s", properties++ > 0 ? ", " : " ( ", platform_sp->GetName().GetCString()); ProcessSP process_sp (target->GetProcessSP()); bool show_process_status = false; diff --git a/lldb/source/Core/Debugger.cpp b/lldb/source/Core/Debugger.cpp index 9e6fc2369de..7455f0058d0 100644 --- a/lldb/source/Core/Debugger.cpp +++ b/lldb/source/Core/Debugger.cpp @@ -2644,7 +2644,7 @@ Debugger::EnableLog (const char *channel, const char **categories, const char *l if (log_options == 0) log_options = LLDB_LOG_OPTION_PREPEND_THREAD_NAME | LLDB_LOG_OPTION_THREADSAFE; - if (Log::GetLogChannelCallbacks (channel, log_callbacks)) + if (Log::GetLogChannelCallbacks (ConstString(channel), log_callbacks)) { log_callbacks.enable (log_stream_sp, log_options, categories, &error_stream); return true; diff --git a/lldb/source/Core/Disassembler.cpp b/lldb/source/Core/Disassembler.cpp index f06062ec653..b5497b4a9fd 100644 --- a/lldb/source/Core/Disassembler.cpp +++ b/lldb/source/Core/Disassembler.cpp @@ -56,7 +56,8 @@ Disassembler::FindPlugin (const ArchSpec &arch, const char *flavor, const char * if (plugin_name) { - create_callback = PluginManager::GetDisassemblerCreateCallbackForPluginName (plugin_name); + ConstString const_plugin_name (plugin_name); + create_callback = PluginManager::GetDisassemblerCreateCallbackForPluginName (const_plugin_name); if (create_callback) { DisassemblerSP disassembler_sp(create_callback(arch, flavor)); diff --git a/lldb/source/Core/DynamicLoader.cpp b/lldb/source/Core/DynamicLoader.cpp index 1943c80b2f0..82f84048b32 100644 --- a/lldb/source/Core/DynamicLoader.cpp +++ b/lldb/source/Core/DynamicLoader.cpp @@ -21,7 +21,8 @@ DynamicLoader::FindPlugin (Process *process, const char *plugin_name) DynamicLoaderCreateInstance create_callback = NULL; if (plugin_name) { - create_callback = PluginManager::GetDynamicLoaderCreateCallbackForPluginName (plugin_name); + ConstString const_plugin_name(plugin_name); + create_callback = PluginManager::GetDynamicLoaderCreateCallbackForPluginName (const_plugin_name); if (create_callback) { std::unique_ptr<DynamicLoader> instance_ap(create_callback(process, true)); diff --git a/lldb/source/Core/EmulateInstruction.cpp b/lldb/source/Core/EmulateInstruction.cpp index 73763f5ceec..bf6c6d88b56 100644 --- a/lldb/source/Core/EmulateInstruction.cpp +++ b/lldb/source/Core/EmulateInstruction.cpp @@ -32,7 +32,8 @@ EmulateInstruction::FindPlugin (const ArchSpec &arch, InstructionType supported_ EmulateInstructionCreateInstance create_callback = NULL; if (plugin_name) { - create_callback = PluginManager::GetEmulateInstructionCreateCallbackForPluginName (plugin_name); + ConstString const_plugin_name (plugin_name); + create_callback = PluginManager::GetEmulateInstructionCreateCallbackForPluginName (const_plugin_name); if (create_callback) { EmulateInstruction *emulate_insn_ptr = create_callback(arch, supported_inst_type); diff --git a/lldb/source/Core/Log.cpp b/lldb/source/Core/Log.cpp index 881d9892fd7..d73ab15f697 100644 --- a/lldb/source/Core/Log.cpp +++ b/lldb/source/Core/Log.cpp @@ -313,7 +313,7 @@ Log::Warning (const char *format, ...) } } -typedef std::map <std::string, Log::Callbacks> CallbackMap; +typedef std::map <ConstString, Log::Callbacks> CallbackMap; typedef CallbackMap::iterator CallbackMapIter; typedef std::map <ConstString, LogChannelSP> LogChannelMap; @@ -337,19 +337,19 @@ GetChannelMap () } void -Log::RegisterLogChannel (const char *channel, const Log::Callbacks &log_callbacks) +Log::RegisterLogChannel (const ConstString &channel, const Log::Callbacks &log_callbacks) { GetCallbackMap().insert(std::make_pair(channel, log_callbacks)); } bool -Log::UnregisterLogChannel (const char *channel) +Log::UnregisterLogChannel (const ConstString &channel) { return GetCallbackMap().erase(channel) != 0; } bool -Log::GetLogChannelCallbacks (const char *channel, Log::Callbacks &log_callbacks) +Log::GetLogChannelCallbacks (const ConstString &channel, Log::Callbacks &log_callbacks) { CallbackMap &callback_map = GetCallbackMap (); CallbackMapIter pos = callback_map.find(channel); @@ -427,7 +427,7 @@ void Log::Initialize() { Log::Callbacks log_callbacks = { DisableLog, EnableLog, ListLogCategories }; - Log::RegisterLogChannel ("lldb", log_callbacks); + Log::RegisterLogChannel (ConstString("lldb"), log_callbacks); } void @@ -495,7 +495,8 @@ LogChannel::FindPlugin (const char *plugin_name) LogChannelMapIter pos = channel_map.find (log_channel_name); if (pos == channel_map.end()) { - LogChannelCreateInstance create_callback = PluginManager::GetLogChannelCreateCallbackForPluginName (plugin_name); + ConstString const_plugin_name (plugin_name); + LogChannelCreateInstance create_callback = PluginManager::GetLogChannelCreateCallbackForPluginName (const_plugin_name); if (create_callback) { log_channel_sp.reset(create_callback()); diff --git a/lldb/source/Core/Module.cpp b/lldb/source/Core/Module.cpp index 7f403472cda..b5874daeb80 100644 --- a/lldb/source/Core/Module.cpp +++ b/lldb/source/Core/Module.cpp @@ -136,6 +136,7 @@ Module::Module (const ModuleSpec &module_spec) : m_symfile_spec (module_spec.GetSymbolFileSpec()), m_object_name (module_spec.GetObjectName()), m_object_offset (module_spec.GetObjectOffset()), + m_object_mod_time (module_spec.GetObjectModificationTime()), m_objfile_sp (), m_symfile_ap (), m_ast (), @@ -168,7 +169,8 @@ Module::Module (const ModuleSpec &module_spec) : Module::Module(const FileSpec& file_spec, const ArchSpec& arch, const ConstString *object_name, - off_t object_offset) : + off_t object_offset, + const TimeValue *object_mod_time_ptr) : m_mutex (Mutex::eMutexTypeRecursive), m_mod_time (file_spec.GetModificationTime()), m_arch (arch), @@ -178,6 +180,7 @@ Module::Module(const FileSpec& file_spec, m_symfile_spec (), m_object_name (), m_object_offset (object_offset), + m_object_mod_time (), m_objfile_sp (), m_symfile_ap (), m_ast (), @@ -198,6 +201,10 @@ Module::Module(const FileSpec& file_spec, if (object_name) m_object_name = *object_name; + + if (object_mod_time_ptr) + m_object_mod_time = *object_mod_time_ptr; + Log *log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_OBJECT|LIBLLDB_LOG_MODULES)); if (log) log->Printf ("%p Module::Module((%s) '%s%s%s%s')", @@ -1186,12 +1193,6 @@ Module::FindSymbolsMatchingRegExAndType (const RegularExpression ®ex, SymbolT return sc_list.GetSize() - initial_size; } -const TimeValue & -Module::GetModificationTime () const -{ - return m_mod_time; -} - void Module::SetSymbolFileFileSpec (const FileSpec &file) { diff --git a/lldb/source/Core/PluginManager.cpp b/lldb/source/Core/PluginManager.cpp index 0cc916b115d..a143b95d93c 100644 --- a/lldb/source/Core/PluginManager.cpp +++ b/lldb/source/Core/PluginManager.cpp @@ -233,7 +233,7 @@ struct ABIInstance { } - std::string name; + ConstString name; std::string description; ABICreateInstance create_callback; }; @@ -257,7 +257,7 @@ GetABIInstances () bool PluginManager::RegisterPlugin ( - const char *name, + const ConstString &name, const char *description, ABICreateInstance create_callback ) @@ -265,8 +265,8 @@ PluginManager::RegisterPlugin if (create_callback) { ABIInstance instance; - assert (name && name[0]); - instance.name.assign (name); + assert ((bool)name); + instance.name = name; if (description && description[0]) instance.description = description; instance.create_callback = create_callback; @@ -309,18 +309,17 @@ PluginManager::GetABICreateCallbackAtIndex (uint32_t idx) } ABICreateInstance -PluginManager::GetABICreateCallbackForPluginName (const char *name) +PluginManager::GetABICreateCallbackForPluginName (const ConstString &name) { - if (name && name[0]) + if (name) { Mutex::Locker locker (GetABIInstancesMutex ()); - llvm::StringRef name_sref(name); ABIInstances &instances = GetABIInstances (); ABIInstances::iterator pos, end = instances.end(); for (pos = instances.begin(); pos != end; ++ pos) { - if (name_sref.equals (pos->name)) + if (name == pos->name) return pos->create_callback; } } @@ -340,7 +339,7 @@ struct DisassemblerInstance { } - std::string name; + ConstString name; std::string description; DisassemblerCreateInstance create_callback; }; @@ -364,7 +363,7 @@ GetDisassemblerInstances () bool PluginManager::RegisterPlugin ( - const char *name, + const ConstString &name, const char *description, DisassemblerCreateInstance create_callback ) @@ -372,7 +371,7 @@ PluginManager::RegisterPlugin if (create_callback) { DisassemblerInstance instance; - assert (name && name[0]); + assert ((bool)name); instance.name = name; if (description && description[0]) instance.description = description; @@ -416,18 +415,17 @@ PluginManager::GetDisassemblerCreateCallbackAtIndex (uint32_t idx) } DisassemblerCreateInstance -PluginManager::GetDisassemblerCreateCallbackForPluginName (const char *name) +PluginManager::GetDisassemblerCreateCallbackForPluginName (const ConstString &name) { - if (name && name[0]) + if (name) { - llvm::StringRef name_sref(name); Mutex::Locker locker (GetDisassemblerMutex ()); DisassemblerInstances &instances = GetDisassemblerInstances (); DisassemblerInstances::iterator pos, end = instances.end(); for (pos = instances.begin(); pos != end; ++ pos) { - if (name_sref.equals (pos->name)) + if (name == pos->name) return pos->create_callback; } } @@ -449,7 +447,7 @@ struct DynamicLoaderInstance { } - std::string name; + ConstString name; std::string description; DynamicLoaderCreateInstance create_callback; DebuggerInitializeCallback debugger_init_callback; @@ -476,7 +474,7 @@ GetDynamicLoaderInstances () bool PluginManager::RegisterPlugin ( - const char *name, + const ConstString &name, const char *description, DynamicLoaderCreateInstance create_callback, DebuggerInitializeCallback debugger_init_callback @@ -485,7 +483,7 @@ PluginManager::RegisterPlugin if (create_callback) { DynamicLoaderInstance instance; - assert (name && name[0]); + assert ((bool)name); instance.name = name; if (description && description[0]) instance.description = description; @@ -529,18 +527,17 @@ PluginManager::GetDynamicLoaderCreateCallbackAtIndex (uint32_t idx) } DynamicLoaderCreateInstance -PluginManager::GetDynamicLoaderCreateCallbackForPluginName (const char *name) +PluginManager::GetDynamicLoaderCreateCallbackForPluginName (const ConstString &name) { - if (name && name[0]) + if (name) { - llvm::StringRef name_sref(name); Mutex::Locker locker (GetDynamicLoaderMutex ()); DynamicLoaderInstances &instances = GetDynamicLoaderInstances (); DynamicLoaderInstances::iterator pos, end = instances.end(); for (pos = instances.begin(); pos != end; ++ pos) { - if (name_sref.equals (pos->name)) + if (name == pos->name) return pos->create_callback; } } @@ -559,7 +556,7 @@ struct EmulateInstructionInstance { } - std::string name; + ConstString name; std::string description; EmulateInstructionCreateInstance create_callback; }; @@ -584,7 +581,7 @@ GetEmulateInstructionInstances () bool PluginManager::RegisterPlugin ( - const char *name, + const ConstString &name, const char *description, EmulateInstructionCreateInstance create_callback ) @@ -592,7 +589,7 @@ PluginManager::RegisterPlugin if (create_callback) { EmulateInstructionInstance instance; - assert (name && name[0]); + assert ((bool)name); instance.name = name; if (description && description[0]) instance.description = description; @@ -635,18 +632,17 @@ PluginManager::GetEmulateInstructionCreateCallbackAtIndex (uint32_t idx) } EmulateInstructionCreateInstance -PluginManager::GetEmulateInstructionCreateCallbackForPluginName (const char *name) +PluginManager::GetEmulateInstructionCreateCallbackForPluginName (const ConstString &name) { - if (name && name[0]) + if (name) { - llvm::StringRef name_sref(name); Mutex::Locker locker (GetEmulateInstructionMutex ()); EmulateInstructionInstances &instances = GetEmulateInstructionInstances (); EmulateInstructionInstances::iterator pos, end = instances.end(); for (pos = instances.begin(); pos != end; ++ pos) { - if (name_sref.equals (pos->name)) + if (name == pos->name) return pos->create_callback; } } @@ -664,7 +660,7 @@ struct OperatingSystemInstance { } - std::string name; + ConstString name; std::string description; OperatingSystemCreateInstance create_callback; }; @@ -686,17 +682,14 @@ GetOperatingSystemInstances () } bool -PluginManager::RegisterPlugin -( - const char *name, - const char *description, - OperatingSystemCreateInstance create_callback - ) +PluginManager::RegisterPlugin (const ConstString &name, + const char *description, + OperatingSystemCreateInstance create_callback) { if (create_callback) { OperatingSystemInstance instance; - assert (name && name[0]); + assert ((bool)name); instance.name = name; if (description && description[0]) instance.description = description; @@ -739,18 +732,17 @@ PluginManager::GetOperatingSystemCreateCallbackAtIndex (uint32_t idx) } OperatingSystemCreateInstance -PluginManager::GetOperatingSystemCreateCallbackForPluginName (const char *name) +PluginManager::GetOperatingSystemCreateCallbackForPluginName (const ConstString &name) { - if (name && name[0]) + if (name) { - llvm::StringRef name_sref(name); Mutex::Locker locker (GetOperatingSystemMutex ()); OperatingSystemInstances &instances = GetOperatingSystemInstances (); OperatingSystemInstances::iterator pos, end = instances.end(); for (pos = instances.begin(); pos != end; ++ pos) { - if (name_sref.equals (pos->name)) + if (name == pos->name) return pos->create_callback; } } @@ -770,7 +762,7 @@ struct LanguageRuntimeInstance { } - std::string name; + ConstString name; std::string description; LanguageRuntimeCreateInstance create_callback; }; @@ -794,7 +786,7 @@ GetLanguageRuntimeInstances () bool PluginManager::RegisterPlugin ( - const char *name, + const ConstString &name, const char *description, LanguageRuntimeCreateInstance create_callback ) @@ -802,7 +794,7 @@ PluginManager::RegisterPlugin if (create_callback) { LanguageRuntimeInstance instance; - assert (name && name[0]); + assert ((bool)name); instance.name = name; if (description && description[0]) instance.description = description; @@ -845,18 +837,17 @@ PluginManager::GetLanguageRuntimeCreateCallbackAtIndex (uint32_t idx) } LanguageRuntimeCreateInstance -PluginManager::GetLanguageRuntimeCreateCallbackForPluginName (const char *name) +PluginManager::GetLanguageRuntimeCreateCallbackForPluginName (const ConstString &name) { - if (name && name[0]) + if (name) { - llvm::StringRef name_sref(name); Mutex::Locker locker (GetLanguageRuntimeMutex ()); LanguageRuntimeInstances &instances = GetLanguageRuntimeInstances (); LanguageRuntimeInstances::iterator pos, end = instances.end(); for (pos = instances.begin(); pos != end; ++ pos) { - if (name_sref.equals (pos->name)) + if (name == pos->name) return pos->create_callback; } } @@ -876,7 +867,7 @@ struct ObjectFileInstance { } - std::string name; + ConstString name; std::string description; ObjectFileCreateInstance create_callback; ObjectFileCreateMemoryInstance create_memory_callback; @@ -901,7 +892,7 @@ GetObjectFileInstances () bool -PluginManager::RegisterPlugin (const char *name, +PluginManager::RegisterPlugin (const ConstString &name, const char *description, ObjectFileCreateInstance create_callback, ObjectFileCreateMemoryInstance create_memory_callback, @@ -910,7 +901,7 @@ PluginManager::RegisterPlugin (const char *name, if (create_callback) { ObjectFileInstance instance; - assert (name && name[0]); + assert ((bool)name); instance.name = name; if (description && description[0]) instance.description = description; @@ -976,18 +967,17 @@ PluginManager::GetObjectFileGetModuleSpecificationsCallbackAtIndex (uint32_t idx } ObjectFileCreateInstance -PluginManager::GetObjectFileCreateCallbackForPluginName (const char *name) +PluginManager::GetObjectFileCreateCallbackForPluginName (const ConstString &name) { - if (name && name[0]) + if (name) { - llvm::StringRef name_sref(name); Mutex::Locker locker (GetObjectFileMutex ()); ObjectFileInstances &instances = GetObjectFileInstances (); ObjectFileInstances::iterator pos, end = instances.end(); for (pos = instances.begin(); pos != end; ++ pos) { - if (name_sref.equals (pos->name)) + if (name == pos->name) return pos->create_callback; } } @@ -996,18 +986,17 @@ PluginManager::GetObjectFileCreateCallbackForPluginName (const char *name) ObjectFileCreateMemoryInstance -PluginManager::GetObjectFileCreateMemoryCallbackForPluginName (const char *name) +PluginManager::GetObjectFileCreateMemoryCallbackForPluginName (const ConstString &name) { - if (name && name[0]) + if (name) { - llvm::StringRef name_sref(name); Mutex::Locker locker (GetObjectFileMutex ()); ObjectFileInstances &instances = GetObjectFileInstances (); ObjectFileInstances::iterator pos, end = instances.end(); for (pos = instances.begin(); pos != end; ++ pos) { - if (name_sref.equals (pos->name)) + if (name == pos->name) return pos->create_memory_callback; } } @@ -1028,7 +1017,7 @@ struct ObjectContainerInstance { } - std::string name; + ConstString name; std::string description; ObjectContainerCreateInstance create_callback; ObjectFileGetModuleSpecifications get_module_specifications; @@ -1052,7 +1041,7 @@ GetObjectContainerInstances () } bool -PluginManager::RegisterPlugin (const char *name, +PluginManager::RegisterPlugin (const ConstString &name, const char *description, ObjectContainerCreateInstance create_callback, ObjectFileGetModuleSpecifications get_module_specifications) @@ -1060,7 +1049,7 @@ PluginManager::RegisterPlugin (const char *name, if (create_callback) { ObjectContainerInstance instance; - assert (name && name[0]); + assert ((bool)name); instance.name = name; if (description && description[0]) instance.description = description; @@ -1104,18 +1093,17 @@ PluginManager::GetObjectContainerCreateCallbackAtIndex (uint32_t idx) } ObjectContainerCreateInstance -PluginManager::GetObjectContainerCreateCallbackForPluginName (const char *name) +PluginManager::GetObjectContainerCreateCallbackForPluginName (const ConstString &name) { - if (name && name[0]) + if (name) { - llvm::StringRef name_sref(name); Mutex::Locker locker (GetObjectContainerMutex ()); ObjectContainerInstances &instances = GetObjectContainerInstances (); ObjectContainerInstances::iterator pos, end = instances.end(); for (pos = instances.begin(); pos != end; ++ pos) { - if (name_sref.equals (pos->name)) + if (name == pos->name) return pos->create_callback; } } @@ -1143,7 +1131,7 @@ struct LogInstance { } - std::string name; + ConstString name; std::string description; LogChannelCreateInstance create_callback; }; @@ -1169,7 +1157,7 @@ GetLogInstances () bool PluginManager::RegisterPlugin ( - const char *name, + const ConstString &name, const char *description, LogChannelCreateInstance create_callback ) @@ -1177,7 +1165,7 @@ PluginManager::RegisterPlugin if (create_callback) { LogInstance instance; - assert (name && name[0]); + assert ((bool)name); instance.name = name; if (description && description[0]) instance.description = description; @@ -1215,7 +1203,7 @@ PluginManager::GetLogChannelCreateNameAtIndex (uint32_t idx) Mutex::Locker locker (GetLogMutex ()); LogInstances &instances = GetLogInstances (); if (idx < instances.size()) - return instances[idx].name.c_str(); + return instances[idx].name.GetCString(); return NULL; } @@ -1231,18 +1219,17 @@ PluginManager::GetLogChannelCreateCallbackAtIndex (uint32_t idx) } LogChannelCreateInstance -PluginManager::GetLogChannelCreateCallbackForPluginName (const char *name) +PluginManager::GetLogChannelCreateCallbackForPluginName (const ConstString &name) { - if (name && name[0]) + if (name) { - llvm::StringRef name_sref(name); Mutex::Locker locker (GetLogMutex ()); LogInstances &instances = GetLogInstances (); LogInstances::iterator pos, end = instances.end(); for (pos = instances.begin(); pos != end; ++ pos) { - if (name_sref.equals (pos->name)) + if (name == pos->name) return pos->create_callback; } } @@ -1261,7 +1248,7 @@ struct PlatformInstance { } - std::string name; + ConstString name; std::string description; PlatformCreateInstance create_callback; DebuggerInitializeCallback debugger_init_callback; @@ -1285,7 +1272,7 @@ GetPlatformInstances () bool -PluginManager::RegisterPlugin (const char *name, +PluginManager::RegisterPlugin (const ConstString &name, const char *description, PlatformCreateInstance create_callback, DebuggerInitializeCallback debugger_init_callback) @@ -1295,7 +1282,7 @@ PluginManager::RegisterPlugin (const char *name, Mutex::Locker locker (GetPlatformInstancesMutex ()); PlatformInstance instance; - assert (name && name[0]); + assert ((bool)name); instance.name = name; if (description && description[0]) instance.description = description; @@ -1314,7 +1301,7 @@ PluginManager::GetPlatformPluginNameAtIndex (uint32_t idx) Mutex::Locker locker (GetPlatformInstancesMutex ()); PlatformInstances &instances = GetPlatformInstances (); if (idx < instances.size()) - return instances[idx].name.c_str(); + return instances[idx].name.GetCString(); return NULL; } @@ -1360,18 +1347,17 @@ PluginManager::GetPlatformCreateCallbackAtIndex (uint32_t idx) } PlatformCreateInstance -PluginManager::GetPlatformCreateCallbackForPluginName (const char *name) +PluginManager::GetPlatformCreateCallbackForPluginName (const ConstString &name) { - if (name && name[0]) + if (name) { Mutex::Locker locker (GetPlatformInstancesMutex ()); PlatformInstances &instances = GetPlatformInstances (); - llvm::StringRef name_sref(name); PlatformInstances::iterator pos, end = instances.end(); for (pos = instances.begin(); pos != end; ++ pos) { - if (name_sref.equals (pos->name)) + if (name == pos->name) return pos->create_callback; } } @@ -1381,7 +1367,7 @@ PluginManager::GetPlatformCreateCallbackForPluginName (const char *name) size_t PluginManager::AutoCompletePlatformName (const char *name, StringList &matches) { - if (name && name[0]) + if (name) { Mutex::Locker locker (GetPlatformInstancesMutex ()); PlatformInstances &instances = GetPlatformInstances (); @@ -1390,7 +1376,7 @@ PluginManager::AutoCompletePlatformName (const char *name, StringList &matches) PlatformInstances::iterator pos, end = instances.end(); for (pos = instances.begin(); pos != end; ++ pos) { - llvm::StringRef plugin_name (pos->name); + llvm::StringRef plugin_name (pos->name.GetCString()); if (plugin_name.startswith(name_sref)) matches.AppendString (plugin_name.data()); } @@ -1408,7 +1394,7 @@ struct ProcessInstance { } - std::string name; + ConstString name; std::string description; ProcessCreateInstance create_callback; }; @@ -1433,7 +1419,7 @@ GetProcessInstances () bool PluginManager::RegisterPlugin ( - const char *name, + const ConstString &name, const char *description, ProcessCreateInstance create_callback ) @@ -1441,7 +1427,7 @@ PluginManager::RegisterPlugin if (create_callback) { ProcessInstance instance; - assert (name && name[0]); + assert ((bool)name); instance.name = name; if (description && description[0]) instance.description = description; @@ -1458,7 +1444,7 @@ PluginManager::GetProcessPluginNameAtIndex (uint32_t idx) Mutex::Locker locker (GetProcessMutex ()); ProcessInstances &instances = GetProcessInstances (); if (idx < instances.size()) - return instances[idx].name.c_str(); + return instances[idx].name.GetCString(); return NULL; } @@ -1505,18 +1491,17 @@ PluginManager::GetProcessCreateCallbackAtIndex (uint32_t idx) ProcessCreateInstance -PluginManager::GetProcessCreateCallbackForPluginName (const char *name) +PluginManager::GetProcessCreateCallbackForPluginName (const ConstString &name) { - if (name && name[0]) + if (name) { - llvm::StringRef name_sref(name); Mutex::Locker locker (GetProcessMutex ()); ProcessInstances &instances = GetProcessInstances (); ProcessInstances::iterator pos, end = instances.end(); for (pos = instances.begin(); pos != end; ++ pos) { - if (name_sref.equals (pos->name)) + if (name == pos->name) return pos->create_callback; } } @@ -1534,7 +1519,7 @@ struct SymbolFileInstance { } - std::string name; + ConstString name; std::string description; SymbolFileCreateInstance create_callback; }; @@ -1559,7 +1544,7 @@ GetSymbolFileInstances () bool PluginManager::RegisterPlugin ( - const char *name, + const ConstString &name, const char *description, SymbolFileCreateInstance create_callback ) @@ -1567,7 +1552,7 @@ PluginManager::RegisterPlugin if (create_callback) { SymbolFileInstance instance; - assert (name && name[0]); + assert ((bool)name); instance.name = name; if (description && description[0]) instance.description = description; @@ -1610,18 +1595,17 @@ PluginManager::GetSymbolFileCreateCallbackAtIndex (uint32_t idx) } SymbolFileCreateInstance -PluginManager::GetSymbolFileCreateCallbackForPluginName (const char *name) +PluginManager::GetSymbolFileCreateCallbackForPluginName (const ConstString &name) { - if (name && name[0]) + if (name) { - llvm::StringRef name_sref(name); Mutex::Locker locker (GetSymbolFileMutex ()); SymbolFileInstances &instances = GetSymbolFileInstances (); SymbolFileInstances::iterator pos, end = instances.end(); for (pos = instances.begin(); pos != end; ++ pos) { - if (name_sref.equals (pos->name)) + if (name == pos->name) return pos->create_callback; } } @@ -1641,7 +1625,7 @@ struct SymbolVendorInstance { } - std::string name; + ConstString name; std::string description; SymbolVendorCreateInstance create_callback; }; @@ -1665,7 +1649,7 @@ GetSymbolVendorInstances () bool PluginManager::RegisterPlugin ( - const char *name, + const ConstString &name, const char *description, SymbolVendorCreateInstance create_callback ) @@ -1673,7 +1657,7 @@ PluginManager::RegisterPlugin if (create_callback) { SymbolVendorInstance instance; - assert (name && name[0]); + assert ((bool)name); instance.name = name; if (description && description[0]) instance.description = description; @@ -1717,18 +1701,17 @@ PluginManager::GetSymbolVendorCreateCallbackAtIndex (uint32_t idx) SymbolVendorCreateInstance -PluginManager::GetSymbolVendorCreateCallbackForPluginName (const char *name) +PluginManager::GetSymbolVendorCreateCallbackForPluginName (const ConstString &name) { - if (name && name[0]) + if (name) { - llvm::StringRef name_sref(name); Mutex::Locker locker (GetSymbolVendorMutex ()); SymbolVendorInstances &instances = GetSymbolVendorInstances (); SymbolVendorInstances::iterator pos, end = instances.end(); for (pos = instances.begin(); pos != end; ++ pos) { - if (name_sref.equals (pos->name)) + if (name == pos->name) return pos->create_callback; } } @@ -1747,7 +1730,7 @@ struct UnwindAssemblyInstance { } - std::string name; + ConstString name; std::string description; UnwindAssemblyCreateInstance create_callback; }; @@ -1771,7 +1754,7 @@ GetUnwindAssemblyInstances () bool PluginManager::RegisterPlugin ( - const char *name, + const ConstString &name, const char *description, UnwindAssemblyCreateInstance create_callback ) @@ -1779,7 +1762,7 @@ PluginManager::RegisterPlugin if (create_callback) { UnwindAssemblyInstance instance; - assert (name && name[0]); + assert ((bool)name); instance.name = name; if (description && description[0]) instance.description = description; @@ -1823,18 +1806,17 @@ PluginManager::GetUnwindAssemblyCreateCallbackAtIndex (uint32_t idx) UnwindAssemblyCreateInstance -PluginManager::GetUnwindAssemblyCreateCallbackForPluginName (const char *name) +PluginManager::GetUnwindAssemblyCreateCallbackForPluginName (const ConstString &name) { - if (name && name[0]) + if (name) { - llvm::StringRef name_sref(name); Mutex::Locker locker (GetUnwindAssemblyMutex ()); UnwindAssemblyInstances &instances = GetUnwindAssemblyInstances (); UnwindAssemblyInstances::iterator pos, end = instances.end(); for (pos = instances.begin(); pos != end; ++ pos) { - if (name_sref.equals (pos->name)) + if (name == pos->name) return pos->create_callback; } } diff --git a/lldb/source/Interpreter/OptionGroupPlatform.cpp b/lldb/source/Interpreter/OptionGroupPlatform.cpp index 8dc64fb54c3..a54edafd019 100644 --- a/lldb/source/Interpreter/OptionGroupPlatform.cpp +++ b/lldb/source/Interpreter/OptionGroupPlatform.cpp @@ -38,7 +38,9 @@ OptionGroupPlatform::CreatePlatformWithOptions (CommandInterpreter &interpreter, { if (platform_arch.IsValid() && !platform_sp->IsCompatibleArchitecture(arch, false, &platform_arch)) { - error.SetErrorStringWithFormat("platform '%s' doesn't support '%s'", platform_sp->GetName(), arch.GetTriple().getTriple().c_str()); + error.SetErrorStringWithFormat ("platform '%s' doesn't support '%s'", + platform_sp->GetName().GetCString(), + arch.GetTriple().getTriple().c_str()); platform_sp.reset(); return platform_sp; } diff --git a/lldb/source/Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.cpp b/lldb/source/Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.cpp index 3a9f767cfc7..bc63e591cc2 100644 --- a/lldb/source/Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.cpp +++ b/lldb/source/Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.cpp @@ -35,12 +35,7 @@ using namespace lldb; using namespace lldb_private; -static const char *pluginName = "ABIMacOSX_arm"; -static const char *pluginDesc = "Mac OS X ABI for arm targets"; -static const char *pluginShort = "abi.macosx-arm"; - - -static RegisterInfo g_register_infos[] = +static RegisterInfo g_register_infos[] = { // NAME ALT SZ OFF ENCODING FORMAT COMPILER DWARF GENERIC GDB LLDB NATIVE VALUE REGS INVALIDATE REGS // ========== ======= == === ============= ============ ======================= =================== =========================== ======================= ====================== ========== =============== @@ -841,8 +836,8 @@ ABIMacOSX_arm::RegisterIsVolatile (const RegisterInfo *reg_info) void ABIMacOSX_arm::Initialize() { - PluginManager::RegisterPlugin (pluginName, - pluginDesc, + PluginManager::RegisterPlugin (GetPluginNameStatic(), + "Mac OS X ABI for arm targets", CreateInstance); } @@ -852,19 +847,20 @@ ABIMacOSX_arm::Terminate() PluginManager::UnregisterPlugin (CreateInstance); } +lldb_private::ConstString +ABIMacOSX_arm::GetPluginNameStatic() +{ + static ConstString g_name("macosx-arm"); + return g_name; +} + //------------------------------------------------------------------ // PluginInterface protocol //------------------------------------------------------------------ -const char * +lldb_private::ConstString ABIMacOSX_arm::GetPluginName() { - return pluginName; -} - -const char * -ABIMacOSX_arm::GetShortPluginName() -{ - return pluginShort; + return GetPluginNameStatic(); } uint32_t diff --git a/lldb/source/Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.h b/lldb/source/Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.h index c1edb6edd62..27cea85aaf6 100644 --- a/lldb/source/Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.h +++ b/lldb/source/Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.h @@ -114,15 +114,15 @@ public: static lldb::ABISP CreateInstance (const lldb_private::ArchSpec &arch); + static lldb_private::ConstString + GetPluginNameStatic(); + //------------------------------------------------------------------ // PluginInterface protocol //------------------------------------------------------------------ - virtual const char * + virtual lldb_private::ConstString GetPluginName(); - virtual const char * - GetShortPluginName(); - virtual uint32_t GetPluginVersion(); diff --git a/lldb/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.cpp b/lldb/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.cpp index 03592522833..d2126bf3556 100644 --- a/lldb/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.cpp +++ b/lldb/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.cpp @@ -30,10 +30,6 @@ using namespace lldb; using namespace lldb_private; -static const char *pluginName = "ABIMacOSX_i386"; -static const char *pluginDesc = "Mac OS X ABI for i386 targets"; -static const char *pluginShort = "abi.macosx-i386"; - enum { gcc_eax = 0, @@ -974,8 +970,8 @@ ABIMacOSX_i386::RegisterIsCalleeSaved (const RegisterInfo *reg_info) void ABIMacOSX_i386::Initialize() { - PluginManager::RegisterPlugin (pluginName, - pluginDesc, + PluginManager::RegisterPlugin (GetPluginNameStatic(), + "Mac OS X ABI for i386 targets", CreateInstance); } @@ -985,19 +981,21 @@ ABIMacOSX_i386::Terminate() PluginManager::UnregisterPlugin (CreateInstance); } +lldb_private::ConstString +ABIMacOSX_i386::GetPluginNameStatic () +{ + static ConstString g_short_name("abi.macosx-i386"); + return g_short_name; + +} + //------------------------------------------------------------------ // PluginInterface protocol //------------------------------------------------------------------ -const char * +lldb_private::ConstString ABIMacOSX_i386::GetPluginName() { - return pluginName; -} - -const char * -ABIMacOSX_i386::GetShortPluginName() -{ - return pluginShort; + return GetPluginNameStatic(); } uint32_t diff --git a/lldb/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.h b/lldb/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.h index 4cc94ab0348..8c2d945e634 100644 --- a/lldb/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.h +++ b/lldb/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.h @@ -118,12 +118,12 @@ public: //------------------------------------------------------------------ // PluginInterface protocol //------------------------------------------------------------------ - virtual const char * + static lldb_private::ConstString + GetPluginNameStatic (); + + virtual lldb_private::ConstString GetPluginName(); - virtual const char * - GetShortPluginName(); - virtual uint32_t GetPluginVersion(); diff --git a/lldb/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp b/lldb/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp index 2cd7bdf82f7..a9b002c03df 100644 --- a/lldb/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp +++ b/lldb/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp @@ -33,11 +33,6 @@ using namespace lldb; using namespace lldb_private; -static const char *pluginName = "ABISysV_x86_64"; -static const char *pluginDesc = "System V ABI for x86_64 targets"; -static const char *pluginShort = "abi.sysv-x86_64"; - - enum gcc_dwarf_regnums { gcc_dwarf_rax = 0, @@ -1269,8 +1264,8 @@ ABISysV_x86_64::RegisterIsCalleeSaved (const RegisterInfo *reg_info) void ABISysV_x86_64::Initialize() { - PluginManager::RegisterPlugin (pluginName, - pluginDesc, + PluginManager::RegisterPlugin (GetPluginNameStatic(), + "System V ABI for x86_64 targets", CreateInstance); } @@ -1280,19 +1275,20 @@ ABISysV_x86_64::Terminate() PluginManager::UnregisterPlugin (CreateInstance); } +lldb_private::ConstString +ABISysV_x86_64::GetPluginNameStatic() +{ + static ConstString g_name("sysv-x86_64"); + return g_name; +} + //------------------------------------------------------------------ // PluginInterface protocol //------------------------------------------------------------------ -const char * +lldb_private::ConstString ABISysV_x86_64::GetPluginName() { - return pluginName; -} - -const char * -ABISysV_x86_64::GetShortPluginName() -{ - return pluginShort; + return GetPluginNameStatic(); } uint32_t diff --git a/lldb/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.h b/lldb/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.h index 2cc3fbcca32..b10181960e8 100644 --- a/lldb/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.h +++ b/lldb/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.h @@ -112,15 +112,15 @@ public: static lldb::ABISP CreateInstance (const lldb_private::ArchSpec &arch); + static lldb_private::ConstString + GetPluginNameStatic(); + //------------------------------------------------------------------ // PluginInterface protocol //------------------------------------------------------------------ - virtual const char * + virtual lldb_private::ConstString GetPluginName(); - virtual const char * - GetShortPluginName(); - virtual uint32_t GetPluginVersion(); diff --git a/lldb/source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp b/lldb/source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp index b3647044b27..6999b2a75bf 100644 --- a/lldb/source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp +++ b/lldb/source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp @@ -694,7 +694,7 @@ void DisassemblerLLVMC::Initialize() { PluginManager::RegisterPlugin (GetPluginNameStatic(), - GetPluginDescriptionStatic(), + "Disassembler that uses LLVM MC to disassemble i386, x86_64 and ARM.", CreateInstance); llvm::InitializeAllTargetInfos(); @@ -710,16 +710,11 @@ DisassemblerLLVMC::Terminate() } -const char * +ConstString DisassemblerLLVMC::GetPluginNameStatic() { - return "llvm-mc"; -} - -const char * -DisassemblerLLVMC::GetPluginDescriptionStatic() -{ - return "Disassembler that uses LLVM MC to disassemble i386, x86_64 and ARM."; + static ConstString g_name("llvm-mc"); + return g_name; } int DisassemblerLLVMC::OpInfoCallback (void *disassembler, @@ -813,15 +808,9 @@ const char *DisassemblerLLVMC::SymbolLookup (uint64_t value, //------------------------------------------------------------------ // PluginInterface protocol //------------------------------------------------------------------ -const char * +ConstString DisassemblerLLVMC::GetPluginName() { - return "DisassemblerLLVMC"; -} - -const char * -DisassemblerLLVMC::GetShortPluginName() -{ return GetPluginNameStatic(); } diff --git a/lldb/source/Plugins/Disassembler/llvm/DisassemblerLLVMC.h b/lldb/source/Plugins/Disassembler/llvm/DisassemblerLLVMC.h index 4a265c573d8..29b28ade81a 100644 --- a/lldb/source/Plugins/Disassembler/llvm/DisassemblerLLVMC.h +++ b/lldb/source/Plugins/Disassembler/llvm/DisassemblerLLVMC.h @@ -74,12 +74,9 @@ public: static void Terminate(); - static const char * + static lldb_private::ConstString GetPluginNameStatic(); - static const char * - GetPluginDescriptionStatic(); - static lldb_private::Disassembler * CreateInstance(const lldb_private::ArchSpec &arch, const char *flavor); @@ -99,12 +96,9 @@ public: //------------------------------------------------------------------ // PluginInterface protocol //------------------------------------------------------------------ - virtual const char * + virtual lldb_private::ConstString GetPluginName(); - virtual const char * - GetShortPluginName(); - virtual uint32_t GetPluginVersion(); diff --git a/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp b/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp index 5913b329315..873eec85ce0 100644 --- a/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp +++ b/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp @@ -26,7 +26,7 @@ #include "lldb/Target/Target.h" #include "lldb/Target/Thread.h" #include "lldb/Target/ThreadPlanRunToAddress.h" - +#include "Plugins/Platform/MacOSX/PlatformDarwinKernel.h" #include "DynamicLoaderDarwinKernel.h" @@ -460,7 +460,7 @@ DynamicLoaderDarwinKernel::DynamicLoaderDarwinKernel (Process* process, lldb::ad m_mutex(Mutex::eMutexTypeRecursive), m_break_id (LLDB_INVALID_BREAK_ID) { - PlatformSP platform_sp(Platform::FindPlugin (process, "darwin-kernel")); + PlatformSP platform_sp(Platform::FindPlugin (process, PlatformDarwinKernel::GetPluginNameStatic ())); // Only select the darwin-kernel Platform if we've been asked to load kexts. // It can take some time to scan over all of the kext info.plists and that // shouldn't be done if kext loading is explicitly disabled. @@ -811,8 +811,9 @@ DynamicLoaderDarwinKernel::KextImageInfo::LoadImageUsingMemoryModule (Process *p PlatformSP platform_sp (target.GetPlatform()); if (platform_sp) { - const char *pname = platform_sp->GetShortPluginName(); - if (pname && strcmp (pname, "darwin-kernel") == 0) + ConstString platform_name (platform_sp->GetPluginName()); + static ConstString g_platform_name (PlatformDarwinKernel::GetPluginNameStatic()); + if (platform_name == g_platform_name) { ModuleSpec kext_bundle_module_spec(module_spec); FileSpec kext_filespec(m_name.c_str(), false); @@ -1594,10 +1595,11 @@ DynamicLoaderDarwinKernel::DebuggerInitialize (lldb_private::Debugger &debugger) } } -const char * +lldb_private::ConstString DynamicLoaderDarwinKernel::GetPluginNameStatic() { - return "dynamic-loader.darwin-kernel"; + static ConstString g_name("darwin-kernel"); + return g_name; } const char * @@ -1610,15 +1612,9 @@ DynamicLoaderDarwinKernel::GetPluginDescriptionStatic() //------------------------------------------------------------------ // PluginInterface protocol //------------------------------------------------------------------ -const char * +lldb_private::ConstString DynamicLoaderDarwinKernel::GetPluginName() { - return "DynamicLoaderDarwinKernel"; -} - -const char * -DynamicLoaderDarwinKernel::GetShortPluginName() -{ return GetPluginNameStatic(); } diff --git a/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.h b/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.h index d65622cff03..c34ac6562ab 100644 --- a/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.h +++ b/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.h @@ -38,7 +38,7 @@ public: static void Terminate(); - static const char * + static lldb_private::ConstString GetPluginNameStatic(); static const char * @@ -80,12 +80,9 @@ public: //------------------------------------------------------------------ // PluginInterface protocol //------------------------------------------------------------------ - virtual const char * + virtual lldb_private::ConstString GetPluginName(); - virtual const char * - GetShortPluginName(); - virtual uint32_t GetPluginVersion(); diff --git a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp index 94c824a8a05..170d50217fa 100644 --- a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp +++ b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp @@ -1760,10 +1760,11 @@ DynamicLoaderMacOSXDYLD::Terminate() } -const char * +lldb_private::ConstString DynamicLoaderMacOSXDYLD::GetPluginNameStatic() { - return "dynamic-loader.macosx-dyld"; + static ConstString g_name("macosx-dyld"); + return g_name; } const char * @@ -1776,15 +1777,9 @@ DynamicLoaderMacOSXDYLD::GetPluginDescriptionStatic() //------------------------------------------------------------------ // PluginInterface protocol //------------------------------------------------------------------ -const char * +lldb_private::ConstString DynamicLoaderMacOSXDYLD::GetPluginName() { - return "DynamicLoaderMacOSXDYLD"; -} - -const char * -DynamicLoaderMacOSXDYLD::GetShortPluginName() -{ return GetPluginNameStatic(); } diff --git a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.h b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.h index 0b1a9a6a593..6405ed8f1a5 100644 --- a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.h +++ b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.h @@ -37,7 +37,7 @@ public: static void Terminate(); - static const char * + static lldb_private::ConstString GetPluginNameStatic(); static const char * @@ -80,12 +80,9 @@ public: //------------------------------------------------------------------ // PluginInterface protocol //------------------------------------------------------------------ - virtual const char * + virtual lldb_private::ConstString GetPluginName(); - virtual const char * - GetShortPluginName(); - virtual uint32_t GetPluginVersion(); diff --git a/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp b/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp index 88941955847..58173f897eb 100644 --- a/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp +++ b/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp @@ -40,22 +40,17 @@ DynamicLoaderPOSIXDYLD::Terminate() { } -const char * +lldb_private::ConstString DynamicLoaderPOSIXDYLD::GetPluginName() { - return "DynamicLoaderPOSIXDYLD"; -} - -const char * -DynamicLoaderPOSIXDYLD::GetShortPluginName() -{ - return "linux-dyld"; + return GetPluginNameStatic(); } -const char * +lldb_private::ConstString DynamicLoaderPOSIXDYLD::GetPluginNameStatic() { - return "dynamic-loader.linux-dyld"; + static ConstString g_name("linux-dyld"); + return g_name; } const char * diff --git a/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.h b/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.h index 709eacac161..c046798b102 100644 --- a/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.h +++ b/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.h @@ -30,7 +30,7 @@ public: static void Terminate(); - static const char * + static lldb_private::ConstString GetPluginNameStatic(); static const char * @@ -64,12 +64,9 @@ public: //------------------------------------------------------------------ // PluginInterface protocol //------------------------------------------------------------------ - virtual const char * + virtual lldb_private::ConstString GetPluginName(); - virtual const char * - GetShortPluginName(); - virtual uint32_t GetPluginVersion(); diff --git a/lldb/source/Plugins/DynamicLoader/Static/DynamicLoaderStatic.cpp b/lldb/source/Plugins/DynamicLoader/Static/DynamicLoaderStatic.cpp index 0a828ed0e2c..274ba328ad1 100644 --- a/lldb/source/Plugins/DynamicLoader/Static/DynamicLoaderStatic.cpp +++ b/lldb/source/Plugins/DynamicLoader/Static/DynamicLoaderStatic.cpp @@ -178,10 +178,11 @@ DynamicLoaderStatic::Terminate() } -const char * +lldb_private::ConstString DynamicLoaderStatic::GetPluginNameStatic() { - return "dynamic-loader.static"; + static ConstString g_name("static"); + return g_name; } const char * @@ -194,15 +195,9 @@ DynamicLoaderStatic::GetPluginDescriptionStatic() //------------------------------------------------------------------ // PluginInterface protocol //------------------------------------------------------------------ -const char * +lldb_private::ConstString DynamicLoaderStatic::GetPluginName() { - return "DynamicLoaderStatic"; -} - -const char * -DynamicLoaderStatic::GetShortPluginName() -{ return GetPluginNameStatic(); } diff --git a/lldb/source/Plugins/DynamicLoader/Static/DynamicLoaderStatic.h b/lldb/source/Plugins/DynamicLoader/Static/DynamicLoaderStatic.h index 3bdb016f22c..a99435fa32a 100644 --- a/lldb/source/Plugins/DynamicLoader/Static/DynamicLoaderStatic.h +++ b/lldb/source/Plugins/DynamicLoader/Static/DynamicLoaderStatic.h @@ -37,7 +37,7 @@ public: static void Terminate(); - static const char * + static lldb_private::ConstString GetPluginNameStatic(); static const char * @@ -72,12 +72,9 @@ public: //------------------------------------------------------------------ // PluginInterface protocol //------------------------------------------------------------------ - virtual const char * + virtual lldb_private::ConstString GetPluginName(); - virtual const char * - GetShortPluginName(); - virtual uint32_t GetPluginVersion(); diff --git a/lldb/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp b/lldb/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp index 860e633f8eb..a9d94afcc32 100644 --- a/lldb/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp +++ b/lldb/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp @@ -174,10 +174,11 @@ EmulateInstructionARM::Terminate () PluginManager::UnregisterPlugin (CreateInstance); } -const char * +ConstString EmulateInstructionARM::GetPluginNameStatic () { - return "lldb.emulate-instruction.arm"; + static ConstString g_name("arm"); + return g_name; } const char * diff --git a/lldb/source/Plugins/Instruction/ARM/EmulateInstructionARM.h b/lldb/source/Plugins/Instruction/ARM/EmulateInstructionARM.h index 8c7cb3685f3..b926dc0deb4 100644 --- a/lldb/source/Plugins/Instruction/ARM/EmulateInstructionARM.h +++ b/lldb/source/Plugins/Instruction/ARM/EmulateInstructionARM.h @@ -11,6 +11,7 @@ #define lldb_EmulateInstructionARM_h_ #include "lldb/Core/EmulateInstruction.h" +#include "lldb/Core/ConstString.h" #include "lldb/Core/Error.h" #include "Plugins/Process/Utility/ARMDefines.h" @@ -67,7 +68,7 @@ public: static void Terminate (); - static const char * + static lldb_private::ConstString GetPluginNameStatic (); static const char * @@ -93,15 +94,9 @@ public: return false; } - virtual const char * + virtual lldb_private::ConstString GetPluginName() { - return "EmulateInstructionARM"; - } - - virtual const char * - GetShortPluginName() - { return GetPluginNameStatic(); } diff --git a/lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp b/lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp index 05e66f38974..8a0d218ab34 100644 --- a/lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp +++ b/lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp @@ -32,9 +32,6 @@ using namespace lldb; using namespace lldb_private; -static const char *pluginName = "ItaniumABILanguageRuntime"; -static const char *pluginDesc = "Itanium ABI for the C++ language"; -static const char *pluginShort = "language.itanium"; static const char *vtable_demangled_prefix = "vtable for "; bool @@ -306,8 +303,8 @@ ItaniumABILanguageRuntime::CreateInstance (Process *process, lldb::LanguageType void ItaniumABILanguageRuntime::Initialize() { - PluginManager::RegisterPlugin (pluginName, - pluginDesc, + PluginManager::RegisterPlugin (GetPluginNameStatic(), + "Itanium ABI for the C++ language", CreateInstance); } @@ -317,19 +314,20 @@ ItaniumABILanguageRuntime::Terminate() PluginManager::UnregisterPlugin (CreateInstance); } +lldb_private::ConstString +ItaniumABILanguageRuntime::GetPluginNameStatic() +{ + static ConstString g_name("itanium"); + return g_name; +} + //------------------------------------------------------------------ // PluginInterface protocol //------------------------------------------------------------------ -const char * +lldb_private::ConstString ItaniumABILanguageRuntime::GetPluginName() { - return pluginName; -} - -const char * -ItaniumABILanguageRuntime::GetShortPluginName() -{ - return pluginShort; + return GetPluginNameStatic(); } uint32_t diff --git a/lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.h b/lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.h index c9165f446ee..6b2c437de25 100644 --- a/lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.h +++ b/lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.h @@ -52,15 +52,15 @@ namespace lldb_private { static lldb_private::LanguageRuntime * CreateInstance (Process *process, lldb::LanguageType language); + static lldb_private::ConstString + GetPluginNameStatic(); + //------------------------------------------------------------------ // PluginInterface protocol //------------------------------------------------------------------ - virtual const char * + virtual lldb_private::ConstString GetPluginName(); - virtual const char * - GetShortPluginName(); - virtual uint32_t GetPluginVersion(); diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp index 76398f54886..0de4cb9428f 100644 --- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp +++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp @@ -37,11 +37,6 @@ using namespace lldb; using namespace lldb_private; -static const char *pluginName = "AppleObjCRuntimeV1"; -static const char *pluginDesc = "Apple Objective C Language Runtime - Version 1"; -static const char *pluginShort = "language.apple.objc.v1"; - - AppleObjCRuntimeV1::AppleObjCRuntimeV1(Process *process) : AppleObjCRuntime (process), m_hash_signature (), @@ -96,8 +91,8 @@ AppleObjCRuntimeV1::CreateInstance (Process *process, lldb::LanguageType languag void AppleObjCRuntimeV1::Initialize() { - PluginManager::RegisterPlugin (pluginName, - pluginDesc, + PluginManager::RegisterPlugin (GetPluginNameStatic(), + "Apple Objective C Language Runtime - Version 1", CreateInstance); } @@ -107,19 +102,20 @@ AppleObjCRuntimeV1::Terminate() PluginManager::UnregisterPlugin (CreateInstance); } +lldb_private::ConstString +AppleObjCRuntimeV1::GetPluginNameStatic() +{ + static ConstString g_name("apple-objc-v1"); + return g_name; +} + //------------------------------------------------------------------ // PluginInterface protocol //------------------------------------------------------------------ -const char * +ConstString AppleObjCRuntimeV1::GetPluginName() { - return pluginName; -} - -const char * -AppleObjCRuntimeV1::GetShortPluginName() -{ - return pluginShort; + return GetPluginNameStatic(); } uint32_t diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.h b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.h index af58ac7e768..ba8ecc2bbcb 100644 --- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.h +++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.h @@ -114,15 +114,15 @@ public: static lldb_private::LanguageRuntime * CreateInstance (Process *process, lldb::LanguageType language); + static lldb_private::ConstString + GetPluginNameStatic(); + //------------------------------------------------------------------ // PluginInterface protocol //------------------------------------------------------------------ - virtual const char * + virtual ConstString GetPluginName(); - virtual const char * - GetShortPluginName(); - virtual uint32_t GetPluginVersion(); diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp index daa566eb2bc..2df1ac9d03b 100644 --- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp +++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp @@ -50,10 +50,6 @@ using namespace lldb; using namespace lldb_private; -static const char *pluginName = "AppleObjCRuntimeV2"; -static const char *pluginDesc = "Apple Objective C Language Runtime - Version 2"; -static const char *pluginShort = "language.apple.objc.v2"; - // 2 second timeout when running utility functions #define UTILITY_FUNCTION_TIMEOUT_USEC 2*1000*1000 @@ -427,8 +423,8 @@ AppleObjCRuntimeV2::CreateInstance (Process *process, LanguageType language) void AppleObjCRuntimeV2::Initialize() { - PluginManager::RegisterPlugin (pluginName, - pluginDesc, + PluginManager::RegisterPlugin (GetPluginNameStatic(), + "Apple Objective C Language Runtime - Version 2", CreateInstance); } @@ -438,19 +434,21 @@ AppleObjCRuntimeV2::Terminate() PluginManager::UnregisterPlugin (CreateInstance); } +lldb_private::ConstString +AppleObjCRuntimeV2::GetPluginNameStatic() +{ + static ConstString g_name("apple-objc-v2"); + return g_name; +} + + //------------------------------------------------------------------ // PluginInterface protocol //------------------------------------------------------------------ -const char * +lldb_private::ConstString AppleObjCRuntimeV2::GetPluginName() { - return pluginName; -} - -const char * -AppleObjCRuntimeV2::GetShortPluginName() -{ - return pluginShort; + return GetPluginNameStatic(); } uint32_t diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h index ae2e6f35ab0..54cc3b86b1a 100644 --- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h +++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h @@ -55,15 +55,15 @@ public: static lldb_private::LanguageRuntime * CreateInstance (Process *process, lldb::LanguageType language); + static lldb_private::ConstString + GetPluginNameStatic(); + //------------------------------------------------------------------ // PluginInterface protocol //------------------------------------------------------------------ - virtual const char * + virtual ConstString GetPluginName(); - virtual const char * - GetShortPluginName(); - virtual uint32_t GetPluginVersion(); diff --git a/lldb/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp b/lldb/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp index a5e87fc358d..109e429fc7f 100644 --- a/lldb/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp +++ b/lldb/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp @@ -148,11 +148,29 @@ ObjectContainerBSDArchive::Archive::ParseObjects () } ObjectContainerBSDArchive::Object * -ObjectContainerBSDArchive::Archive::FindObject (const ConstString &object_name) +ObjectContainerBSDArchive::Archive::FindObject (const ConstString &object_name, const TimeValue &object_mod_time) { const ObjectNameToIndexMap::Entry *match = m_object_name_to_index_map.FindFirstValueForName (object_name.GetCString()); if (match) - return &m_objects[match->value]; + { + if (object_mod_time.IsValid()) + { + const uint64_t object_date = object_mod_time.GetAsSecondsSinceJan1_1970(); + if (m_objects[match->value].ar_date == object_date) + return &m_objects[match->value]; + const ObjectNameToIndexMap::Entry *next_match = m_object_name_to_index_map.FindNextValueForName (match); + while (next_match) + { + if (m_objects[next_match->value].ar_date == object_date) + return &m_objects[next_match->value]; + next_match = m_object_name_to_index_map.FindNextValueForName (next_match); + } + } + else + { + return &m_objects[match->value]; + } + } return NULL; } @@ -250,10 +268,11 @@ ObjectContainerBSDArchive::Terminate() } -const char * +lldb_private::ConstString ObjectContainerBSDArchive::GetPluginNameStatic() { - return "object-container.bsd-archive"; + static ConstString g_name("bsd-archive"); + return g_name; } const char * @@ -297,11 +316,11 @@ ObjectContainerBSDArchive::CreateInstance Archive::shared_ptr archive_sp (Archive::FindCachedArchive (*file, module_sp->GetArchitecture(), module_sp->GetModificationTime())); std::unique_ptr<ObjectContainerBSDArchive> container_ap(new ObjectContainerBSDArchive (module_sp, - archive_data_sp, - archive_data_offset, - file, - file_offset, - length)); + archive_data_sp, + archive_data_offset, + file, + file_offset, + length)); if (container_ap.get()) { @@ -434,7 +453,8 @@ ObjectContainerBSDArchive::GetObjectFile (const FileSpec *file) { if (module_sp->GetObjectName() && m_archive_sp) { - Object *object = m_archive_sp->FindObject (module_sp->GetObjectName()); + Object *object = m_archive_sp->FindObject (module_sp->GetObjectName(), + module_sp->GetObjectModificationTime()); if (object) { lldb::offset_t data_offset = m_offset + object->ar_file_offset; @@ -454,15 +474,9 @@ ObjectContainerBSDArchive::GetObjectFile (const FileSpec *file) //------------------------------------------------------------------ // PluginInterface protocol //------------------------------------------------------------------ -const char * +lldb_private::ConstString ObjectContainerBSDArchive::GetPluginName() { - return "object-container.bsd-archive"; -} - -const char * -ObjectContainerBSDArchive::GetShortPluginName() -{ return GetPluginNameStatic(); } diff --git a/lldb/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.h b/lldb/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.h index 7802eb152d5..a44bb80a965 100644 --- a/lldb/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.h +++ b/lldb/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.h @@ -32,7 +32,7 @@ public: static void Terminate(); - static const char * + static lldb_private::ConstString GetPluginNameStatic(); static const char * @@ -89,12 +89,9 @@ public: //------------------------------------------------------------------ // PluginInterface protocol //------------------------------------------------------------------ - virtual const char * + virtual lldb_private::ConstString GetPluginName(); - virtual const char * - GetShortPluginName(); - virtual uint32_t GetPluginVersion(); @@ -163,7 +160,8 @@ protected: ParseObjects (); Object * - FindObject (const lldb_private::ConstString &object_name); + FindObject (const lldb_private::ConstString &object_name, + const lldb_private::TimeValue &object_mod_time); const lldb_private::TimeValue & GetModificationTime() diff --git a/lldb/source/Plugins/ObjectContainer/Universal-Mach-O/ObjectContainerUniversalMachO.cpp b/lldb/source/Plugins/ObjectContainer/Universal-Mach-O/ObjectContainerUniversalMachO.cpp index d1f4434c987..f28aa3bed05 100644 --- a/lldb/source/Plugins/ObjectContainer/Universal-Mach-O/ObjectContainerUniversalMachO.cpp +++ b/lldb/source/Plugins/ObjectContainer/Universal-Mach-O/ObjectContainerUniversalMachO.cpp @@ -37,10 +37,11 @@ ObjectContainerUniversalMachO::Terminate() } -const char * +lldb_private::ConstString ObjectContainerUniversalMachO::GetPluginNameStatic() { - return "object-container.mach-o"; + static ConstString g_name("mach-o"); + return g_name; } const char * @@ -259,15 +260,9 @@ ObjectContainerUniversalMachO::GetObjectFile (const FileSpec *file) //------------------------------------------------------------------ // PluginInterface protocol //------------------------------------------------------------------ -const char * +lldb_private::ConstString ObjectContainerUniversalMachO::GetPluginName() { - return "ObjectContainerUniversalMachO"; -} - -const char * -ObjectContainerUniversalMachO::GetShortPluginName() -{ return GetPluginNameStatic(); } diff --git a/lldb/source/Plugins/ObjectContainer/Universal-Mach-O/ObjectContainerUniversalMachO.h b/lldb/source/Plugins/ObjectContainer/Universal-Mach-O/ObjectContainerUniversalMachO.h index 1fe1a2d2165..0c4a3d47c7a 100644 --- a/lldb/source/Plugins/ObjectContainer/Universal-Mach-O/ObjectContainerUniversalMachO.h +++ b/lldb/source/Plugins/ObjectContainer/Universal-Mach-O/ObjectContainerUniversalMachO.h @@ -28,7 +28,7 @@ public: static void Terminate(); - static const char * + static lldb_private::ConstString GetPluginNameStatic(); static const char * @@ -84,12 +84,9 @@ public: //------------------------------------------------------------------ // PluginInterface protocol //------------------------------------------------------------------ - virtual const char * + virtual lldb_private::ConstString GetPluginName(); - virtual const char * - GetShortPluginName(); - virtual uint32_t GetPluginVersion(); diff --git a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp index 4ba081a7b7c..f4af192e38b 100644 --- a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp +++ b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp @@ -160,10 +160,11 @@ ObjectFileELF::Terminate() PluginManager::UnregisterPlugin(CreateInstance); } -const char * +lldb_private::ConstString ObjectFileELF::GetPluginNameStatic() { - return "object-file.elf"; + static ConstString g_name("elf"); + return g_name; } const char * @@ -236,15 +237,9 @@ ObjectFileELF::GetModuleSpecifications (const lldb_private::FileSpec& file, //------------------------------------------------------------------ // PluginInterface protocol //------------------------------------------------------------------ -const char * +lldb_private::ConstString ObjectFileELF::GetPluginName() { - return "ObjectFileELF"; -} - -const char * -ObjectFileELF::GetShortPluginName() -{ return GetPluginNameStatic(); } diff --git a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.h b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.h index 78cfb3f5157..cdf2731b254 100644 --- a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.h +++ b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.h @@ -38,7 +38,7 @@ public: static void Terminate(); - static const char * + static lldb_private::ConstString GetPluginNameStatic(); static const char * @@ -68,12 +68,9 @@ public: //------------------------------------------------------------------ // PluginInterface protocol //------------------------------------------------------------------ - virtual const char * + virtual lldb_private::ConstString GetPluginName(); - virtual const char * - GetShortPluginName(); - virtual uint32_t GetPluginVersion(); diff --git a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp index b94ebca297d..7047395bdc7 100644 --- a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp +++ b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp @@ -379,10 +379,11 @@ ObjectFileMachO::Terminate() } -const char * +lldb_private::ConstString ObjectFileMachO::GetPluginNameStatic() { - return "object-file.mach-o"; + static ConstString g_name("mach-o"); + return g_name; } const char * @@ -4169,15 +4170,9 @@ ObjectFileMachO::GetLLDBSharedCacheUUID () //------------------------------------------------------------------ // PluginInterface protocol //------------------------------------------------------------------ -const char * +lldb_private::ConstString ObjectFileMachO::GetPluginName() { - return "ObjectFileMachO"; -} - -const char * -ObjectFileMachO::GetShortPluginName() -{ return GetPluginNameStatic(); } diff --git a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.h b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.h index 2226e3dd695..349928e9538 100644 --- a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.h +++ b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.h @@ -35,7 +35,7 @@ public: static void Terminate(); - static const char * + static lldb_private::ConstString GetPluginNameStatic(); static const char * @@ -122,12 +122,9 @@ public: //------------------------------------------------------------------ // PluginInterface protocol //------------------------------------------------------------------ - virtual const char * + virtual lldb_private::ConstString GetPluginName(); - virtual const char * - GetShortPluginName(); - virtual uint32_t GetPluginVersion(); diff --git a/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp b/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp index 157b148ee5c..b25db97d498 100644 --- a/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp +++ b/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp @@ -133,10 +133,11 @@ ObjectFilePECOFF::Terminate() } -const char * +lldb_private::ConstString ObjectFilePECOFF::GetPluginNameStatic() { - return "object-file.pe-coff"; + static ConstString g_name("pe-coff"); + return g_name; } const char * @@ -954,15 +955,9 @@ ObjectFilePECOFF::CalculateStrata() //------------------------------------------------------------------ // PluginInterface protocol //------------------------------------------------------------------ -const char * +ConstString ObjectFilePECOFF::GetPluginName() { - return "ObjectFilePECOFF"; -} - -const char * -ObjectFilePECOFF::GetShortPluginName() -{ return GetPluginNameStatic(); } diff --git a/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h b/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h index 33973abad02..d980006eab6 100644 --- a/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h +++ b/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h @@ -28,7 +28,7 @@ public: static void Terminate(); - static const char * + static lldb_private::ConstString GetPluginNameStatic(); static const char * @@ -106,12 +106,9 @@ public: //------------------------------------------------------------------ // PluginInterface protocol //------------------------------------------------------------------ - virtual const char * + virtual lldb_private::ConstString GetPluginName(); - virtual const char * - GetShortPluginName(); - virtual uint32_t GetPluginVersion(); // diff --git a/lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp b/lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp index 1af044e00e2..67b5c4f7088 100644 --- a/lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp +++ b/lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp @@ -69,10 +69,11 @@ OperatingSystemPython::CreateInstance (Process *process, bool force) } -const char * +ConstString OperatingSystemPython::GetPluginNameStatic() { - return "python"; + static ConstString g_name("python"); + return g_name; } const char * @@ -152,15 +153,9 @@ OperatingSystemPython::GetDynamicRegisterInfo () //------------------------------------------------------------------ // PluginInterface protocol //------------------------------------------------------------------ -const char * +ConstString OperatingSystemPython::GetPluginName() { - return "OperatingSystemPython"; -} - -const char * -OperatingSystemPython::GetShortPluginName() -{ return GetPluginNameStatic(); } diff --git a/lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.h b/lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.h index 0055058192c..077039e50d5 100644 --- a/lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.h +++ b/lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.h @@ -34,7 +34,7 @@ public: static void Terminate(); - static const char * + static lldb_private::ConstString GetPluginNameStatic(); static const char * @@ -52,12 +52,9 @@ public: //------------------------------------------------------------------ // lldb_private::PluginInterface Methods //------------------------------------------------------------------ - virtual const char * + virtual lldb_private::ConstString GetPluginName(); - virtual const char * - GetShortPluginName(); - virtual uint32_t GetPluginVersion(); diff --git a/lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp b/lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp index 07846c81cc7..0c2c46f84dd 100644 --- a/lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp +++ b/lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp @@ -85,19 +85,19 @@ PlatformFreeBSD::CreateInstance (bool force, const lldb_private::ArchSpec *arch) } -const char * -PlatformFreeBSD::GetPluginNameStatic() -{ - return "plugin.platform.freebsd"; -} - -const char * -PlatformFreeBSD::GetShortPluginNameStatic (bool is_host) +lldb_private::ConstString +PlatformFreeBSD::GetPluginNameStatic (bool is_host) { if (is_host) - return Platform::GetHostPlatformName (); + { + static ConstString g_host_name(Platform::GetHostPlatformName ()); + return g_host_name; + } else - return "remote-freebsd"; + { + static ConstString g_remote_name("remote-freebsd"); + return g_remote_name; + } } const char * @@ -122,7 +122,7 @@ PlatformFreeBSD::Initialize () default_platform_sp->SetSystemArchitecture (Host::GetArchitecture()); Platform::SetDefaultPlatform (default_platform_sp); #endif - PluginManager::RegisterPlugin(PlatformFreeBSD::GetShortPluginNameStatic(false), + PluginManager::RegisterPlugin(PlatformFreeBSD::GetPluginNameStatic(false), PlatformFreeBSD::GetDescriptionStatic(false), PlatformFreeBSD::CreateInstance); } @@ -269,7 +269,7 @@ PlatformFreeBSD::ResolveExecutable (const FileSpec &exe_file, { error.SetErrorStringWithFormat ("'%s' doesn't contain any '%s' platform architectures: %s", exe_file.GetPath().c_str(), - GetShortPluginName(), + GetPluginName().GetCString(), arch_names.GetString().c_str()); } } @@ -377,7 +377,7 @@ PlatformFreeBSD::ConnectRemote (Args& args) Error error; if (IsHost()) { - error.SetErrorStringWithFormat ("can't connect to the host platform '%s', always connected", GetShortPluginName()); + error.SetErrorStringWithFormat ("can't connect to the host platform '%s', always connected", GetPluginName().GetCString()); } else { @@ -415,7 +415,7 @@ PlatformFreeBSD::DisconnectRemote () if (IsHost()) { - error.SetErrorStringWithFormat ("can't disconnect from the host platform '%s', always connected", GetShortPluginName()); + error.SetErrorStringWithFormat ("can't disconnect from the host platform '%s', always connected", GetPluginName().GetCString()); } else { diff --git a/lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.h b/lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.h index 80c4a63e0a8..4aa158eb6e8 100644 --- a/lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.h +++ b/lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.h @@ -33,14 +33,11 @@ public: static void Terminate (); - static const char * - GetPluginNameStatic(); - - static const char * - GetShortPluginNameStatic(bool is_host); + static lldb_private::ConstString + GetPluginNameStatic (bool is_host); static const char * - GetDescriptionStatic(bool is_host); + GetDescriptionStatic (bool is_host); //------------------------------------------------------------ // Class Methods @@ -53,16 +50,10 @@ public: //------------------------------------------------------------ // lldb_private::PluginInterface functions //------------------------------------------------------------ - virtual const char * + virtual lldb_private::ConstString GetPluginName() { - return GetPluginNameStatic(); - } - - virtual const char * - GetShortPluginName() - { - return GetShortPluginNameStatic (IsHost()); + return GetPluginNameStatic (IsHost()); } virtual uint32_t diff --git a/lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp b/lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp index 1078a23443f..ef4bd41dc78 100644 --- a/lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp +++ b/lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp @@ -86,19 +86,20 @@ PlatformLinux::CreateInstance (bool force, const ArchSpec *arch) return NULL; } -const char * -PlatformLinux::GetPluginNameStatic() -{ - return "plugin.platform.linux"; -} -const char * -PlatformLinux::GetShortPluginNameStatic (bool is_host) +lldb_private::ConstString +PlatformLinux::GetPluginNameStatic (bool is_host) { if (is_host) - return Platform::GetHostPlatformName (); + { + static ConstString g_host_name(Platform::GetHostPlatformName ()); + return g_host_name; + } else - return "remote-linux"; + { + static ConstString g_remote_name("remote-linux"); + return g_remote_name; + } } const char * @@ -110,6 +111,12 @@ PlatformLinux::GetPluginDescriptionStatic (bool is_host) return "Remote Linux user platform plug-in."; } +lldb_private::ConstString +PlatformLinux::GetPluginName() +{ + return GetPluginNameStatic(IsHost()); +} + void PlatformLinux::Initialize () { @@ -120,7 +127,7 @@ PlatformLinux::Initialize () default_platform_sp->SetSystemArchitecture (Host::GetArchitecture()); Platform::SetDefaultPlatform (default_platform_sp); #endif - PluginManager::RegisterPlugin(PlatformLinux::GetShortPluginNameStatic(false), + PluginManager::RegisterPlugin(PlatformLinux::GetPluginNameStatic(false), PlatformLinux::GetPluginDescriptionStatic(false), PlatformLinux::CreateInstance); } @@ -242,7 +249,7 @@ PlatformLinux::ResolveExecutable (const FileSpec &exe_file, { error.SetErrorStringWithFormat ("'%s' doesn't contain any '%s' platform architectures: %s", exe_file.GetPath().c_str(), - GetShortPluginName(), + GetPluginName().GetCString(), arch_names.GetString().c_str()); } } diff --git a/lldb/source/Plugins/Platform/Linux/PlatformLinux.h b/lldb/source/Plugins/Platform/Linux/PlatformLinux.h index 8b43def165b..a77780d59a2 100644 --- a/lldb/source/Plugins/Platform/Linux/PlatformLinux.h +++ b/lldb/source/Plugins/Platform/Linux/PlatformLinux.h @@ -39,26 +39,14 @@ namespace lldb_private { static Platform * CreateInstance (bool force, const lldb_private::ArchSpec *arch); - static const char * - GetPluginNameStatic(); - - static const char * - GetShortPluginNameStatic(bool is_host); + static lldb_private::ConstString + GetPluginNameStatic (bool is_host); static const char * - GetPluginDescriptionStatic(bool is_host); + GetPluginDescriptionStatic (bool is_host); - virtual const char * - GetPluginName() - { - return GetPluginNameStatic(); - } - - virtual const char * - GetShortPluginName() - { - return "PlatformLinux"; - } + virtual lldb_private::ConstString + GetPluginName(); virtual uint32_t GetPluginVersion() diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp index b3775d410ae..b958e0fe870 100644 --- a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp @@ -232,7 +232,7 @@ PlatformDarwin::ResolveExecutable (const FileSpec &exe_file, { error.SetErrorStringWithFormat ("'%s' doesn't contain any '%s' platform architectures: %s", exe_file.GetPath().c_str(), - GetShortPluginName(), + GetPluginName().GetCString(), arch_names.GetString().c_str()); } } @@ -501,7 +501,7 @@ PlatformDarwin::ConnectRemote (Args& args) Error error; if (IsHost()) { - error.SetErrorStringWithFormat ("can't connect to the host platform '%s', always connected", GetShortPluginName()); + error.SetErrorStringWithFormat ("can't connect to the host platform '%s', always connected", GetPluginName().GetCString()); } else { @@ -539,7 +539,7 @@ PlatformDarwin::DisconnectRemote () if (IsHost()) { - error.SetErrorStringWithFormat ("can't disconnect from the host platform '%s', always connected", GetShortPluginName()); + error.SetErrorStringWithFormat ("can't disconnect from the host platform '%s', always connected", GetPluginName().GetCString()); } else { diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp index 6b6b8030608..104285f19b6 100644 --- a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp @@ -53,7 +53,7 @@ PlatformDarwinKernel::Initialize () { if (g_initialize_count++ == 0) { - PluginManager::RegisterPlugin (PlatformDarwinKernel::GetShortPluginNameStatic(), + PluginManager::RegisterPlugin (PlatformDarwinKernel::GetPluginNameStatic(), PlatformDarwinKernel::GetDescriptionStatic(), PlatformDarwinKernel::CreateInstance, PlatformDarwinKernel::DebuggerInitialize); @@ -147,16 +147,11 @@ PlatformDarwinKernel::CreateInstance (bool force, const ArchSpec *arch) } -const char * +lldb_private::ConstString PlatformDarwinKernel::GetPluginNameStatic () { - return "PlatformDarwinKernel"; -} - -const char * -PlatformDarwinKernel::GetShortPluginNameStatic() -{ - return "darwin-kernel"; + static ConstString g_name("darwin-kernel"); + return g_name; } const char * diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.h b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.h index 0b9b93677e5..3d2035f64f9 100644 --- a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.h +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.h @@ -40,13 +40,10 @@ public: static void Terminate (); - static const char * + static lldb_private::ConstString GetPluginNameStatic (); static const char * - GetShortPluginNameStatic(); - - static const char * GetDescriptionStatic(); //------------------------------------------------------------ @@ -60,18 +57,12 @@ public: //------------------------------------------------------------ // lldb_private::PluginInterface functions //------------------------------------------------------------ - virtual const char * + virtual lldb_private::ConstString GetPluginName() { return GetPluginNameStatic(); } - virtual const char * - GetShortPluginName() - { - return GetShortPluginNameStatic(); - } - virtual uint32_t GetPluginVersion() { diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp index cf783119a1d..16bcafd97b8 100644 --- a/lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp @@ -41,7 +41,7 @@ PlatformMacOSX::Initialize () default_platform_sp->SetSystemArchitecture (Host::GetArchitecture()); Platform::SetDefaultPlatform (default_platform_sp); #endif - PluginManager::RegisterPlugin (PlatformMacOSX::GetShortPluginNameStatic(false), + PluginManager::RegisterPlugin (PlatformMacOSX::GetPluginNameStatic(false), PlatformMacOSX::GetDescriptionStatic(false), PlatformMacOSX::CreateInstance); } @@ -115,20 +115,19 @@ PlatformMacOSX::CreateInstance (bool force, const ArchSpec *arch) return NULL; } - -const char * -PlatformMacOSX::GetPluginNameStatic () -{ - return "PlatformMacOSX"; -} - -const char * -PlatformMacOSX::GetShortPluginNameStatic (bool is_host) +lldb_private::ConstString +PlatformMacOSX::GetPluginNameStatic (bool is_host) { if (is_host) - return Platform::GetHostPlatformName (); + { + static ConstString g_host_name(Platform::GetHostPlatformName ()); + return g_host_name; + } else - return "remote-macosx"; + { + static ConstString g_remote_name("remote-macosx"); + return g_remote_name; + } } const char * diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.h b/lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.h index 3a5eaf0072a..b93c5fa6921 100644 --- a/lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.h +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.h @@ -32,11 +32,8 @@ public: static void Terminate (); - static const char * - GetPluginNameStatic (); - - static const char * - GetShortPluginNameStatic(bool is_host); + static lldb_private::ConstString + GetPluginNameStatic (bool is_host); static const char * GetDescriptionStatic(bool is_host); @@ -52,16 +49,10 @@ public: //------------------------------------------------------------ // lldb_private::PluginInterface functions //------------------------------------------------------------ - virtual const char * + virtual lldb_private::ConstString GetPluginName() { - return GetPluginNameStatic (); - } - - virtual const char * - GetShortPluginName() - { - return GetShortPluginNameStatic (IsHost()); + return GetPluginNameStatic (IsHost()); } virtual uint32_t diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp index fe6d358e6fc..7969aa819cf 100644 --- a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp @@ -65,7 +65,7 @@ PlatformRemoteiOS::Initialize () { if (g_initialize_count++ == 0) { - PluginManager::RegisterPlugin (PlatformRemoteiOS::GetShortPluginNameStatic(), + PluginManager::RegisterPlugin (PlatformRemoteiOS::GetPluginNameStatic(), PlatformRemoteiOS::GetDescriptionStatic(), PlatformRemoteiOS::CreateInstance); } @@ -148,16 +148,11 @@ PlatformRemoteiOS::CreateInstance (bool force, const ArchSpec *arch) } -const char * +lldb_private::ConstString PlatformRemoteiOS::GetPluginNameStatic () { - return "PlatformRemoteiOS"; -} - -const char * -PlatformRemoteiOS::GetShortPluginNameStatic() -{ - return "remote-ios"; + static ConstString g_name("remote-ios"); + return g_name; } const char * @@ -279,7 +274,7 @@ PlatformRemoteiOS::ResolveExecutable (const FileSpec &exe_file, { error.SetErrorStringWithFormat ("'%s' doesn't contain any '%s' platform architectures: %s", exe_file.GetPath().c_str(), - GetShortPluginName(), + GetPluginName().GetCString(), arch_names.GetString().c_str()); } } @@ -661,7 +656,7 @@ PlatformRemoteiOS::GetSymbolFile (const FileSpec &platform_file, error.SetErrorStringWithFormat ("unable to locate a platform file for '%s' in platform '%s'", platform_file_path, - GetPluginName()); + GetPluginName().GetCString()); } else { diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.h b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.h index d52c6b09df7..ef59b124d8e 100644 --- a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.h +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.h @@ -34,13 +34,10 @@ public: static void Terminate (); - static const char * + static lldb_private::ConstString GetPluginNameStatic (); static const char * - GetShortPluginNameStatic(); - - static const char * GetDescriptionStatic(); //------------------------------------------------------------ @@ -54,18 +51,12 @@ public: //------------------------------------------------------------ // lldb_private::PluginInterface functions //------------------------------------------------------------ - virtual const char * + virtual lldb_private::ConstString GetPluginName() { return GetPluginNameStatic(); } - virtual const char * - GetShortPluginName() - { - return GetShortPluginNameStatic(); - } - virtual uint32_t GetPluginVersion() { diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp index 5f1cfc8dc86..806eb7d60ea 100644 --- a/lldb/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp @@ -42,7 +42,7 @@ PlatformiOSSimulator::Initialize () { if (g_initialize_count++ == 0) { - PluginManager::RegisterPlugin (PlatformiOSSimulator::GetShortPluginNameStatic(), + PluginManager::RegisterPlugin (PlatformiOSSimulator::GetPluginNameStatic(), PlatformiOSSimulator::GetDescriptionStatic(), PlatformiOSSimulator::CreateInstance); } @@ -124,16 +124,11 @@ PlatformiOSSimulator::CreateInstance (bool force, const ArchSpec *arch) } -const char * +lldb_private::ConstString PlatformiOSSimulator::GetPluginNameStatic () { - return "PlatformiOSSimulator"; -} - -const char * -PlatformiOSSimulator::GetShortPluginNameStatic() -{ - return "ios-simulator"; + static ConstString g_name("ios-simulator"); + return g_name; } const char * @@ -242,7 +237,7 @@ PlatformiOSSimulator::ResolveExecutable (const FileSpec &exe_file, { error.SetErrorStringWithFormat ("'%s' doesn't contain any '%s' platform architectures: %s", exe_file.GetPath().c_str(), - GetShortPluginName(), + GetPluginName().GetCString(), arch_names.GetString().c_str()); } } @@ -352,7 +347,7 @@ PlatformiOSSimulator::GetFile (const FileSpec &platform_file, } error.SetErrorStringWithFormat ("unable to locate a platform file for '%s' in platform '%s'", platform_file_path, - GetPluginName()); + GetPluginName().GetCString()); } else { diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.h b/lldb/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.h index 36b554b5404..ce818c431a7 100644 --- a/lldb/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.h +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.h @@ -32,13 +32,10 @@ public: static void Terminate (); - static const char * + static lldb_private::ConstString GetPluginNameStatic (); static const char * - GetShortPluginNameStatic(); - - static const char * GetDescriptionStatic(); //------------------------------------------------------------ @@ -52,18 +49,12 @@ public: //------------------------------------------------------------ // lldb_private::PluginInterface functions //------------------------------------------------------------ - virtual const char * + virtual lldb_private::ConstString GetPluginName() { return GetPluginNameStatic(); } - virtual const char * - GetShortPluginName() - { - return GetShortPluginNameStatic(); - } - virtual uint32_t GetPluginVersion() { diff --git a/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp b/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp index cc7a2193867..221001b7ca0 100644 --- a/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp +++ b/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp @@ -41,7 +41,7 @@ PlatformRemoteGDBServer::Initialize () if (g_initialized == false) { g_initialized = true; - PluginManager::RegisterPlugin (PlatformRemoteGDBServer::GetShortPluginNameStatic(), + PluginManager::RegisterPlugin (PlatformRemoteGDBServer::GetPluginNameStatic(), PlatformRemoteGDBServer::GetDescriptionStatic(), PlatformRemoteGDBServer::CreateInstance); } @@ -71,10 +71,11 @@ PlatformRemoteGDBServer::CreateInstance (bool force, const lldb_private::ArchSpe } -const char * -PlatformRemoteGDBServer::GetShortPluginNameStatic() +lldb_private::ConstString +PlatformRemoteGDBServer::GetPluginNameStatic() { - return "remote-gdb-server"; + static ConstString g_name("remote-gdb-server"); + return g_name; } const char * diff --git a/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h b/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h index ad2ffa53194..22b3dd49be5 100644 --- a/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h +++ b/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h @@ -32,8 +32,8 @@ public: static lldb_private::Platform* CreateInstance (bool force, const lldb_private::ArchSpec *arch); - static const char * - GetShortPluginNameStatic(); + static lldb_private::ConstString + GetPluginNameStatic(); static const char * GetDescriptionStatic(); @@ -47,16 +47,10 @@ public: //------------------------------------------------------------ // lldb_private::PluginInterface functions //------------------------------------------------------------ - virtual const char * + virtual lldb_private::ConstString GetPluginName() { - return "PlatformRemoteGDBServer"; - } - - virtual const char * - GetShortPluginName() - { - return GetShortPluginNameStatic(); + return GetPluginNameStatic(); } virtual uint32_t diff --git a/lldb/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp b/lldb/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp index 19e332e2a51..ea26d972b86 100644 --- a/lldb/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp +++ b/lldb/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp @@ -64,10 +64,11 @@ ProcessFreeBSD::Initialize() } } -const char * +lldb_private::ConstString ProcessFreeBSD::GetPluginNameStatic() { - return "freebsd"; + static ConstString g_name("freebsd"); + return g_name; } const char * @@ -79,16 +80,10 @@ ProcessFreeBSD::GetPluginDescriptionStatic() //------------------------------------------------------------------------------ // ProcessInterface protocol. -const char * +lldb_private::ConstString ProcessFreeBSD::GetPluginName() { - return "process.freebsd"; -} - -const char * -ProcessFreeBSD::GetShortPluginName() -{ - return "process.freebsd"; + return GetPluginNameStatic(); } uint32_t diff --git a/lldb/source/Plugins/Process/FreeBSD/ProcessFreeBSD.h b/lldb/source/Plugins/Process/FreeBSD/ProcessFreeBSD.h index 74996f13127..5f79b74cad3 100644 --- a/lldb/source/Plugins/Process/FreeBSD/ProcessFreeBSD.h +++ b/lldb/source/Plugins/Process/FreeBSD/ProcessFreeBSD.h @@ -42,7 +42,7 @@ public: static void Terminate(); - static const char * + static lldb_private::ConstString GetPluginNameStatic(); static const char * @@ -60,12 +60,9 @@ public: //------------------------------------------------------------------ // PluginInterface protocol //------------------------------------------------------------------ - virtual const char * + virtual lldb_private::ConstString GetPluginName(); - virtual const char * - GetShortPluginName(); - virtual uint32_t GetPluginVersion(); diff --git a/lldb/source/Plugins/Process/Linux/ProcessLinux.cpp b/lldb/source/Plugins/Process/Linux/ProcessLinux.cpp index 6118a0976f7..5d93502823e 100644 --- a/lldb/source/Plugins/Process/Linux/ProcessLinux.cpp +++ b/lldb/source/Plugins/Process/Linux/ProcessLinux.cpp @@ -81,10 +81,11 @@ void ProcessLinux::Terminate() { } -const char * +lldb_private::ConstString ProcessLinux::GetPluginNameStatic() { - return "linux"; + static ConstString g_name("linux"); + return g_name; } const char * @@ -105,16 +106,10 @@ ProcessLinux::UpdateThreadList(ThreadList &old_thread_list, ThreadList &new_thre //------------------------------------------------------------------------------ // ProcessInterface protocol. -const char * +lldb_private::ConstString ProcessLinux::GetPluginName() { - return "process.linux"; -} - -const char * -ProcessLinux::GetShortPluginName() -{ - return "process.linux"; + return GetPluginNameStatic(); } uint32_t diff --git a/lldb/source/Plugins/Process/Linux/ProcessLinux.h b/lldb/source/Plugins/Process/Linux/ProcessLinux.h index 9acbf49f5f0..e65f1fac8b7 100644 --- a/lldb/source/Plugins/Process/Linux/ProcessLinux.h +++ b/lldb/source/Plugins/Process/Linux/ProcessLinux.h @@ -41,7 +41,7 @@ public: static void Terminate(); - static const char * + static lldb_private::ConstString GetPluginNameStatic(); static const char * @@ -58,12 +58,9 @@ public: //------------------------------------------------------------------ // PluginInterface protocol //------------------------------------------------------------------ - virtual const char * + virtual lldb_private::ConstString GetPluginName(); - virtual const char * - GetShortPluginName(); - virtual uint32_t GetPluginVersion(); diff --git a/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp b/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp index 18007369e83..ef97079dca3 100644 --- a/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp +++ b/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp @@ -46,10 +46,11 @@ using namespace lldb_private; static const lldb::tid_t g_kernel_tid = 1; -const char * +ConstString ProcessKDP::GetPluginNameStatic() { - return "kdp-remote"; + static ConstString g_name("kdp-remote"); + return g_name; } const char * @@ -141,15 +142,9 @@ ProcessKDP::~ProcessKDP() //---------------------------------------------------------------------- // PluginInterface //---------------------------------------------------------------------- -const char * +lldb_private::ConstString ProcessKDP::GetPluginName() { - return "Process debugging plug-in that uses the Darwin KDP remote protocol"; -} - -const char * -ProcessKDP::GetShortPluginName() -{ return GetPluginNameStatic(); } diff --git a/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.h b/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.h index 1dff43f1090..0075c7ce188 100644 --- a/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.h +++ b/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.h @@ -49,7 +49,7 @@ public: static void Terminate(); - static const char * + static lldb_private::ConstString GetPluginNameStatic(); static const char * @@ -113,12 +113,9 @@ public: //------------------------------------------------------------------ // PluginInterface protocol //------------------------------------------------------------------ - virtual const char * + virtual lldb_private::ConstString GetPluginName(); - virtual const char * - GetShortPluginName(); - virtual uint32_t GetPluginVersion(); diff --git a/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDPLog.cpp b/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDPLog.cpp index a9f572c090b..79cb62aa006 100644 --- a/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDPLog.cpp +++ b/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDPLog.cpp @@ -167,7 +167,8 @@ ProcessKDPLog::ListLogCategories (Stream *strm) " thread - log thread events and activities\n" " step - log step related activities\n" " verbose - enable verbose logging\n" - " watch - log watchpoint related activities\n", ProcessKDP::GetPluginNameStatic()); + " watch - log watchpoint related activities\n", + ProcessKDP::GetPluginNameStatic().GetCString()); } diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp index 0008dbfa288..3475bab3bca 100644 --- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp @@ -116,10 +116,11 @@ get_random_port () } -const char * +lldb_private::ConstString ProcessGDBRemote::GetPluginNameStatic() { - return "gdb-remote"; + static ConstString g_name("gdb-remote"); + return g_name; } const char * @@ -233,15 +234,9 @@ ProcessGDBRemote::~ProcessGDBRemote() //---------------------------------------------------------------------- // PluginInterface //---------------------------------------------------------------------- -const char * +ConstString ProcessGDBRemote::GetPluginName() { - return "Process debugging plug-in that uses the GDB remote protocol"; -} - -const char * -ProcessGDBRemote::GetShortPluginName() -{ return GetPluginNameStatic(); } @@ -1746,7 +1741,7 @@ ProcessGDBRemote::DoDestroy () // FIXME: These should be ConstStrings so we aren't doing strcmp'ing. if (platform_sp && platform_sp->GetName() - && strcmp (platform_sp->GetName(), PlatformRemoteiOS::GetShortPluginNameStatic()) == 0) + && platform_sp->GetName() == PlatformRemoteiOS::GetPluginNameStatic()) { if (m_destroy_tried_resuming) { diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h index 5cbb13f4914..51924c553af 100644 --- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h +++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h @@ -50,7 +50,7 @@ public: static void Terminate(); - static const char * + static lldb_private::ConstString GetPluginNameStatic(); static const char * @@ -119,12 +119,9 @@ public: //------------------------------------------------------------------ // PluginInterface protocol //------------------------------------------------------------------ - virtual const char * + virtual lldb_private::ConstString GetPluginName(); - virtual const char * - GetShortPluginName(); - virtual uint32_t GetPluginVersion(); diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.cpp b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.cpp index 2bb6826e223..15b861feaa8 100644 --- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.cpp @@ -178,7 +178,7 @@ ProcessGDBRemoteLog::ListLogCategories (Stream *strm) " thread - log thread events and activities\n" " step - log step related activities\n" " verbose - enable verbose logging\n" - " watch - log watchpoint related activities\n", ProcessGDBRemote::GetPluginNameStatic()); + " watch - log watchpoint related activities\n", ProcessGDBRemote::GetPluginNameStatic().GetCString()); } diff --git a/lldb/source/Plugins/Process/mach-core/ProcessMachCore.cpp b/lldb/source/Plugins/Process/mach-core/ProcessMachCore.cpp index 0e19ebe7afd..abf3b673e68 100644 --- a/lldb/source/Plugins/Process/mach-core/ProcessMachCore.cpp +++ b/lldb/source/Plugins/Process/mach-core/ProcessMachCore.cpp @@ -38,10 +38,11 @@ using namespace lldb; using namespace lldb_private; -const char * +ConstString ProcessMachCore::GetPluginNameStatic() { - return "mach-o-core"; + static ConstString g_name("mach-o-core"); + return g_name; } const char * @@ -125,15 +126,9 @@ ProcessMachCore::~ProcessMachCore() //---------------------------------------------------------------------- // PluginInterface //---------------------------------------------------------------------- -const char * +ConstString ProcessMachCore::GetPluginName() { - return "Process debugging plug-in that loads mach-o core files."; -} - -const char * -ProcessMachCore::GetShortPluginName() -{ return GetPluginNameStatic(); } diff --git a/lldb/source/Plugins/Process/mach-core/ProcessMachCore.h b/lldb/source/Plugins/Process/mach-core/ProcessMachCore.h index 246d5722d5a..5048a549f8c 100644 --- a/lldb/source/Plugins/Process/mach-core/ProcessMachCore.h +++ b/lldb/source/Plugins/Process/mach-core/ProcessMachCore.h @@ -39,7 +39,7 @@ public: static void Terminate(); - static const char * + static lldb_private::ConstString GetPluginNameStatic(); static const char * @@ -74,12 +74,9 @@ public: //------------------------------------------------------------------ // PluginInterface protocol //------------------------------------------------------------------ - virtual const char * + virtual lldb_private::ConstString GetPluginName(); - virtual const char * - GetShortPluginName(); - virtual uint32_t GetPluginVersion(); diff --git a/lldb/source/Plugins/SymbolFile/DWARF/LogChannelDWARF.cpp b/lldb/source/Plugins/SymbolFile/DWARF/LogChannelDWARF.cpp index 54e789e1fef..27fa261813b 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/LogChannelDWARF.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/LogChannelDWARF.cpp @@ -51,7 +51,7 @@ LogChannelDWARF::CreateInstance () return new LogChannelDWARF (); } -const char * +lldb_private::ConstString LogChannelDWARF::GetPluginNameStatic() { return SymbolFileDWARF::GetPluginNameStatic(); @@ -63,15 +63,9 @@ LogChannelDWARF::GetPluginDescriptionStatic() return "DWARF log channel for debugging plug-in issues."; } -const char * +lldb_private::ConstString LogChannelDWARF::GetPluginName() { - return GetPluginDescriptionStatic(); -} - -const char * -LogChannelDWARF::GetShortPluginName() -{ return GetPluginNameStatic(); } @@ -187,7 +181,7 @@ LogChannelDWARF::ListCategories (Stream *strm) " lookups - log any lookups that happen by name, regex, or address\n" " completion - log struct/unions/class type completions\n" " map - log insertions of object files into DWARF debug maps\n", - SymbolFileDWARF::GetPluginNameStatic()); + SymbolFileDWARF::GetPluginNameStatic().GetCString()); } Log * diff --git a/lldb/source/Plugins/SymbolFile/DWARF/LogChannelDWARF.h b/lldb/source/Plugins/SymbolFile/DWARF/LogChannelDWARF.h index 6a6375cc806..2091a8414f5 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/LogChannelDWARF.h +++ b/lldb/source/Plugins/SymbolFile/DWARF/LogChannelDWARF.h @@ -43,7 +43,7 @@ public: static void Terminate(); - static const char * + static lldb_private::ConstString GetPluginNameStatic(); static const char * @@ -52,12 +52,9 @@ public: static lldb_private::LogChannel * CreateInstance (); - virtual const char * + virtual lldb_private::ConstString GetPluginName(); - virtual const char * - GetShortPluginName(); - virtual uint32_t GetPluginVersion(); diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp index d0b1a5ac00d..9a8030a0fe4 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp @@ -207,10 +207,11 @@ SymbolFileDWARF::Terminate() } -const char * +lldb_private::ConstString SymbolFileDWARF::GetPluginNameStatic() { - return "dwarf"; + static ConstString g_name("dwarf"); + return g_name; } const char * @@ -7557,15 +7558,9 @@ SymbolFileDWARF::ParseVariables //------------------------------------------------------------------ // PluginInterface protocol //------------------------------------------------------------------ -const char * +ConstString SymbolFileDWARF::GetPluginName() { - return "SymbolFileDWARF"; -} - -const char * -SymbolFileDWARF::GetShortPluginName() -{ return GetPluginNameStatic(); } diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h index 08dfc9632ee..87f86b80bbb 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h +++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h @@ -74,7 +74,7 @@ public: static void Terminate(); - static const char * + static lldb_private::ConstString GetPluginNameStatic(); static const char * @@ -181,12 +181,9 @@ public: //------------------------------------------------------------------ // PluginInterface protocol //------------------------------------------------------------------ - virtual const char * + virtual lldb_private::ConstString GetPluginName(); - virtual const char * - GetShortPluginName(); - virtual uint32_t GetPluginVersion(); diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp index 941484ea3a5..3afe396f223 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp @@ -179,8 +179,9 @@ public: const FileSpec& file_spec, const ArchSpec& arch, const ConstString *object_name, - off_t object_offset) : - Module (file_spec, arch, object_name, object_offset), + off_t object_offset, + const TimeValue *object_mod_time_ptr) : + Module (file_spec, arch, object_name, object_offset, object_mod_time_ptr), m_exe_module_wp (exe_module_sp), m_cu_idx (cu_idx) { @@ -213,7 +214,7 @@ public: // Set a a pointer to this class to set our OSO DWARF file know // that the DWARF is being used along with a debug map and that // it will have the remapped sections that we do below. - SymbolFileDWARF *oso_symfile = (SymbolFileDWARF *)symbol_vendor->GetSymbolFile(); + SymbolFileDWARF *oso_symfile = SymbolFileDWARFDebugMap::GetSymbolFileAsSymbolFileDWARF(symbol_vendor->GetSymbolFile()); if (!oso_symfile) return NULL; @@ -263,10 +264,11 @@ SymbolFileDWARFDebugMap::Terminate() } -const char * +lldb_private::ConstString SymbolFileDWARFDebugMap::GetPluginNameStatic() { - return "dwarf-debugmap"; + static ConstString g_name("dwarf-debugmap"); + return g_name; } const char * @@ -381,6 +383,9 @@ SymbolFileDWARFDebugMap::InitOSO() { m_compile_unit_infos[i].so_file.SetFile(so_symbol->GetName().AsCString(), false); m_compile_unit_infos[i].oso_path = oso_symbol->GetName(); + TimeValue oso_mod_time; + oso_mod_time.OffsetWithSeconds(oso_symbol->GetAddress().GetOffset()); + m_compile_unit_infos[i].oso_mod_time = oso_mod_time; uint32_t sibling_idx = so_symbol->GetSiblingIndex(); // The sibling index can't be less that or equal to the current index "i" if (sibling_idx <= i) @@ -436,12 +441,26 @@ SymbolFileDWARFDebugMap::GetModuleByCompUnitInfo (CompileUnitInfo *comp_unit_inf } else { + ObjectFile *obj_file = GetObjectFile(); comp_unit_info->oso_sp.reset (new OSOInfo()); m_oso_map[comp_unit_info->oso_path] = comp_unit_info->oso_sp; const char *oso_path = comp_unit_info->oso_path.GetCString(); FileSpec oso_file (oso_path, false); ConstString oso_object; - if (!oso_file.Exists()) + if (oso_file.Exists()) + { + TimeValue oso_mod_time (oso_file.GetModificationTime()); + if (oso_mod_time != comp_unit_info->oso_mod_time) + { + obj_file->GetModule()->ReportError ("debug map object file '%s' has changed (actual time is 0x%" PRIx64 ", debug map time is 0x%" PRIx64 ") since this executable was linked, file will be ignored", + oso_file.GetPath().c_str(), + oso_mod_time.GetAsSecondsSinceJan1_1970(), + comp_unit_info->oso_mod_time.GetAsSecondsSinceJan1_1970()); + return NULL; + } + + } + else { const bool must_exist = true; @@ -450,7 +469,6 @@ SymbolFileDWARFDebugMap::GetModuleByCompUnitInfo (CompileUnitInfo *comp_unit_inf oso_object, must_exist)) { - comp_unit_info->oso_sp->symbol_file_supported = false; return NULL; } } @@ -458,12 +476,13 @@ SymbolFileDWARFDebugMap::GetModuleByCompUnitInfo (CompileUnitInfo *comp_unit_inf // use the debug map, to add new sections to each .o file and // even though a .o file might not have changed, the sections // that get added to the .o file can change. - comp_unit_info->oso_sp->module_sp.reset (new DebugMapModule (GetObjectFile()->GetModule(), + comp_unit_info->oso_sp->module_sp.reset (new DebugMapModule (obj_file->GetModule(), GetCompUnitInfoIndex(comp_unit_info), oso_file, m_obj_file->GetModule()->GetArchitecture(), oso_object ? &oso_object : NULL, - 0)); + 0, + oso_object ? &comp_unit_info->oso_mod_time : NULL)); } } if (comp_unit_info->oso_sp) @@ -538,6 +557,14 @@ SymbolFileDWARFDebugMap::GetSymbolFileByOSOIndex (uint32_t oso_idx) } SymbolFileDWARF * +SymbolFileDWARFDebugMap::GetSymbolFileAsSymbolFileDWARF (SymbolFile *sym_file) +{ + if (sym_file && sym_file->GetPluginName() == SymbolFileDWARF::GetPluginNameStatic()) + return (SymbolFileDWARF *)sym_file; + return NULL; +} + +SymbolFileDWARF * SymbolFileDWARFDebugMap::GetSymbolFileByCompUnitInfo (CompileUnitInfo *comp_unit_info) { Module *oso_module = GetModuleByCompUnitInfo (comp_unit_info); @@ -545,7 +572,7 @@ SymbolFileDWARFDebugMap::GetSymbolFileByCompUnitInfo (CompileUnitInfo *comp_unit { SymbolVendor *sym_vendor = oso_module->GetSymbolVendor(); if (sym_vendor) - return (SymbolFileDWARF *)sym_vendor->GetSymbolFile(); + return GetSymbolFileAsSymbolFileDWARF (sym_vendor->GetSymbolFile()); } return NULL; } @@ -1219,15 +1246,9 @@ SymbolFileDWARFDebugMap::FindNamespace (const lldb_private::SymbolContext& sc, //------------------------------------------------------------------ // PluginInterface protocol //------------------------------------------------------------------ -const char * +lldb_private::ConstString SymbolFileDWARFDebugMap::GetPluginName() { - return "SymbolFileDWARFDebugMap"; -} - -const char * -SymbolFileDWARFDebugMap::GetShortPluginName() -{ return GetPluginNameStatic(); } @@ -1454,7 +1475,7 @@ SymbolFileDWARFDebugMap::LinkOSOAddress (Address &addr) if (addr_module == exe_module) return true; // Address is already in terms of the main executable module - CompileUnitInfo *cu_info = GetCompileUnitInfo ((SymbolFileDWARF *)addr_module->GetSymbolVendor()->GetSymbolFile()); + CompileUnitInfo *cu_info = GetCompileUnitInfo (GetSymbolFileAsSymbolFileDWARF(addr_module->GetSymbolVendor()->GetSymbolFile())); if (cu_info) { const lldb::addr_t oso_file_addr = addr.GetFileAddress(); diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h index aa21778222e..07f8e415c78 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h +++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h @@ -40,7 +40,7 @@ public: static void Terminate(); - static const char * + static lldb_private::ConstString GetPluginNameStatic(); static const char * @@ -112,12 +112,9 @@ public: //------------------------------------------------------------------ // PluginInterface protocol //------------------------------------------------------------------ - virtual const char * + virtual lldb_private::ConstString GetPluginName(); - virtual const char * - GetShortPluginName(); - virtual uint32_t GetPluginVersion(); @@ -133,11 +130,9 @@ protected: struct OSOInfo { lldb::ModuleSP module_sp; - bool symbol_file_supported; OSOInfo() : - module_sp (), - symbol_file_supported (true) + module_sp () { } }; @@ -153,6 +148,7 @@ protected: { lldb_private::FileSpec so_file; lldb_private::ConstString oso_path; + lldb_private::TimeValue oso_mod_time; OSOInfoSP oso_sp; lldb::CompUnitSP compile_unit_sp; uint32_t first_symbol_index; @@ -166,6 +162,7 @@ protected: CompileUnitInfo() : so_file (), oso_path (), + oso_mod_time (), oso_sp (), compile_unit_sp (), first_symbol_index (UINT32_MAX), @@ -192,6 +189,10 @@ protected: { return (uint32_t)((uid >> 32ull) - 1ull); } + + static SymbolFileDWARF * + GetSymbolFileAsSymbolFileDWARF (SymbolFile *sym_file); + bool GetFileSpecForSO (uint32_t oso_idx, lldb_private::FileSpec &file_spec); diff --git a/lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp b/lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp index 87e40daec6f..46460fe79d5 100644 --- a/lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp +++ b/lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp @@ -40,10 +40,11 @@ SymbolFileSymtab::Terminate() } -const char * +lldb_private::ConstString SymbolFileSymtab::GetPluginNameStatic() { - return "symbol-file.symtab"; + static ConstString g_name("symtab"); + return g_name; } const char * @@ -387,15 +388,9 @@ SymbolFileSymtab::FindTypes (const lldb_private::SymbolContext& sc, //------------------------------------------------------------------ // PluginInterface protocol //------------------------------------------------------------------ -const char * +lldb_private::ConstString SymbolFileSymtab::GetPluginName() { - return "SymbolFileSymtab"; -} - -const char * -SymbolFileSymtab::GetShortPluginName() -{ return GetPluginNameStatic(); } diff --git a/lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.h b/lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.h index 3c90b112d80..ede3447ee99 100644 --- a/lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.h +++ b/lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.h @@ -26,7 +26,7 @@ public: static void Terminate(); - static const char * + static lldb_private::ConstString GetPluginNameStatic(); static const char * @@ -113,12 +113,9 @@ public: //------------------------------------------------------------------ // PluginInterface protocol //------------------------------------------------------------------ - virtual const char * + virtual lldb_private::ConstString GetPluginName(); - virtual const char * - GetShortPluginName(); - virtual uint32_t GetPluginVersion(); diff --git a/lldb/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp b/lldb/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp index 56c04ba17b6..a598cf7d889 100644 --- a/lldb/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp +++ b/lldb/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp @@ -141,10 +141,11 @@ SymbolVendorMacOSX::Terminate() } -const char * +lldb_private::ConstString SymbolVendorMacOSX::GetPluginNameStatic() { - return "symbol-vendor.macosx"; + static ConstString g_name("macosx"); + return g_name; } const char * @@ -332,15 +333,9 @@ SymbolVendorMacOSX::CreateInstance (const lldb::ModuleSP &module_sp, lldb_privat //------------------------------------------------------------------ // PluginInterface protocol //------------------------------------------------------------------ -const char * +ConstString SymbolVendorMacOSX::GetPluginName() { - return "SymbolVendorMacOSX"; -} - -const char * -SymbolVendorMacOSX::GetShortPluginName() -{ return GetPluginNameStatic(); } diff --git a/lldb/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.h b/lldb/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.h index 2c16148ace8..31a842ade86 100644 --- a/lldb/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.h +++ b/lldb/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.h @@ -25,7 +25,7 @@ public: static void Terminate(); - static const char * + static lldb_private::ConstString GetPluginNameStatic(); static const char * @@ -45,12 +45,9 @@ public: //------------------------------------------------------------------ // PluginInterface protocol //------------------------------------------------------------------ - virtual const char * + virtual lldb_private::ConstString GetPluginName(); - virtual const char * - GetShortPluginName(); - virtual uint32_t GetPluginVersion(); diff --git a/lldb/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp b/lldb/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp index d2301b617aa..b20f732133b 100644 --- a/lldb/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp +++ b/lldb/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp @@ -309,20 +309,12 @@ UnwindAssemblyInstEmulation::CreateInstance (const ArchSpec &arch) //------------------------------------------------------------------ // PluginInterface protocol in UnwindAssemblyParser_x86 //------------------------------------------------------------------ - -const char * +ConstString UnwindAssemblyInstEmulation::GetPluginName() { - return "UnwindAssemblyInstEmulation"; -} - -const char * -UnwindAssemblyInstEmulation::GetShortPluginName() -{ - return "unwindassembly.inst-emulation"; + return GetPluginNameStatic(); } - uint32_t UnwindAssemblyInstEmulation::GetPluginVersion() { @@ -344,10 +336,11 @@ UnwindAssemblyInstEmulation::Terminate() } -const char * +ConstString UnwindAssemblyInstEmulation::GetPluginNameStatic() { - return "UnwindAssemblyInstEmulation"; + static ConstString g_name("inst-emulation"); + return g_name; } const char * diff --git a/lldb/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.h b/lldb/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.h index 653c75a5f0f..6a02f0a5510 100644 --- a/lldb/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.h +++ b/lldb/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.h @@ -53,18 +53,15 @@ public: static void Terminate(); - static const char * + static lldb_private::ConstString GetPluginNameStatic(); static const char * GetPluginDescriptionStatic(); - virtual const char * + virtual lldb_private::ConstString GetPluginName(); - virtual const char * - GetShortPluginName(); - virtual uint32_t GetPluginVersion(); diff --git a/lldb/source/Plugins/UnwindAssembly/x86/UnwindAssembly-x86.cpp b/lldb/source/Plugins/UnwindAssembly/x86/UnwindAssembly-x86.cpp index 7a18373e30f..d491683f687 100644 --- a/lldb/source/Plugins/UnwindAssembly/x86/UnwindAssembly-x86.cpp +++ b/lldb/source/Plugins/UnwindAssembly/x86/UnwindAssembly-x86.cpp @@ -931,16 +931,10 @@ UnwindAssembly_x86::CreateInstance (const ArchSpec &arch) // PluginInterface protocol in UnwindAssemblyParser_x86 //------------------------------------------------------------------ -const char * +ConstString UnwindAssembly_x86::GetPluginName() { - return "UnwindAssembly_x86"; -} - -const char * -UnwindAssembly_x86::GetShortPluginName() -{ - return "unwindassembly.x86"; + return GetPluginNameStatic(); } @@ -965,10 +959,11 @@ UnwindAssembly_x86::Terminate() } -const char * +lldb_private::ConstString UnwindAssembly_x86::GetPluginNameStatic() { - return "UnwindAssembly_x86"; + static ConstString g_name("x86"); + return g_name; } const char * diff --git a/lldb/source/Plugins/UnwindAssembly/x86/UnwindAssembly-x86.h b/lldb/source/Plugins/UnwindAssembly/x86/UnwindAssembly-x86.h index 2619f6558dc..eebaa7b6c80 100644 --- a/lldb/source/Plugins/UnwindAssembly/x86/UnwindAssembly-x86.h +++ b/lldb/source/Plugins/UnwindAssembly/x86/UnwindAssembly-x86.h @@ -50,18 +50,15 @@ public: static void Terminate(); - static const char * + static lldb_private::ConstString GetPluginNameStatic(); static const char * GetPluginDescriptionStatic(); - virtual const char * + virtual lldb_private::ConstString GetPluginName(); - virtual const char * - GetShortPluginName(); - virtual uint32_t GetPluginVersion(); diff --git a/lldb/source/Symbol/SymbolVendor.cpp b/lldb/source/Symbol/SymbolVendor.cpp index c991b1005b4..c39261903fa 100644 --- a/lldb/source/Symbol/SymbolVendor.cpp +++ b/lldb/source/Symbol/SymbolVendor.cpp @@ -433,16 +433,11 @@ SymbolVendor::GetCompileUnitAtIndex(size_t idx) //------------------------------------------------------------------ // PluginInterface protocol //------------------------------------------------------------------ -const char * +lldb_private::ConstString SymbolVendor::GetPluginName() { - return "SymbolVendor"; -} - -const char * -SymbolVendor::GetShortPluginName() -{ - return "vendor-default"; + static ConstString g_name("vendor-default"); + return g_name; } uint32_t diff --git a/lldb/source/Target/OperatingSystem.cpp b/lldb/source/Target/OperatingSystem.cpp index 3fecb4a6d2c..8ba52683877 100644 --- a/lldb/source/Target/OperatingSystem.cpp +++ b/lldb/source/Target/OperatingSystem.cpp @@ -25,7 +25,8 @@ OperatingSystem::FindPlugin (Process *process, const char *plugin_name) OperatingSystemCreateInstance create_callback = NULL; if (plugin_name) { - create_callback = PluginManager::GetOperatingSystemCreateCallbackForPluginName (plugin_name); + ConstString const_plugin_name(plugin_name); + create_callback = PluginManager::GetOperatingSystemCreateCallbackForPluginName (const_plugin_name); if (create_callback) { std::unique_ptr<OperatingSystem> instance_ap(create_callback(process, true)); diff --git a/lldb/source/Target/Platform.cpp b/lldb/source/Target/Platform.cpp index c1834d2bd87..1293691d12a 100644 --- a/lldb/source/Target/Platform.cpp +++ b/lldb/source/Target/Platform.cpp @@ -96,7 +96,7 @@ Platform::LocateExecutableScriptingResources (Target *target, Module &module) } Platform* -Platform::FindPlugin (Process *process, const char *plugin_name) +Platform::FindPlugin (Process *process, const ConstString &plugin_name) { PlatformCreateInstance create_callback = NULL; if (plugin_name) @@ -156,7 +156,8 @@ Platform::Create (const char *platform_name, Error &error) lldb::PlatformSP platform_sp; if (platform_name && platform_name[0]) { - create_callback = PluginManager::GetPlatformCreateCallbackForPluginName (platform_name); + ConstString const_platform_name (platform_name); + create_callback = PluginManager::GetPlatformCreateCallbackForPluginName (const_platform_name); if (create_callback) platform_sp.reset(create_callback(true, NULL)); else @@ -273,7 +274,7 @@ Platform::GetStatus (Stream &strm) uint32_t minor = UINT32_MAX; uint32_t update = UINT32_MAX; std::string s; - strm.Printf (" Platform: %s\n", GetShortPluginName()); + strm.Printf (" Platform: %s\n", GetPluginName().GetCString()); ArchSpec arch (GetSystemArchitecture()); if (arch.IsValid()) @@ -388,13 +389,13 @@ Platform::GetOSKernelDescription (std::string &s) return GetRemoteOSKernelDescription (s); } -const char * +ConstString Platform::GetName () { const char *name = GetHostname(); if (name == NULL || name[0] == '\0') - name = GetShortPluginName(); - return name; + return GetPluginName(); + return ConstString (name); } const char * @@ -592,9 +593,9 @@ Platform::ConnectRemote (Args& args) { Error error; if (IsHost()) - error.SetErrorStringWithFormat ("The currently selected platform (%s) is the host platform and is always connected.", GetShortPluginName()); + error.SetErrorStringWithFormat ("The currently selected platform (%s) is the host platform and is always connected.", GetPluginName().GetCString()); else - error.SetErrorStringWithFormat ("Platform::ConnectRemote() is not supported by %s", GetShortPluginName()); + error.SetErrorStringWithFormat ("Platform::ConnectRemote() is not supported by %s", GetPluginName().GetCString()); return error; } @@ -603,9 +604,9 @@ Platform::DisconnectRemote () { Error error; if (IsHost()) - error.SetErrorStringWithFormat ("The currently selected platform (%s) is the host platform and is always connected.", GetShortPluginName()); + error.SetErrorStringWithFormat ("The currently selected platform (%s) is the host platform and is always connected.", GetPluginName().GetCString()); else - error.SetErrorStringWithFormat ("Platform::DisconnectRemote() is not supported by %s", GetShortPluginName()); + error.SetErrorStringWithFormat ("Platform::DisconnectRemote() is not supported by %s", GetPluginName().GetCString()); return error; } diff --git a/lldb/source/Target/Process.cpp b/lldb/source/Target/Process.cpp index 01ee7e482d1..f4733c38d76 100644 --- a/lldb/source/Target/Process.cpp +++ b/lldb/source/Target/Process.cpp @@ -946,7 +946,8 @@ Process::FindPlugin (Target &target, const char *plugin_name, Listener &listener ProcessCreateInstance create_callback = NULL; if (plugin_name) { - create_callback = PluginManager::GetProcessCreateCallbackForPluginName (plugin_name); + ConstString const_plugin_name(plugin_name); + create_callback = PluginManager::GetProcessCreateCallbackForPluginName (const_plugin_name); if (create_callback) { process_sp = create_callback(target, listener, crash_file_path); |