Index: lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp =================================================================== --- lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp +++ lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp @@ -16,7 +16,6 @@ #include "lldb/Core/ModuleSpec.h" #include "lldb/Host/HostInfo.h" -#include "lldb/Host/StringConvert.h" #include "lldb/Host/XML.h" #include "lldb/Symbol/Symbol.h" #include "lldb/Target/MemoryRegionInfo.h" @@ -1660,22 +1659,14 @@ error_extractor.GetHexByteString(error_string); error.SetErrorString(error_string.c_str()); } else if (name.equals("dirty-pages")) { + llvm::SmallVector split_value; std::vector dirty_page_list; - std::string comma_sep_str = value.str(); - size_t comma_pos; - addr_t page; - while ((comma_pos = comma_sep_str.find(',')) != std::string::npos) { - comma_sep_str[comma_pos] = '\0'; - page = StringConvert::ToUInt64(comma_sep_str.c_str(), - LLDB_INVALID_ADDRESS, 16); - if (page != LLDB_INVALID_ADDRESS) + value.split(split_value, ','); + for (llvm::StringRef &x : split_value) { + addr_t page; + if (llvm::to_integer(x, page)) dirty_page_list.push_back(page); - comma_sep_str.erase(0, comma_pos + 1); } - page = StringConvert::ToUInt64(comma_sep_str.c_str(), - LLDB_INVALID_ADDRESS, 16); - if (page != LLDB_INVALID_ADDRESS) - dirty_page_list.push_back(page); region_info.SetDirtyPageList(dirty_page_list); } } Index: lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h =================================================================== --- lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h +++ lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h @@ -359,7 +359,7 @@ bool CalculateThreadStopInfo(ThreadGDBRemote *thread); - size_t UpdateThreadPCsFromStopReplyThreadsValue(std::string &value); + size_t UpdateThreadPCsFromStopReplyThreadsValue(llvm::StringRef value); size_t UpdateThreadIDsFromStopReplyThreadsValue(llvm::StringRef value); Index: lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp =================================================================== --- lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp +++ lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp @@ -43,7 +43,6 @@ #include "lldb/Host/HostThread.h" #include "lldb/Host/PosixApi.h" #include "lldb/Host/PseudoTerminal.h" -#include "lldb/Host/StringConvert.h" #include "lldb/Host/ThreadLauncher.h" #include "lldb/Host/XML.h" #include "lldb/Interpreter/CommandInterpreter.h" @@ -381,20 +380,16 @@ } static size_t SplitCommaSeparatedRegisterNumberString( - const llvm::StringRef &comma_separated_regiter_numbers, + const llvm::StringRef &comma_separated_register_numbers, std::vector ®nums, int base) { regnums.clear(); - std::pair value_pair; - value_pair.second = comma_separated_regiter_numbers; - do { - value_pair = value_pair.second.split(','); - if (!value_pair.first.empty()) { - uint32_t reg = StringConvert::ToUInt32(value_pair.first.str().c_str(), - LLDB_INVALID_REGNUM, base); - if (reg != LLDB_INVALID_REGNUM) - regnums.push_back(reg); - } - } while (!value_pair.second.empty()); + llvm::SmallVector split_string; + comma_separated_register_numbers.split(split_string, ','); + for (llvm::StringRef &x : split_string) { + uint32_t reg; + if (llvm::to_integer(x, reg)) + regnums.push_back(reg); + } return regnums.size(); } @@ -1459,21 +1454,16 @@ return m_thread_ids.size(); } -size_t -ProcessGDBRemote::UpdateThreadPCsFromStopReplyThreadsValue(std::string &value) { +size_t ProcessGDBRemote::UpdateThreadPCsFromStopReplyThreadsValue( + llvm::StringRef value) { m_thread_pcs.clear(); - size_t comma_pos; - lldb::addr_t pc; - while ((comma_pos = value.find(',')) != std::string::npos) { - value[comma_pos] = '\0'; - pc = StringConvert::ToUInt64(value.c_str(), LLDB_INVALID_ADDRESS, 16); - if (pc != LLDB_INVALID_ADDRESS) + llvm::SmallVector split_value; + value.split(split_value, ','); + for (llvm::StringRef &x : split_value) { + lldb::addr_t pc; + if (llvm::to_integer(x, pc)) m_thread_pcs.push_back(pc); - value.erase(0, comma_pos + 1); } - pc = StringConvert::ToUInt64(value.c_str(), LLDB_INVALID_ADDRESS, 16); - if (pc != LLDB_INVALID_ADDRESS) - m_thread_pcs.push_back(pc); return m_thread_pcs.size(); }