diff options
author | Greg Clayton <gclayton@apple.com> | 2013-07-15 22:54:20 +0000 |
---|---|---|
committer | Greg Clayton <gclayton@apple.com> | 2013-07-15 22:54:20 +0000 |
commit | 7f98240df65cfabd6d4bbf95907711f6a2734298 (patch) | |
tree | da16a1bed64b0e9ea58667b300a3ee4907e69b4f /lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp | |
parent | 1c1d6c166627733e880546387bca5070d8aaa993 (diff) | |
download | bcm5719-llvm-7f98240df65cfabd6d4bbf95907711f6a2734298.tar.gz bcm5719-llvm-7f98240df65cfabd6d4bbf95907711f6a2734298.zip |
<rdar://problem/13793059>
Added a setting to control timeout for kdp response packets. While I was at it, I also added a way to control the response timeout for gdb-remote packets.
KDP defaults to 5 seconds, and GDB defaults to 1 second. These were the default values that were in the code prior to adding these settings.
(lldb) settings set plugin.process.gdb-remote.packet-timeout 10
(lldb) settings set plugin.process.kdp-remote.packet-timeout 10
llvm-svn: 186360
Diffstat (limited to 'lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp')
-rw-r--r-- | lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp | 76 |
1 files changed, 75 insertions, 1 deletions
diff --git a/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp b/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp index 1685517b484..a30b7fffef9 100644 --- a/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp +++ b/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp @@ -44,6 +44,63 @@ using namespace lldb; using namespace lldb_private; +namespace { + + static PropertyDefinition + g_properties[] = + { + { "packet-timeout" , OptionValue::eTypeUInt64 , true , 5, NULL, NULL, "Specify the default packet timeout in seconds." }, + { NULL , OptionValue::eTypeInvalid, false, 0, NULL, NULL, NULL } + }; + + enum + { + ePropertyPacketTimeout + }; + + class PluginProperties : public Properties + { + public: + + static ConstString + GetSettingName () + { + return ProcessKDP::GetPluginNameStatic(); + } + + PluginProperties() : + Properties () + { + m_collection_sp.reset (new OptionValueProperties(GetSettingName())); + m_collection_sp->Initialize(g_properties); + } + + virtual + ~PluginProperties() + { + } + + uint64_t + GetPacketTimeout() + { + const uint32_t idx = ePropertyPacketTimeout; + return m_collection_sp->GetPropertyAtIndexAsUInt64(NULL, idx, g_properties[idx].default_uint_value); + } + }; + + typedef std::shared_ptr<PluginProperties> ProcessKDPPropertiesSP; + + static const ProcessKDPPropertiesSP & + GetGlobalPluginProperties() + { + static ProcessKDPPropertiesSP g_settings_sp; + if (!g_settings_sp) + g_settings_sp.reset (new PluginProperties ()); + return g_settings_sp; + } + +} // anonymous namespace end + static const lldb::tid_t g_kernel_tid = 1; ConstString @@ -124,6 +181,9 @@ ProcessKDP::ProcessKDP(Target& target, Listener &listener) : { m_async_broadcaster.SetEventName (eBroadcastBitAsyncThreadShouldExit, "async thread should exit"); m_async_broadcaster.SetEventName (eBroadcastBitAsyncContinue, "async thread continue"); + const uint64_t timeout_seconds = GetGlobalPluginProperties()->GetPacketTimeout(); + if (timeout_seconds > 0) + m_comm.SetPacketTimeout(timeout_seconds); } //---------------------------------------------------------------------- @@ -716,7 +776,8 @@ ProcessKDP::Initialize() g_initialized = true; PluginManager::RegisterPlugin (GetPluginNameStatic(), GetPluginDescriptionStatic(), - CreateInstance); + CreateInstance, + DebuggerInitialize); Log::Callbacks log_callbacks = { ProcessKDPLog::DisableLog, @@ -728,6 +789,19 @@ ProcessKDP::Initialize() } } +void +ProcessKDP::DebuggerInitialize (lldb_private::Debugger &debugger) +{ + if (!PluginManager::GetSettingForProcessPlugin(debugger, PluginProperties::GetSettingName())) + { + const bool is_global_setting = true; + PluginManager::CreateSettingForProcessPlugin (debugger, + GetGlobalPluginProperties()->GetValueProperties(), + ConstString ("Properties for the kdp-remote process plug-in."), + is_global_setting); + } +} + bool ProcessKDP::StartAsyncThread () { |