diff options
Diffstat (limited to 'lldb/source/Plugins/Process/gdb-remote')
5 files changed, 18 insertions, 49 deletions
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp index 6948339c676..319fa654323 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp @@ -100,11 +100,10 @@ GDBRemoteCommunicationClient::GDBRemoteCommunicationClient() m_curr_pid(LLDB_INVALID_PROCESS_ID), m_curr_tid(LLDB_INVALID_THREAD_ID), m_curr_tid_run(LLDB_INVALID_THREAD_ID), m_num_supported_hardware_watchpoints(0), m_host_arch(), m_process_arch(), - m_os_version_major(UINT32_MAX), m_os_version_minor(UINT32_MAX), - m_os_version_update(UINT32_MAX), m_os_build(), m_os_kernel(), - m_hostname(), m_gdb_server_name(), m_gdb_server_version(UINT32_MAX), - m_default_packet_timeout(0), m_max_packet_size(0), - m_qSupported_response(), m_supported_async_json_packets_is_valid(false), + m_os_build(), m_os_kernel(), m_hostname(), m_gdb_server_name(), + m_gdb_server_version(UINT32_MAX), m_default_packet_timeout(0), + m_max_packet_size(0), m_qSupported_response(), + m_supported_async_json_packets_is_valid(false), m_supported_async_json_packets_sp(), m_qXfer_memory_map(), m_qXfer_memory_map_loaded(false) {} @@ -323,9 +322,7 @@ void GDBRemoteCommunicationClient::ResetDiscoverableSettings(bool did_exec) { m_qSymbol_requests_done = false; m_supports_qModuleInfo = true; m_host_arch.Clear(); - m_os_version_major = UINT32_MAX; - m_os_version_minor = UINT32_MAX; - m_os_version_update = UINT32_MAX; + m_os_version = llvm::VersionTuple(); m_os_build.clear(); m_os_kernel.clear(); m_hostname.clear(); @@ -944,18 +941,9 @@ int GDBRemoteCommunicationClient::SendLaunchEventDataPacket( return -1; } -bool GDBRemoteCommunicationClient::GetOSVersion(uint32_t &major, - uint32_t &minor, - uint32_t &update) { - if (GetHostInfo()) { - if (m_os_version_major != UINT32_MAX) { - major = m_os_version_major; - minor = m_os_version_minor; - update = m_os_version_update; - return true; - } - } - return false; +llvm::VersionTuple GDBRemoteCommunicationClient::GetOSVersion() { + GetHostInfo(); + return m_os_version; } bool GDBRemoteCommunicationClient::GetOSBuildString(std::string &s) { @@ -1218,9 +1206,7 @@ bool GDBRemoteCommunicationClient::GetHostInfo(bool force) { // "version" key instead of // "os_version"... { - Args::StringToVersion(value, m_os_version_major, m_os_version_minor, - m_os_version_update); - if (m_os_version_major != UINT32_MAX) + if (!m_os_version.tryParse(value)) ++num_keys_decoded; } else if (name.equals("watchpoint_exceptions_received")) { m_watchpoints_trigger_after_instruction = diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h index fcf578f9918..cf1d249768d 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h @@ -266,7 +266,7 @@ public: bool GetDefaultThreadId(lldb::tid_t &tid); - bool GetOSVersion(uint32_t &major, uint32_t &minor, uint32_t &update); + llvm::VersionTuple GetOSVersion(); bool GetOSBuildString(std::string &s); @@ -573,9 +573,7 @@ protected: ArchSpec m_host_arch; ArchSpec m_process_arch; - uint32_t m_os_version_major; - uint32_t m_os_version_minor; - uint32_t m_os_version_update; + llvm::VersionTuple m_os_version; std::string m_os_build; std::string m_os_kernel; std::string m_hostname; diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp index d0cdbf3e292..c5b478378fa 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp @@ -269,19 +269,10 @@ GDBRemoteCommunicationServerCommon::Handle_qHostInfo( break; } - uint32_t major = UINT32_MAX; - uint32_t minor = UINT32_MAX; - uint32_t update = UINT32_MAX; - if (HostInfo::GetOSVersion(major, minor, update)) { - if (major != UINT32_MAX) { - response.Printf("os_version:%u", major); - if (minor != UINT32_MAX) { - response.Printf(".%u", minor); - if (update != UINT32_MAX) - response.Printf(".%u", update); - } - response.PutChar(';'); - } + llvm::VersionTuple version = HostInfo::GetOSVersion(); + if (!version.empty()) { + response.Format("os_version:{0}", version.getAsString()); + response.PutChar(';'); } std::string s; diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp index e65f2f3e3b1..648df1a835f 100644 --- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp @@ -4241,13 +4241,8 @@ void ProcessGDBRemote::PrefetchModuleSpecs( } } -bool ProcessGDBRemote::GetHostOSVersion(uint32_t &major, uint32_t &minor, - uint32_t &update) { - if (m_gdb_comm.GetOSVersion(major, minor, update)) - return true; - // We failed to get the host OS version, defer to the base implementation to - // correctly invalidate the arguments. - return Process::GetHostOSVersion(major, minor, update); +llvm::VersionTuple ProcessGDBRemote::GetHostOSVersion() { + return m_gdb_comm.GetOSVersion(); } namespace { diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h index f0b68b2505c..45bb2d4c28e 100644 --- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h +++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h @@ -217,8 +217,7 @@ public: void PrefetchModuleSpecs(llvm::ArrayRef<FileSpec> module_file_specs, const llvm::Triple &triple) override; - bool GetHostOSVersion(uint32_t &major, uint32_t &minor, - uint32_t &update) override; + llvm::VersionTuple GetHostOSVersion() override; size_t LoadModules(LoadedModuleInfoList &module_list) override; |